If it's any help, here is the code:

/*

Basic scene setup example in Away3dLite

Demonstrates:

How to setup your own camera and scene, and apply it to a view.
How to add 3d objects to a scene.
How to update the view every frame.

Code by Rob Bateman & Katopz
[email protected]
http://www.infiniteturtles.co.uk
[email protected]
http://sleepydesign.com/

This code is distributed under the MIT License

Copyright (c)

Permission is hereby granted, free of charge, to any person obtaining
a copy
of this software and associated documentation files (the “Software”),
to deal
in the Software without restriction, including without limitation the
rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be
included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN
THE SOFTWARE.

*/

package
{
        import away3dlite.core.base.*;
        import away3dlite.materials.*;
        import away3dlite.primitives.*;
        import away3dlite.templates.*;
        import away3dlite.cameras.lenses.*;
        import away3dlite.loaders.*;
        import away3dlite.events.*;

        import flash.display.*;
        import flash.events.*;

        /**
         * FastTemplate example testing the maximum amount of faces rendered
in a frame at 30fps
         */

        public class ExSphereSpeedTest extends FastTemplate
        {
                //signature variables
                private var Signature:Sprite;
                private var SignatureBitmap:Bitmap;
                private static var m_modelMaterial:BitmapFileMaterial;

                /**
                 * @inheritDoc
                 */
                protected override function onInit():void
                {
                        title += " : Sphere speed test.";

                        //hack to get framerate up in cs4
                        var background:Sprite = new Sprite();
                        background.graphics.lineStyle(1, 0)
            background.graphics.drawRect(-400, -300, 800, 600);
                        view.addChild(background);

                        /*
                        camera.zoom = 1; //15;
                        camera.focus = 1; //50;
                        camera.z = -50;
                        camera.x = 10;
                        camera.y = -50;
                        */

                        camera.zoom = 45;
                        camera.focus = 50;
                        camera.z = -500;
                        camera.lens = new OrthogonalLens(); //added lens here!

                        //renderer.sortObjects = false;

                        loadModel();

                        //onMouseUp2();
                        //onMouseUp2();
                        //onMouseUp2();
                        //onMouseUp2();
                        //onMouseUp2();
                        //onMouseUp2();

                        //add signature
           /* Signature = Sprite(new SignatureSwf());
            SignatureBitmap = new Bitmap(new BitmapData
(Signature.width, Signature.height, true, 0));
            SignatureBitmap.y = stage.stageHeight - Signature.height;
            stage.quality = StageQuality.HIGH;
            SignatureBitmap.bitmapData.draw(Signature);
            stage.quality = StageQuality.MEDIUM;
                        addChild(SignatureBitmap);
                        */
                        stage.addEventListener(MouseEvent.MOUSE_DOWN, 
onMouseDown2);
                        stage.addEventListener(MouseEvent.CLICK, onMouseUp2);
                }

                /**
                 * @inheritDoc
                 */
                protected override function onPreRender():void
                {
                        scene.z += ((view.height + scene.children.length*100) - 
scene.z) /
25;

                        for each (var mesh:Mesh in scene.children) {
                                mesh.rotationX++;
                                mesh.rotationY++;
                                mesh.rotationZ++;
                        }
                }

                /**
                 * Listener function for mouse up event
                 */
                private function onMouseUp2(event:MouseEvent = null):void
                {
                        var sphere:Sphere = new Sphere();
                        sphere.radius = 100;
                        sphere.segmentsH = 20;
                        sphere.segmentsW = 20;
                        sphere.material = new 
BitmapFileMaterial("data/material.jpg");
                        sphere.sortFaces = false;

                        scene.addChild(sphere);

                        var numChildren:int = scene.children.length;

                        var i:int = 0;
                        for each (var mesh:Mesh in scene.children) {
                                mesh.material.debug = false;
                                mesh.x = 
numChildren*50*Math.sin(2*Math.PI*i/numChildren);
                                mesh.y = 
numChildren*50*Math.cos(2*Math.PI*i/numChildren);
                                i++;
                                mesh.sortFaces = true;
                        }
                }

                /**
                 * Listener function for mouse down event
                 */

                private function onMouseDown2(event:MouseEvent = null):void
                {
                        for each (var mesh:Mesh in scene.children) {
                                mesh.material.debug = true;
                        }
                }

                private function loadModel():void
                {
                        m_modelMaterial = new 
BitmapFileMaterial("data/material.jpg");

                        var loader:Loader3D = new Loader3D();
                        var md2:MD2 = new MD2();
                        md2.scaling = 8;
                        md2.material = m_modelMaterial

                        loader.loadGeometry("data/model.md2", md2);
                        loader.addEventListener(Loader3DEvent.LOAD_SUCCESS, 
onModelLoaded);
                        //scene.addChild(loader);
                }

                private function onModelLoaded(event:Loader3DEvent):void
                {
                        var mesh:Mesh = event.loader.handle as Mesh;
                        mesh.sortFaces = true;
                        scene.addChild(mesh);
                        trace("Model Loaded");
                }
        }
}

On Jan 4, 10:59 pm, galaxy <[email protected]> wrote:
> Hi,
>
> This forum is great. Keep up the great work!
>
> I have run into an issue while using an OrthogonalLens in a scene
> rendering an md2 model. I started with the Sphere test demo and
> altered it to load the md2 instead of the sphere. When the camera is
> left with the default zoom lens and either template class is used, it
> renders correctly.
>
> As soon as I add an OrthogonalLens to the camera, it appears that the
> triangles are not properly according to depth. This is especially
> noticeable as the model rotates about. I did try a collada file and it
> appears to render correctly with either camera, if that's any clue.
> Any ideas would be greatly appreciated as I would rather continue
> using the md2 files.
>
> Thanks!
> galaxy

Reply via email to