« Return to Thread: ESPYS.tv done with PV3D
Thanks
Javier – that explains a lot more. However, I tried your code out, and
while I didn’t get any errors, I didn’t see any cube either (whereas
I did when I made an added a simple plane in the same file). The .jpg (my file
is city.jpg, and I changed that in your code) is in the same folder location as
the host HTML and .swf. I get this message:
“INFO:
BitmapFileMaterial: Loading bitmap from city.jpg”
Here
is all my code (a few things are irrelevant since I was messing around with
some other things):
package
{
import
flash.display.Bitmap;
import
flash.display.BitmapData;
import
flash.display.Sprite;
import
flash.events.Event;
import
flash.events.MouseEvent;
import
org.papervision3d.core.proto.MaterialObject3D;
import
org.papervision3d.materials.BitmapFileMaterial;
import
org.papervision3d.materials.BitmapMaterial;
import
org.papervision3d.materials.utils.MaterialsList;
import
org.papervision3d.materials.WireframeMaterial;
import
org.papervision3d.objects.primitives.Cube;
import
org.papervision3d.view.Viewport3D;
import
org.papervision3d.scenes.Scene3D;
import
org.papervision3d.cameras.Camera3D;
import
org.papervision3d.materials.ColorMaterial;
import
org.papervision3d.render.BasicRenderEngine;
public
class MyPV3DTest extends Sprite
{
private
var viewport: Viewport3D;
private
var scene: Scene3D;
private
var camera: Camera3D;
private
var material:MaterialObject3D;
private
var materials:MaterialsList;
private
var primitive:Cube
private
var renderer: BasicRenderEngine;
public
function MyPV3DTest ():void
{
//viewport
= new Viewport3D(w, h, scaleToStage, interactive);
viewport
= new Viewport3D(550, 400, false, true);
addChild(viewport);
//instantiates
a Scene3D instance
scene
= new Scene3D();
//instantiates
a Camera3D instance
camera
= new Camera3D();
//renderer
draws the scene to the stage
renderer
= new BasicRenderEngine();
var
wireframeMaterial:WireframeMaterial = new WireframeMaterial(0x333333);
wireframeMaterial.doubleSided = true;
var bitmapFileMaterial:BitmapFileMaterial = new
BitmapFileMaterial("city.jpg");
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");
var cube:Cube = new Cube(materialsList, 200, 200,
200, 3, 3, 3);
scene.addChild(cube);
}
}
}
Jason Merrill
Bank of America
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
From:
papervision3d-bounces@... [mailto:papervision3d-bounces@...] On Behalf Of Javier España |
javierespana.com
Sent: Tuesday, June 30, 2009 4:13
PM
To: papervision3d@...
Subject: Re: [Papervision3D]
Simple Cube w/Texture
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 Error! Filename not specified. 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
« Return to Thread: ESPYS.tv done with PV3D
| Free embeddable forum powered by Nabble | Forum Help |