Code
package
{
import alternativa.engine3d.core.Camera3D;
import alternativa.engine3d.core.Object3D;
import alternativa.engine3d.core.Resource;
import alternativa.engine3d.core.View;
import alternativa.engine3d.materials.FillMaterial;
import alternativa.engine3d.primitives.Box;
import flash.display.Sprite;
import flash.display.Stage3D;
import flash.events.Event;
/**
* ...
* @author Siberian
*/
public final class Main extends Sprite
{
private var rootContainer : Object3D = newObject3D();
private var camera : Camera3D;
private var stage3D : Stage3D;
private var box: Box;
public function Main()
{
trace("Successfull Init");
camera = new Camera3D(1, 0, 10000);
camera.view = new View(stage.stageHight, stage.stageWidth);
camera.rotationX = -120 * Math.PI / 180;
camera.y = -800;
camera.z = 400;
addChild(camera.view);
rootContainer.addChild(camera);
box - new Box(500, 500, 500, 5, 5, 5);
var material: FillMaterial = new FillMaterial(#FF7FFF);
box.setMaterialToAllSurfaces(material);
rootContainer.addChild(box);
stage3D = stage.stage3Ds[0];
stage3D.addEventListener(Event.CONTEXT3D_CREATE, onContextCreate);
stage3D.requestContext3D();
}
public function onContextCreate(e: Event) : void {
for each (var recource: Recource in rootContainer.getResorces(true)) {
resorce.upload(stage3D.context3D);
}
stage.addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function onEnterFrame(e: Event) : void {
box.rotationZ -= 0.01;
camera.render(stage3D);
}
}
}
Почему-то не хочет рендерить. В чем прикол?Добавлено (20.10.2011, 18:59)
---------------------------------------------
Просто белый фон
Добавлено (20.10.2011, 19:04)
---------------------------------------------
Вот такой результат: