Even if you had a chance to look at Getting started using BasicView.as this tutorial provides another example of basic texturing in Papervision.
In Papervision for the most part you have objects (planes, cubes, cones, 3D Models, etc) and then you have the textures or materials that you add to these objects. Think of it as getting a brand new iPhone and then buying a case or skin for that iPhone. We are essentially doing the same thing in principle - we have our object a cone (iPhone) and a material a bitmapMaterial (iPhone skin).
-
package
-
{
-
import flash.events.Event;
-
import org.papervision3d.view.BasicView;
-
import org.papervision3d.objects.primitives.Cone;
-
import org.papervision3d.materials.BitmapFileMaterial;
-
-
public class Main extends BasicView
-
{
-
protected var cone:Cone
-
protected var bitmapMaterial:BitmapFileMaterial;
-
-
public function Main()
-
{
-
super();
-
createChildren();
-
startRendering();
-
}
-
public function createChildren():void
-
{
-
//Create a new 3D object
-
bitmapMaterial = new BitmapFileMaterial("images/ourtex.jpg")
-
cone = new Cone(bitmapMaterial, 20, 200);
-
-
//Set some properties
-
cone.scale = 4;
-
cone.pitch( -10);
-
-
//Add to scene
-
scene.addChild(cone);
-
}
-
-
override protected function onRenderTick(event:Event = null):void
-
{
-
super.onRenderTick(event);
-
-
//Rotate
-
cone.yaw(3);
-
}
-
}
-
}
As you can see from the code above we have a cone and a bitmap texture.


