[Papervision3D] Rendering a Sphere
Trevor Burton
worldofpaper at googlemail.com
Wed Nov 7 01:44:49 PST 2007
your camera and sphere are in the same place... move the camera back a
bit.... looks like the sphee is there, just isn't being seen by the
camera
On Nov 7, 2007 7:52 AM, Michael Ewald <m.flash at mac.com> wrote:
> Dear List,
> I'm trying to render a sphere with PV3D, but it wont render. There are no exported errors and my radius seems to be correct. End goal is to create a simple panorama. The below code is just the relevant functions and lines, if you want the full thing I can post it.
>
>
> // -----------------------PANORAMA PROPERTIES-------------------------
> // imgWidth is the width of the mapped image. height is 1/2 the width
>
> var imgWidth:int = 800;
> var panoR:int = ((imgWidth/Math.PI)*0.5);
> var panoQual:int = 8;
>
> // ___________________________________________________________________ 3D vars
>
> private var container :Sprite;
> private var scene :Scene3D;
> private var camera :Camera3D;
>
> // _______________________________________ ____________________________ main
>
> // This is run when the application starts
> public function pano_sphere()
> {
> init3D();
> createSpere();
> }
>
> // ___________________________________________________________________ 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 Camera3D();
> camera.zoom = 2;
> camera.focus = panoR;
> camera.x = 0;
> camera.y = 0;
> camera.z = 0;
>
> }
>
>
> private function createSpere()
> {
> //var sphereMaterial:BitmapFileMaterial = new BitmapFileMaterial("images/pano_sphere.jpg");
> var sphereMaterial2:BitmapAssetMaterial = new BitmapAssetMaterial("panoImg");
>
> trace("R: " + String(panoR));
> // Returns 127, which is correct
>
> var panoSphere:DisplayObject3D = new Sphere(sphereMaterial2, panoR, panoQual, panoQual);
> panoSphere.x = 0;
> panoSphere.y = 0;
> panoSphere.z = 0;
> scene.addChild(panoSphere, "Sphere");
>
> }
>
> // Render
> scene.renderCamera( camera );
>
>
> Thanks for the help with my previous question.
>
> Thanks,
> Michael Ewald
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
--
Trevor Burton
http://www.paperworld3d.com
More information about the Papervision3D
mailing list