lmg
unread,Jun 20, 2008, 12:18:23 PM6/20/08Sign 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
out of curiosity I tried to have multiple views of one scene but got
strange results:
flickering views if overlapping occurred although both views are
clipped
objects disappeared as soon as I added a light to the scene (from
both scenes or only the one rendered first, depending on the material
used)
am I trying something not supported or (hopefully) just doing it the
wrong way?
--
package {
import away3d.cameras.HoverCamera3D;
import away3d.containers.Scene3D;
import away3d.containers.View3D;
import away3d.core.clip.RectangleClipping;
import away3d.lights.DirectionalLight3D;
import away3d.materials.*;
import away3d.primitives.Cone;
import away3d.primitives.Plane;
import away3d.primitives.Trident;
import flash.display.Sprite;
import flash.events.Event;
[SWF(backgroundColor="#CCCCCC", frameRate="30", quality="HIGH",
width="800", height="400")]
public class aw3D_multiview extends Sprite {
private var scene:Scene3D;
private var view1:View3D;
private var view2:View3D;
private var cam1:HoverCamera3D;
private var cam2:HoverCamera3D;
public function aw3D_multiview() {
//*** change those:
//var mat:IMaterial = new ColorMaterial(0x334455);
//var mat:IMaterial = new ShadingColorMaterial(0x334455);
var mat:IMaterial = new PhongColorMaterial(0x334455);
scene = new Scene3D();
scene.addChild( new Trident(100) );
scene.addChild( new Plane({segmentsW:10,segmentsH:
10,material:mat}) );
var cone:Cone = new Cone({radius:20,height:100,material:mat});
cone.movePivot( 0,-cone.height/2,0 );
cone.y = 0;
scene.addChild(cone);
scene.addChild( new DirectionalLight3D({
x: 500, y: 1000, z: 2000,
color:0xFFFFFF, brightness: 0, ambient:0.2, diffuse:0.8, specular:
0.1 }) );
var clipRect:RectangleClipping = new RectangleClipping(-200, -200,
200, 200);
cam1 = new HoverCamera3D({
distance: 1000,
panangle: -30, tiltangle: 10 });
view1 = new View3D({
x: 200, y: 200,
scene: scene, camera: cam1,
clip: clipRect });
addChild(view1);
cam2 = new HoverCamera3D({
distance: 500,
panangle: -40, tiltangle: 30 });
view2 = new View3D({
x: 600, y: 200,
scene: scene, camera: cam2,
clip: clipRect });
addChild(view2);
addEventListener( Event.ENTER_FRAME, onEnterFrame );
}
private function onEnterFrame(event:Event):void {
cam1.panangle--;
cam1.update();
view1.render();
cam2.panangle++;
cam2.update();
view2.render();
}
}
}