pv3d: panoramic view
[ 2009-08-26 18:16:21 | Author: liuhuan ]
package {
import flash.display.*;
import flash.events.*;
import flash.filters.*;
import org.papervision3d.materials.*;
import org.papervision3d.objects.*;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.view.BasicView;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.math.*;
import org.papervision3d.objects.DisplayObject3D;
import gs.TweenMax;
import gs.easing.*;
public class Main extends BasicView {
private var dpObj3D:DisplayObject3D;
private var bmpSkyMaterial:BitmapMaterial;
private var cameraTarget:DisplayObject3D=DisplayObject3D.ZERO;
private var cameraPitch:Number=0;
private var cameraYaw:Number=0;
private var curcp:Number=0;
private var curcy:Number=0;
public function Main():void {
stage.quality=StageQuality.LOW;
init();
}
private function init():void {
dpObj3D=new DisplayObject3D ;
var bmpSky:Bitmap=new Bitmap(new Sky(2000,1583));
bmpSkyMaterial=new BitmapMaterial(bmpSky.bitmapData,false);
var sphere=new Sphere(bmpSkyMaterial,1600,40,40);
sphere.scaleX=-1;
dpObj3D.addChild(sphere);
dpObj3D.y=-150;
scene.addChild(dpObj3D);
camera.zoom=50;
camera.focus=20;
startRendering();
}
protected override function onRenderTick(event:Event=null):void {
cameraPitch = 90+(mouseY - stage.stageHeight/2)/stage.stageHeight*2*90*-1;
cameraYaw = (mouseX - stage.stageWidth/2)/stage.stageWidth*720*-1;
curcp+= (cameraPitch - curcp) / 5;
curcy+= (cameraYaw - curcy) / 5;
camera.orbit(curcp,curcy,true,cameraTarget);
super.onRenderTick(event);
}
}
}
import flash.display.*;
import flash.events.*;
import flash.filters.*;
import org.papervision3d.materials.*;
import org.papervision3d.objects.*;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.view.BasicView;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.math.*;
import org.papervision3d.objects.DisplayObject3D;
import gs.TweenMax;
import gs.easing.*;
public class Main extends BasicView {
private var dpObj3D:DisplayObject3D;
private var bmpSkyMaterial:BitmapMaterial;
private var cameraTarget:DisplayObject3D=DisplayObject3D.ZERO;
private var cameraPitch:Number=0;
private var cameraYaw:Number=0;
private var curcp:Number=0;
private var curcy:Number=0;
public function Main():void {
stage.quality=StageQuality.LOW;
init();
}
private function init():void {
dpObj3D=new DisplayObject3D ;
var bmpSky:Bitmap=new Bitmap(new Sky(2000,1583));
bmpSkyMaterial=new BitmapMaterial(bmpSky.bitmapData,false);
var sphere=new Sphere(bmpSkyMaterial,1600,40,40);
sphere.scaleX=-1;
dpObj3D.addChild(sphere);
dpObj3D.y=-150;
scene.addChild(dpObj3D);
camera.zoom=50;
camera.focus=20;
startRendering();
}
protected override function onRenderTick(event:Event=null):void {
cameraPitch = 90+(mouseY - stage.stageHeight/2)/stage.stageHeight*2*90*-1;
cameraYaw = (mouseX - stage.stageWidth/2)/stage.stageWidth*720*-1;
curcp+= (cameraPitch - curcp) / 5;
curcy+= (cameraYaw - curcy) / 5;
camera.orbit(curcp,curcy,true,cameraTarget);
super.onRenderTick(event);
}
}
}
[Last Modified By liuhuan, at 2009-08-26 17:45:05]
Comments Feed: http://www.liuhuan.com/blog/feed.asp?q=comment&id=1020
There is no comment on this article.
You can't post comment on this article.