添加新的Stage3DProxy

时间:2015-02-17 02:59:02

标签: actionscript-3 stage3d away3d

我正在尝试为Away3d添加一个新视图,我无法让它显示出来。

以前如果我有一个View3d,然后创建一个Stage3dProxy以创建一个新的视图,它工作正常 - 但是当试图切换回它时会导致太多问题。

我决定在开始时初始化Stage3dProxy,分配初始视图然后添加新视图。它似乎是渲染,它只是隐藏,我无法弄清楚如何显示它。

以下是获取新视图的代码:

        public function loadVR(){

        vrMode = true;
        stage3DProxy.clear();
        view.width = stage.stageWidth/2;
        view.layeredView = true;
        stage3DProxy.context3D.setDepthTest( false, Context3DCompareMode.ALWAYS);
        initializeVR();
    }


    private function initializeVR():void
    {
        trace('PanoVR.initialize()');
        initialized = true;
        Model.state.autoPlay = false;

        rightEye = new View3D();
        rightEye.width = stage.stageWidth/2;
        rightEye.height = stage.stageHeight;
        rightEye.x = stage.stageWidth/2;
        rightEye.y = 0;
        rightEye.backgroundColor = 0xFF9900;

        rightEye.stage3DProxy = stage3DProxy;
        rightEye.shareContext = true;


        rightEye.layeredView = true;


        rightEye.camera = new Camera3D();
        //rightEye.camera.lens = new VRLens(zoom,0.25,0.5);
        rightEye.camera.lens = new PerspectiveLens(zoom);
        rightEye.camera.lens.far = cameraViewDistance;
        rightEye.camera.lens.near = 100;
        rightEye.z = 0;
        cameraControllerR = new HoverController(rightEye.camera, null, pan, 0, 0.1);

        rightEye.scene = scene;
        addChild( rightEye );
        rightEye.render();

        rightEye.visible = true;
        stage3DProxy.context3D.setDepthTest(true,Context3DCompareMode.LESS);

    //  view.width = stage.stageWidth/3;

        stage3DProxy.present();

        panoTilesLoaded();

    }

有关如何显示新视图的任何线索?

1 个答案:

答案 0 :(得分:0)

我必须使用Stage3dProxy初始化第一个视图,并将输入框架侦听器更改为Stage3dProxy。