SkyBox Tutorial
|
|
|
Tweet |
To view this page ensure that Adobe Flash Player version 11.0.0 or greater is installed.
Please wait while it loads. (File size: 1.2 MB)
package
{
import com.yogurt3d.Yogurt3D;
import com.yogurt3d.core.events.Yogurt3DEvent;
import com.yogurt3d.core.sceneobjects.SkyBox;
import com.yogurt3d.core.texture.CubeTextureMap;
import flash.display.Sprite;
import flash.geom.Matrix3D;
import flash.geom.Vector3D;
[SWF(width="400", height="300")]
public class SkyBoxTutorial extends Sprite
{
/**
* Embeded SkyBox images
**/
[Embed(source="../resources/hills_negative_x.png")]
private var embednegativeX:Class;
[Embed(source="../resources/hills_negative_y.png")]
private var embednegativeY:Class;
[Embed(source="../resources/hills_negative_z.png")]
private var embednegativeZ:Class;
[Embed(source="../resources/hills_positive_x.png")]
private var embedpositiveX:Class;
[Embed(source="../resources/hills_positive_y.png")]
private var embedpositiveY:Class;
[Embed(source="../resources/hills_positive_z.png")]
private var embedpositiveZ:Class;
public function SkyBoxTutorial()
{
super();
Yogurt3D.instance.addEventListener( Yogurt3DEvent.READY, onContextReady );
Yogurt3D.instance.init( this.stage );
}
public function onContextReady( _e:Yogurt3DEvent ):void{
Yogurt3D.instance.defaultSetup( 400,300 );
Yogurt3D.instance.defaultScene.sceneColor = 0xEFEFEF;
// create a cubemap from the embeded images.
var cubeTexture:CubeTextureMap = new CubeTextureMap();
cubeTexture.setFace( CubeTextureMap.NEGATIVE_X, new embednegativeX() );
cubeTexture.setFace( CubeTextureMap.NEGATIVE_Y, new embednegativeY() );
cubeTexture.setFace( CubeTextureMap.NEGATIVE_Z, new embednegativeZ() );
cubeTexture.setFace( CubeTextureMap.POSITIVE_X, new embedpositiveX() );
cubeTexture.setFace( CubeTextureMap.POSITIVE_Y, new embedpositiveY() );
cubeTexture.setFace( CubeTextureMap.POSITIVE_Z, new embedpositiveZ() );
// Create a skybox from the cubeMap
var skybox:SkyBox = new SkyBox( cubeTexture );
// Set the current scene's skybox
Yogurt3D.instance.defaultScene.skyBox = skybox;
Yogurt3D.instance.enginePreUpdateCallback = function():void{
// rotates the camera on enter frame
Yogurt3D.instance.defaultCamera.transformation.rotationX ++;
Yogurt3D.instance.defaultCamera.transformation.rotationY ++;
};
Yogurt3D.instance.startAutoUpdate();
}
}
}
New Version with Stage3D
Yogurt3D v2.1
About Yogurt3D
Yogurt3D Game Engine is a state of the art Actionscript 3.0 library for developing 3D applications on Adobe Flash Platform. We claim it is possible to create in-browser 3D games without any plug-in installation. Its animation system, model formats, exporter plug-ins for modelling tools, scene hierarchy and scene management structure, and that it is developed with a game developer perspective, makes Yogurt3D a powerful tool for 3D game developers.
If you wish to target both casual and seasoned players with browser-based real-time 3D games on the web, Yogurt 3D Game Engine is the ultimate tool to choose.
About Yogurt Technologies
Yoğurt Technologies was founded in 1997 by a group of artists and computer engineers.
For 10 years the group worked as a new media agency producing technology for other companies.
In 2007, the decision to focus on its own products was taken as Yoğurt members foresaw that 3D would be the next big thing on the web. Thus, the company now produces 3D tools that will be available to anyone who wants to try a hand on 3D content.
