Setting up a skybox

Software: Away3D 4.x

geestring, Newbie
Posted: 24 June 2012 10:31 PM   Total Posts: 1

I haven’t used away3d before and was wondering how I would implement a “skybox.” I have created an html5 version which uses an equirectangular image as its texture.

Is there a special skybox class in awa3d that automatically creates a cube?

   

dubletar, Member
Posted: 25 June 2012 02:44 AM   Total Posts: 73   [ # 1 ]

You can learn from my code. Skybox is pretty simple:

//skyBox vars
private var skyTexture:BitmapCubeTexture;

[Embed(source="../embeds/pos_x.png")]
private var posX:Class;
[Embed(source="../embeds/pos_y.png")]
private var posY:Class;
[Embed(source="../embeds/pos_z.png")]
private var posZ:Class;
[Embed(source="../embeds/neg_x.png")]
private var negX:Class;
[Embed(source="../embeds/neg_y.png")]
private var negY:Class;
[Embed(source="../embeds/neg_z.png")]
private var negZ:Class;

private function 
loadSkyBox():void
{
 skyTexture 
= new BitmapCubeTexture(new posX().bitmapData, new negX().bitmapData, new posY().bitmapData, new negY().bitmapData, new posZ().bitmapData, new negZ().bitmapData);

 
scene.addChild(new SkyBox(skyTexture));
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X