The heart of the engine. The renderer takes a list of meshes, transforms the geometry into screen coordinates and draws the triangles (faces) on the screen.
There are several options you can set:
wireFrameMode: Switches the renderer to wireframe mode, only the outlines of faces are drawn
dynamicLighting: Turns on/off dynamic lighting
ambientColor: Defines the ambient light color. The dynamic lighting color is mixed against this color.
ambientColorCorrection: Use if your scene is too bright / dark when using dynamic lighting (0-1).
additiveMode: Turns on/off additive blending of materials. All materials that have additiveblending enabled are drawn additive
blurMode: Turns on/off distanceblur. Meshes are blurred in relation of distance to the camera
distanceBlur: Sets the amount of blurring
facesRendered: Render statistics, calculated every frame
facesTotal: Render statistics, calculated every frame
meshesTotal: Render statistics, calculated every frame
verticesProcessed: Render statistics, calculated every frame
Interactive objects:
You can set a Object3D or a Material to interactive. When the user hovers over the object or clicks it, a Mouse3DEvent is dispatched, containing information about the clicked object.
Available events are: Mouse3DEvent.MOUSE_OVER, Mouse3DEvent.MOUSE_OUT, Mouse3DEvent.MOUSE_CLICK
public var additiveMode:Boolean = false
public var ambientColor:uint = 0x000000
public var ambientColorCorrection:Number = 0.0
public var blurMode:Boolean = false
public var distanceBlur:Number = 20
public var drawStage:Sprite
public var dynamicLighting:Boolean = false
public var facesRendered:int = 0
public var facesTotal:int = 0
public var interactiveStage:Sprite
public var meshesTotal:int = 0
public var stage:Sprite
public var verticesProcessed:int = 0
public var wireFrameMode:Boolean = false
public function Renderer(stage:Sprite)
Constructor of class Renderer
Parameters
| stage:Sprite — geometry is renderes to the graphichs object of this sprite
|
public function drawToScreen(faceList:Array, cam:PointCamera):void
Takes a list of faces and draws them on the screen
(Should not be used directly, but at least you could, if you calculated your faces in an other way...)
Parameters
| faceList:Array — list of faces
|
| |
| cam:PointCamera — camera instance
|
public function project(meshList:Array, cam:PointCamera, dontZSort:Boolean = false):Array
Calculates translations, rotations for every vertex in a mesh, does depth sorting of faces and finally calculates the screencoordinates.
(Use this method only if you want to implement your own renderer and just need the transforms!)
Parameters
| meshList:Array — list of meshes
|
| |
| cam:PointCamera — camera instance
|
| |
| dontZSort:Boolean (default = false) |
Returns
| Array — a depth sorted list of transformed faces
|
public function render(meshList:Array, cam:PointCamera):void
Processes a list of meshes, and draws them on the screen
Parameters
| meshList:Array — list of meshes
|
| |
| cam:PointCamera — camera instance
|