/* * PAPER ON ERVIS NPAPER ISION PE IS ON PERVI IO APER SI PA * AP VI ONPA RV IO PA SI PA ER SI NP PE ON AP VI ION AP * PERVI ON PE VISIO APER IONPA RV IO PA RVIS NP PE IS ONPAPE * ER NPAPER IS PE ON PE ISIO AP IO PA ER SI NP PER * RV PA RV SI ERVISI NP ER IO PE VISIO AP VISI PA RV3D * ______________________________________________________________________ * papervision3d.org + blog.papervision3d.org + osflash.org/papervision3d *Papervision3D Beta 1.9 - PHUNKY (20.09.07) /*Knoxvillage.com is a Knoxville, TN based Community website with interactive panoramic 3D environment using Adobe Flash CS3 Actionscript 3 and Papervision 3D Open source engine running Papervision3D Beta 1.9 - PHUNKY (20.09.07) class list. This 800 x 600 framed 360 Degree View of Downtown Knoxville features full screen mode switching with future upgrades to include interactive hot spots with click able links. The process began when 32 pictures were taken out of each of the main windows on the public observation level in the Sunsphere on Sunday July 15, 2007 at 4:00 pm. While I typically use a Canon DSLR with a 10-22mm lens, the camera I had available was a Canon SD850 IS which worked quite well. Using the 5.8mm focal length and an aperture value of F/2.8 I was able to maintain focus on the foreground and immediate architecture. While shooting through the bronze colored tinted glass, Knoxville's beautiful mountain views were heavily blurred and the shots turned out very green. This problem was overcome in post when the imaging was corrected in Photoshop CS3 following the photo's merge. After merging and much color correction, brightening and balancing; the photos where then stitched on 5 of the 6 sides of a 1000 x 1000 x 1000 pixel cube with blended corners a top a Sunsphere graphic base with a #f5fcff color sky. The images where then imported into Flash CS3 and wrapped with the Papervision3D Beta 1.9 - PHUNKY (20.09.07) actionscript 3 class list assigned on the document class: main.as. A full screen option was added with attention paid to the camera's focus, zoom and placement on the X, Y and Z axes. This is the actionscript document that accompanies the sunsphere.swf +Marshall Reeves http://marshallreeves.com/portfolio/knoxvillage.php */ // _______________________________________________________________________ Cube package { import flash.display.MovieClip; import flash.display.Sprite; import flash.display.StageQuality; import flash.display.StageScaleMode; import flash.events.Event; import flash.events.KeyboardEvent; import flash.ui.KeyLocation; import flash.ui.Keyboard; import flash.display.*; import flash.events.*; // Import Papervision3D import org.papervision3d.scenes.Scene3D; import org.papervision3d.cameras.FreeCamera3D; import org.papervision3d.objects.Cube; import org.papervision3d.materials.MaterialsList; import org.papervision3d.materials.BitmapAssetMaterial; import org.papervision3d.materials.ColorMaterial; public class main extends MovieClip { // ___________________________________________________________________ Static static public var SCREEN_WIDTH :int = 800; static public var SCREEN_HEIGHT :int = 500; // ___________________________________________________________________ 3D vars private var container :Sprite; private var scene :Scene3D; private var camera :FreeCamera3D; private var cube :Cube; private var doForward:Boolean = false; private var doBackward:Boolean = false; private var doLeft:Boolean = false; private var doRight:Boolean = false; // ___________________________________________________________________ main public function main() { iFull.visible = stage.hasOwnProperty("displayState"); iFull.addEventListener( MouseEvent.CLICK, goFull ); init3D(); addChild( iFull ); createCube(); stage.quality = StageQuality.LOW; this.addEventListener( Event.ENTER_FRAME, loop ); //Listen to the keyboard events stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp); } // ___________________________________________________________________ Init3D private function init3D():void { // Create container sprite and center it in the stage container = new Sprite(); addChild( container ); container.x = SCREEN_WIDTH /2; container.y = SCREEN_HEIGHT /2; // Create scene scene = new Scene3D( container ); // Create camera camera = new FreeCamera3D(); camera.zoom = 1; camera.focus = 300; //camera.x = 900; //camera.z = 0; //camera.y = 1000; } // ___________________________________________________________________ Create Cube private function createCube() { // Attributes //var size :Number = 5000; var quality :Number = 24; // Materials var b = new BitmapAssetMaterial( "back" ); var f = new BitmapAssetMaterial( "front" ); var r = new BitmapAssetMaterial( "right" ); var l = new BitmapAssetMaterial( "left" ); //var t = new BitmapAssetMaterial( "top" ); var t:ColorMaterial = new ColorMaterial(0xf5fcff, 1, false); var d = new BitmapAssetMaterial( "down" ); b.smooth = true; f.smooth = true; r.smooth = true; l.smooth = true; t.smooth = true; d.smooth = true; b.oneSide = true; f.oneSide = true; r.oneSide = true; l.oneSide = true; t.oneSide = true; d.oneSide = true; var materials:MaterialsList = new MaterialsList( { //all: front: f, back: b, right: r, left: l, top: t, bottom: d } ); // Cube face settings // You can add or sustract faces to your selection. For examples: Cube.FRONT+Cube.BACK or Cube.ALL-Cube.Top. // On single sided materials, all faces will be visible from the inside. var insideFaces :int = Cube.ALL; // Front and back cube faces will not be created. var excludeFaces :int = Cube.NONE; // Create the cube. cube = new Cube( materials, 5000, 5000, 5000, quality, quality, quality, insideFaces, excludeFaces ); scene.addChild( cube, "Cube" ); } // ___________________________________________________________________ Loop private function loop(event:Event):void { update3D(); } private function update3D():void { //keyboard if(doForward){ camera.moveForward(30); } if(doBackward){ camera.moveBackward(30); } if(doLeft){ //camera.moveDown(10); } if(doRight){ //camera.moveUp(10); } // Pan var pan:Number = camera.rotationY - 210 * container.mouseX/(stage.stageWidth/2); pan = Math.max( -100, Math.min( pan, 100 ) ); // Max speed camera.rotationY -= pan / 12; // Tilt var tilt:Number = 90 * container.mouseY/(stage.stageHeight/2); camera.rotationX -= (camera.rotationX + tilt) / 12; // Render scene.renderCamera( this.camera ); } /** * onKeyDown * * Handles the key events from the stage */ private function onKeyDown(event:KeyboardEvent):void { switch(event.keyCode){ case Keyboard.UP: doForward = true; break; case Keyboard.DOWN: doBackward = true; break; case Keyboard.LEFT: doLeft = true; break; case Keyboard.RIGHT: doRight = true; break; } } /** * onKeyUp * * Handles the key events from the stage */ private function onKeyUp(event:KeyboardEvent):void { switch(event.keyCode){ case Keyboard.UP: doForward = false; break; case Keyboard.DOWN: doBackward = false; break; case Keyboard.LEFT: doLeft = false; break; case Keyboard.RIGHT: doRight = false; break; } } // ___________________________________________________________________ FullScreen private function goFull(event:MouseEvent):void { if( stage.hasOwnProperty("displayState") ) { if( stage.displayState != StageDisplayState.FULL_SCREEN ) stage.displayState = StageDisplayState.FULL_SCREEN; else stage.displayState = StageDisplayState.NORMAL; } } } }