« Return to Thread: ESPYS.tv done with PV3D

Re: Simple Cube w/Texture

by Maggical :: Rate this Message:

Reply to Author | View in Thread

Try this out instead, it seems that you are using a cube and aren't loading the material list correctly.

            wireframeMaterial = new WireframeMaterial(0x333333);
            wireframeMaterial.doubleSided = true;
            ///
            //BitmapFileMaterial, doubleSided draws the color on both sides of the geometry normals
            bitmapFileMaterial = new BitmapFileMaterial("AJ.png");
            bitmapFileMaterial.doubleSided = true;
            ///
            var materialsList:MaterialsList = new MaterialsList();
            materialsList.addMaterial(wireframeMaterial, "front");
            materialsList.addMaterial(wireframeMaterial, "back");
            materialsList.addMaterial(bitmapFileMaterial, "left");
            materialsList.addMaterial(wireframeMaterial, "right");
            materialsList.addMaterial(wireframeMaterial, "top");
            materialsList.addMaterial(wireframeMaterial, "bottom");
            ///
            //cube = new Cube(MaterialList applied to object, width, depth, height, wSegments, dSegments, hSegments);
            cube = new Cube(materialsList, 200, 200, 200, 3, 3, 3);
            scene.addChild(cube);


That's a quick example that loads a bitmap on a side of the cube, and renders a wireframe material on the other sides...

Hope it helps =)

Javier

On Tue, Jun 30, 2009 at 4:48 PM, Merrill, Jason <jason.merrill@...> wrote:

Hey all,

 

I’m new developing with Papervision3d (though not new to Flash/Flex/Actionscript) and have a really basic problem. I was able to display my first code-generated plane and rotate it, and also load a model collada file built with Swift3d.  Now I am trying to create a box with texture, but having problems.  Here is the relevant part of my code:

 

(CubeTexture is a bitmap in Flash CS3 with linkage exported as class: CubeTexture and base class: flash.display.BitmapData)

 

var bitmap:Bitmap = new Bitmap(new CubeTexture(0,0));

material = new MaterialObject3D();

material.bitmap = bitmap.bitmapData;

 

materials = new MaterialsList();

materials.addMaterial(material);

 

primitive = new Cube(materials, 200, 200, 200);

scene.addChild(primitive);

 

I get this error:

 

“WARNING: Required material not found in given materials list. Supported materials are: front, back, right, left, top, bottom & all.”

 

Any ideas what I’m doing wrong?  Thanks.

 

 

Jason Merrill

Bank of  America smallLogo  Global Learning

Shared Services Solutions Development


Monthly meetings on the Adobe Flash platform for rich media experiences - join the Bank of America Flash Platform Community

 


_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org



_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

 « Return to Thread: ESPYS.tv done with PV3D