How to render a plane in orthogonal, and a figure in a perspective projection?

Software: Away3D 4.x

Vacuum bulb slave, Newbie
Posted: 16 June 2017 07:35 AM   Total Posts: 3

How to render a plane in orthogonal, and a figure in a perspective projection?

This code not work.

package;

//   OpenFL   
import openfl.display.*;
import openfl.events.*;
import openfl.geom.Point;
import openfl.geom.Rectangle;
import openfl.text.TextField;
import openfl.text.TextFieldAutoSize;
import openfl.text.TextFormat;
import openfl.text.TextFormatAlign;
import openfl.Assets;
import openfl.Lib;
import openfl.geom.Vector3D;
//   Away3D   
import away3d.containers.*;
import away3d.entities.*;
import away3d.materials.*;
import away3d.primitives.*;
import away3d.utils.*;
import away3d.debug.AwayFPS;
import away3d.cameras.lenses.LensBase;       
    
import away3d.cameras.lenses.OrthographicLens; 
    
import away3d.cameras.lenses.PerspectiveLens; 

class 
Main extends Sprite {
 
 
private var _view:View3D;
 private var 
_plane:Mesh;
 private var 
_plane2:Mesh;
 private var 
_plane3:Mesh;

 public function new() 
{
  super
();
  
  
_view = new View3D();
  
addChild(_view);
   
_view.camera.y = 800; 
   
_view.camera.z = -500;
  
_view.camera.lookAt(new Vector3D());
    
   
  
//   ORTHOGRAPHIC   
  //_view.camera.lens = new OrthographicLens(); 
  
  
_plane = new Mesh(new PlaneGeometry(1024, 1024 ), 
  new 
TextureMaterial(Cast.bitmapTexture("assets/45.jpg")));
  
_plane.x = 0;
  
_plane.y = 0;
  
_plane.z = -220; 
  
_plane.rotationX = -30;
    
  
_plane2 = new Mesh(new PlaneGeometry(1024, 1024), 
  new 
TextureMaterial(Cast.bitmapTexture("assets/56.jpg")));
  
_plane2.x = 1024;
  
_plane2.y = 0;
  
_plane2.z = -220; 
  
_plane2.rotationX = -30;
 
 
  
//  PERSPECTIVE   
  //_view.camera.lens = new PerspectiveLens(); 

  
_plane3 = new Mesh(new PlaneGeometry(512, 512), 
  new 
TextureMaterial(Cast.bitmapTexture("assets/23.jpg")));
  
_plane3.x = 0;
  
_plane3.y = 0;
  
_plane3.z = -220.01; 
  
_plane3.rotationX = -30;
    
  
_view.scene.addChild(_plane );
  
_view.scene.addChild(_plane2 );
  
_view.scene.addChild(_plane3 );
  
  
  
//setup the render loop
  
addEventListener(Event.ENTER_FRAME, _onEnterFrame);
  
stage.addEventListener(Event.RESIZE, onResize);
  
onResize();
  
 
}

 
private function _onEnterFrame(e:Event):Void {
  
  _view
.render();
  
 
}
 
private function onResize(event:Event = null):Void {
  _view
.width = stage.stageWidth;
  
_view.height = stage.stageHeight;
 
}
 
} 
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X