Pages

Using the BasicView class in Papervision3D 2.0 (AS3.3 and MXML)

Papervision3D is an amazing 3D engine but setting up the classes to create a Papervision application can be a real pain in the whotsits. Well, Andy Zupko has once again come to the rescue with a new addition to the PV3D API, the BasicView class. In a nutshell, the BAsicView class creates all the scafolding required to create a well.. basic PV3D scene. It has its own Scene3D, ViewPorts the lot. With the BasicView class all you need to set up a PV3D scene is:

AS 3.0 version:
_bview = new BasicView( stage.width, stage.height, true, false, 'CAMERA3D' );
addChild(_bview);

Add your loop event listener for the Event.ENTER_FRAME and off you go.

function loop(e:Event):void
{
_bview.singleRender();
}

There is a slight difference when deploying this in Flex. The FlexSDK will grumble and throw-up errors if you try to add the BasicView to its display stack. Use it in Flex in the following manner within your mx:Script tags

Flex version:
_bview = new BasicView( stage.width, stage.height, true, false, 'CAMERA3D' );
rawChildren.addChild(_bview);

The rawChildren property allows you add non-native Flex displayObjects to the Flex display stack.
Thats it.

aYo Binitie II

No comments:

Instagram