Hey All,

I was playing around with Away3D 4 and loading external objects (in
this case a simple cube with a texture), however, no matter what I try
it won't seem to render without the edges coming out pixelated. I've
gone through most of the properties of the view, defaultRenderer,
materials, mash and the attributes and params of the object and still
can't seem to solve it.  It's a bit odd because the prior project's
I've created used embeded objects and textures and this problem never
came up.   I feel like I've tried almost everything possible so here I
am. Here's the Actionscript file.   Any help from the community would
be great!

-------- AS FILE ------

package
{
        import away3d.containers.ObjectContainer3D;
        import away3d.containers.View3D;
        import away3d.entities.Mesh;
        import away3d.events.ResourceEvent;
        import away3d.lights.PointLight;
        import away3d.loading.IResource;
        import away3d.loading.ResourceManager;
        import away3d.loading.parsers.OBJParser;
        import away3d.materials.BitmapMaterial;

        import flash.display.Bitmap;
        import flash.display.BitmapData;
        import flash.display.Loader;
        import flash.display.Sprite;
        import flash.events.Event;
        import flash.events.MouseEvent;
        import flash.net.URLRequest;

        public class Main extends Sprite
        {

                private var view:View3D = new View3D()
                private var container:ObjectContainer3D = new 
ObjectContainer3D();
                private var light:PointLight = new PointLight();
                private var light2:PointLight = new PointLight();
                private var loader:Loader = new Loader();
                private var resource:ResourceEvent;

                public function Main()
                {

                        view.antiAlias = 2;

                        ResourceManager.instance.getResource('assets/cube.obj', 
true,
OBJParser);
        
ResourceManager.instance.addEventListener(ResourceEvent.RESOURCE_RETRIEVED,
onRetrieve);

                        addEventListener(Event.ENTER_FRAME, view.render);
                        stage.addEventListener(MouseEvent.MOUSE_MOVE, onMove);

                        light.color = 0xFFFFFF;
                        light2.color = 0xFFFFFF;

                        light.moveLeft(200);
                        light.moveBackward(400);
                        light.moveUp(100);
                        light2.moveRight(200);
                        light2.moveUp(100);
                        light2.moveBackward(400);

                        view.scene.addChild(light);
                        view.scene.addChild(light2);
                        view.scene.addChild(container);

                        addChild(view);
                        view.render();

                }

                private function onRetrieve(e:ResourceEvent):void
                {
                        loader.load(new URLRequest('assets/clouds.jpg'));
                        
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
onComplete);
                        container.addChild(ObjectContainer3D(e.resource));

                }

                private function onMove(e:MouseEvent):void
                {

                        container.rotationY += e.stageX;
                        container.rotationX += e.stageX;

                }

                private function onComplete(e:Event):void
                {
                        var bitmap:Bitmap = loader.content as Bitmap;
                        var bmpData:BitmapData = bitmap.bitmapData;
                        var mat:BitmapMaterial = new BitmapMaterial(bmpData);
                        mat.smooth = true;
                        mat.lights = [light, light2];
                        var mesh:Mesh = 
Mesh(container.getChildAt(0).getChildAt(0));
                        mesh.scale(2);
                        mesh.material = mat;


                }

        }
}

Reply via email to