SegmentSet and multiple views rendering : render only in the 1st view

Software: Away3D 4.x

Avatar
rkn14, Newbie
Posted: 02 April 2012 12:49 AM   Total Posts: 13

Hi all,

I’ve just posted this
https://github.com/away3d/away3d-core-fp11/issues/247

This is a sample code and a screenshot of the result.

If someone can help me in the next hours/days, that would be cool.
I have to deliver a small project…. :s

Otherwise i will use Cubes or Cylinders instead of lines.

Thanks !!!


package
{
import away3d.containers.Scene3D;
import away3d.containers.View3D;
import away3d.entities.Mesh;
import away3d.entities.SegmentSet;
import away3d.materials.ColorMaterial;
import away3d.primitives.LineSegment;
import away3d.primitives.SphereGeometry;

import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.geom.Vector3D;


[SWF(width=“1000”, height=“400”, framerate=“60”)]
public class TestBugSegments extends Sprite
{
  private var _scene : Scene3D;
 
  private var _view1 : View3D;
  private var _view2 : View3D;
 
 
 
  public function TestBugSegments()
  {
 
  stage.scaleMode = StageScaleMode.NO_SCALE;
  stage.align = StageAlign.TOP_LEFT;
 
  _scene = new Scene3D();
 
  _view1 = new View3D(_scene);
  _view1.camera.z = -200;
  _view1.camera.y = 200;
  _view1.camera.lookAt(new Vector3D());
  _view2 = new View3D(_scene);
  _view2.camera.z = -200;
  _view2.camera.y = 200;
  _view2.camera.lookAt(new Vector3D());
 
  _view1.width = _view2.width = 500;
  _view1.height = _view2.height = 400;
 
  _view2.x = 500;
 
  addChild(_view1);
  addChild(_view2); 
 
  // origin segments
  _createOrigin();
 
  // sphere
  var sphere : SphereGeometry = new SphereGeometry(50);
  var mesh : Mesh = new Mesh(sphere, new ColorMaterial(0xFF0000));
  _scene.addChild(mesh);
 
  addEventListener(Event.ENTER_FRAME, _handler_EnterFrame);
 
 
  }
 
  private function _handler_EnterFrame(event:Event):void
  {
  _view1.render();
  _view2.render();
  }
 
 
 
 
  private function _createOrigin():void
  {     
  var origin:Vector3D = new Vector3D(0, 0, 0);
 
  var xAxis:LineSegment = new LineSegment(origin, new Vector3D(1000, 0, 0), 0xFFFF00, 0xFFFF00, 10);
  var yAxis:LineSegment = new LineSegment(origin, new Vector3D(0, 1000, 0), 0xFFFF00, 0xFFFF00, 10);
  var zAxis:LineSegment = new LineSegment(origin, new Vector3D(0, 0, 1000), 0xFFFF00, 0xFFFF00, 10);
   
  var segments : SegmentSet = new SegmentSet();
  segments.addSegment(xAxis);
  segments.addSegment(yAxis);
  segments.addSegment(zAxis);
 
  segments.rotationY = 45;
 
  _scene.addChild(segments);
 
  }
}
}

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X