*FIXED!!*
Here's a really simple example, all it does is texture a sphere and rotate it depending on what the camera is doing:
Click Here (1.3Mb download so I didn't embed this one)
Source Code (Uses the Base Class):
-
/**
-
* ...
-
* @author Luke Mitchell
-
* @version 1
-
*/
-
-
packageВ {
-
\timport org.papervision3d.materials.BitmapFileMaterial;
-
\timport flash.events.MouseEvent;
-
\timport org.papervision3d.materials.ColorMaterial;
-
\timport org.papervision3d.materials.utils.MaterialsList;
-
\timport org.papervision3d.objects.primitives.Cube;
-
\t
-
\tpublic class Main extends PaperBase {
-
\t\t
-
\t\tpublic var materials:MaterialsList = new MaterialsList(
-
\t\t{
-
\t\t\tfront: new BitmapFileMaterial("http://papervision2.com/wp-content/pano/s1.gif"),
-
\t\t\tback: new BitmapFileMaterial("http://papervision2.com/wp-content/pano/s3.gif"),
-
\t\t\tleft: new BitmapFileMaterial("http://papervision2.com/wp-content/pano/s4.gif"),
-
\t\t\tright: new BitmapFileMaterial("http://papervision2.com/wp-content/pano/s2.gif"),
-
\t\t\ttop: new ColorMaterial(0x000000),
-
\t\t\tbottom: new ColorMaterial(0x000000)
-
\t\t});
-
\t\tpublic var cubemap:Cube = new Cube(materials, 2000, 2000, 900, 5, 5, 5,Cube.ALL);
-
\t\t
-
\t\tpublic function Main() {
-
\t\t\tinit(600,300);
-
\t\t\tcubemap.x = 0;
-
\t\t\tcubemap.y = 0;
-
\t\t\tcubemap.z = 0;
-
\t\t\t
-
\t\t\tdefault_scene.addChild(cubemap);
-
\t\t\tdefault_camera.z = 0;
-
\t\t\tdefault_camera.x = 0;
-
\t\t\tdefault_camera.y = 0;
-
\t\t\tdefault_camera.lookAt(cubemap);
-
\t\t\t
-
\t\t\tdefault_camera.zoom = 5;
-
\t\t\tstage.addEventListener(MouseEvent.MOUSE_WHEEL, mWheel);
-
\t\t}
-
\t\t
-
\t\tpublic function mWheel(e:MouseEvent):void {
-
\t\t\tdefault_camera.zoom += e.delta / 5;
-
\t\t\tif (default_camera.zoom <5) {
-
\t\t\t\tdefault_camera.zoom = 5;
-
\t\t\t}else if (default_camera.zoom> 20) {
-
\t\t\t\tdefault_camera.zoom = 20;
-
\t\t\t}
-
\t\t}
-
\t\t
-
\t\toverride protected function processFrame():void {
-
\t\t\tcubemap.yaw( -((stage.mouseX - (stage.width / 2)) / stage.width)*4);
-
\t\t\tdefault_camera.rotationX = -((stage.mouseY - (stage.height / 2)) / stage.height) * (Math.sqrt(default_camera.zoom*6));
-
\t\t}
-
\t}
-
}
You can use this for pretty much any panoramic image, just change the image url and tweak it a bit :)
-Luke

