ConteZero
unread,Oct 11, 2009, 4:10:30 AM10/11/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to away3d.dev
I've updated Away3d Lite to svn revision r1941 (quad support is
fantastic), but I've found a sorting problem.
If you mix on the same scene a primitive based on quad (cube6) with a
triangle based primitive (cone), sorting is wrong, quad primitive is
always rendered in front of the other primitive.
I've modified the Basic_SceneSetup file to show the problem.
I've also found a crash bug (not present in old revisions), to avoid
crash I've added a render() call after primitive creation.
package
{
import away3dlite.cameras.*;
import away3dlite.containers.*;
import away3dlite.materials.*;
import away3dlite.primitives.*;
import net.hires.debug.Stats;
import flash.display.*;
import flash.events.*;
[SWF(backgroundColor="#000000", frameRate="60", quality="MEDIUM",
width="800", height="600")]
public class Basic_SceneSetup extends Sprite
{
//signature swf
[Embed(source="assets/signature_lite.swf", symbol="Signature")]
public static var SignatureSwf:Class;
//engine variables
private var scene:Scene3D;
private var camera:Camera3D;
private var view:View3D;
//signature variables
private var Signature:Sprite;
private var SignatureBitmap:Bitmap;
//material objects
private var material:ColorMaterial;
//scene objects
private var plane:Plane;
private var cone:Cone;
private var cube:Cube6;
/**
* Constructor
*/
public function Basic_SceneSetup()
{
init();
}
/**
* Global initialise function
*/
private function init():void
{
initEngine();
initMaterials();
initObjects();
initListeners();
}
/**
* Initialise the engine
*/
private function initEngine():void
{
scene = new Scene3D();
//camera = new Camera3D({z:-1000});
camera = new Camera3D();
camera.z = -2000;
//view = new View3D({scene:scene, camera:camera});
view = new View3D();
view.scene = scene;
view.camera = camera;
view.camera.x = 300;
//view.addSourceURL("srcview/index.html");
addChild(view);
//add signature
Signature = Sprite(new SignatureSwf());
SignatureBitmap = new Bitmap(new BitmapData
(Signature.width, Signature.height, true, 0));
stage.quality = StageQuality.HIGH;
SignatureBitmap.bitmapData.draw(Signature);
stage.quality = StageQuality.MEDIUM;
addChild(SignatureBitmap);
addChild(new Stats());
}
/**
* Initialise the materials
*/
private function initMaterials():void
{
material = new ColorMaterial(0xCC0000);
}
/**
* Initialise the scene objects
*/
private function initObjects():void
{
//plane = new Plane({material:material, width:500, height:500,
yUp:false, bothsides:true});
plane = new Plane();
plane.material = material;
plane.width = 500;
plane.height = 500;
plane.yUp = false;
plane.bothsides = true;
plane.z = 600;
// scene.addChild(plane);
cone = new Cone();
cone.height = 200;
cone.radius = 100;
cone.z = -200;
scene.addChild(cone);
// view.render();
cube = new Cube6();
cube.width = 200;
cube.height = 200;
cube.depth = 200;
cube.z = 200;
scene.addChild(cube);
view.render();//added to avoid player crash
}
/**
* Initialise the listeners
*/
private function initListeners():void
{
addEventListener(Event.ENTER_FRAME, onEnterFrame);
stage.addEventListener(Event.RESIZE, onResize);
onResize();
}
/**
* Navigation and render loop
*/
private function onEnterFrame( e:Event ):void
{
// plane.rotationY += 2;
view.render();
}
/**
* stage listener for resize events
*/
private function onResize(event:Event = null):void
{
view.x = stage.stageWidth / 2;
view.y = stage.stageHeight / 2;
SignatureBitmap.y = stage.stageHeight - Signature.height;
}
}
}