Hi to all!

Around christmas, Santa on his trip from the south pole around the world, left us the public alpha release of the papervision 3d engine for flash. After being on it for days, i found that, with this release, some things were changed. Today i’m going to talk about the renderScene method of the viewport class.

In the old papervision way, for rendering a camera, you only had to use the renderCamera method of the camera object. This has been changed in a fashionable way.

First you have to define a viewport. Then add it as a child to the container you want, that can be a MovieClip, a Sprite or what else.

var viewport:Viewport3D = new Viewport3D(0, 0, true, false);
addChild(viewport);

Then create your rendering engine, that is the object that really do take care of rendering your scene. So from now on, on Great White, you’ll have to render using the Renderer, not the Scene.

var renderer:BasicRenderEngine = new BasicRenderEngine();

Next step is creating the scene, and the camera (you can create both types, camera and freecamera).

var scene:Scene3D = new Scene3D();
var camera:FreeCamera3D = new FreeCamera3D();

Then go on for the real rendering trigger action. It’s up to you deciding how much often you’ll have to render your scene.

renderer.renderScene(scene, camera, viewport);

If you are wondering, as me, the right syntax for the Viewport3D constructor, it is:

public function Viewport3D(viewportWidth:Number = 640, viewportHeight:Number = 480, autoScaleToStage:Boolean = false, interactive:Boolean = false, autoClipping:Boolean = true, autoCulling:Boolean = true);

so remember:

  1. Create the viewport and attach it to the container
  2. Define a renderer.
  3. Define your camera and your scene.
  4. When you wish, feed the BasicRenderEngine.renderScene method with scene, camera and viewport.

I’ll write some other articles on the release, i hope nobody will hate me for this ;)

Have a nice day!