Hello,
I have a very simple project to achieve (a frieze with plane and characters in 3ds). So I started with one of your tutorials, but I can not bring up one plane ...
However, I think you have correctly configured my scene, would you have an idea?
Thank you very much.
package
{
import away3d.cameras.Camera3D;
import away3d.containers.*;
import away3d.debug.AwayStats;
import away3d.debug.Trident;
import away3d.entities.Mesh;
import away3d.events.AssetEvent;
import away3d.library.*;
import away3d.library.assets.*;
import away3d.lights.PointLight;
import away3d.materials.ColorMaterial;
import away3d.materials.methods.*;
import away3d.primitives.PlaneGeometry;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.geom.Vector3D;
[SWF(backgroundColor="#000000", frameRate="60", width="1000", height="600")]
public class Main extends Sprite
{
private var scene:Scene3D;
private var camera:Camera3D;
private var view:View3D;
// Away3D Config
private var cameraViewDistance:Number = 1000;
private var antiAlias:Number = 2;
// Away3D Helpers
private var stats:AwayStats;
private var trident:Trident;
// Lights
//private var directionalLight:DirectionalLight;
private var pointLight:PointLight;
private var Material1:ColorMaterial;
public function Main()
{
this.addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
}
private function addedToStageHandler(e:Event):void
{
this.removeEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
// Init
init();
}
// --------------------------------------------------------------------------------------------------------------
/*** Setup lights */
private function setupLights():void
{
// Point light
pointLight = new PointLight();
pointLight.color = 0xFFFFFF;
scene.addChild(pointLight);
}
// --------------------------------------------------------------------------------------------------------------
private function init():void
{
setupAway3D4();
setupLights();
setupEventListeners();
SetUp();
}
/*** Setup the Away3D 4 Engine */
private function setupAway3D4():void
{
// Setup scene
scene = new Scene3D();
// Setup camera
camera = new Camera3D();
//camera.lens.far = cameraViewDistance;
// Setup view
view = new View3D();
view.scene = scene;
view.camera = camera;
view.antiAlias = antiAlias;
// Position Away3D4s view
view.width = stage.stageWidth;
view.height = stage.stageHeight;
addChild(view);
// Show a Trident
trident = new Trident();
trident.z = 1000;
trident.scale(5);
scene.addChild(trident);
}
private function SetUp():void {
Material1 = new ColorMaterial(0xff0000);
var myPlane:Mesh = new Mesh(new PlaneGeometry(2, 2, 200, 200), Material1);
/*var myCube:Mesh = new Mesh (new CubeGeometry(20, 20, 20, 20), new ColorMaterial(0xff0000));
scene.addChild(myCube);*/
scene.addChild(myPlane);
stats = new AwayStats(view,true);
stats.x = 5;
stats.y = 5;
this.addChild(stats);
}
private function setupEventListeners():void
{
stage.addEventListener(Event.ENTER_FRAME,renderHandler);
}
// --------------------------------------------------------------------------------------------------------------
/*** Render handler */
private function renderHandler(e:Event):void
{
view.render();
}
// --------------------------------------------------------------------------------------------------------------
/*** Resize handler */
private function resizeHandler(e:Event=null):void
{
view.width = stage.stageWidth;
view.height = stage.stageHeight;
}
}
}