StatsView
StatsView is a display of the following statistics:
frames per second,
triangles, shaded triangles, lines, particles,
render, render time, projection time,
culled objects, culled triangles, culled particles, filtered objects,
memory,
and polygon count.
Example
Instructions
- Import
import org.papervision3d.view.stats.StatsView;
- Declare
private var stats :StatsView;
- Initialize
stats = new StatsView(renderEngine);
Parameter Default Description renderEngine NONE renders data - Add
addChild(stats);
- Update polygon count
stats.updatePolyCount(scene);
Code
package { import flash.display.Sprite; import flash.events.Event; import org.papervision3d.cameras.Camera3D; import org.papervision3d.materials.ColorMaterial; import org.papervision3d.materials.WireframeMaterial; import org.papervision3d.materials.special.CompositeMaterial; import org.papervision3d.objects.primitives.Plane; import org.papervision3d.render.BasicRenderEngine; import org.papervision3d.scenes.Scene3D; import org.papervision3d.view.Viewport3D; import org.papervision3d.view.stats.StatsView; public class Papervision3DStatsView extends Sprite { private var scene :Scene3D; private var camera :Camera3D; private var viewport :Viewport3D; private var renderer :BasicRenderEngine; private var stats :StatsView; private var material :CompositeMaterial; private var object :Plane; public function Papervision3DStatsView() { scene = new Scene3D(); camera = new Camera3D(); viewport = new Viewport3D(); viewport.autoScaleToStage = true; addChild(viewport); renderer = new BasicRenderEngine(); stats = new StatsView(renderer); addChild(stats); material = new CompositeMaterial(); material.doubleSided = true; material.addMaterial(new ColorMaterial(0x000000, 0.5)); material.addMaterial(new WireframeMaterial(0x000000)); object = new Plane(material); scene.addChild(object); addEventListener(Event.ENTER_FRAME, handleEnterFrame); } private function handleEnterFrame(e:Event):void { object.yaw(1); stats.updatePolyCount(scene); renderer.renderScene(scene, camera, viewport); } } }