ParticleMaterial
ParticleMaterial is a solid-color circle, or square, used as a texture.
Example
Instructions
- Import
import org.papervision3d.materials.special.ParticleMaterial;
- Declare
private var material :ParticleMaterial;
- Initialize
material = new ParticleMaterial(color, alpha, shape);
Parameter Default Description color NONE color alpha NONE alpha shape 0 0 | 1 0 - square 1 - circle
Code
package { import flash.display.Sprite; import flash.events.Event; import org.papervision3d.cameras.Camera3D; import org.papervision3d.materials.special.ParticleMaterial; import org.papervision3d.objects.special.ParticleField; import org.papervision3d.render.BasicRenderEngine; import org.papervision3d.scenes.Scene3D; import org.papervision3d.view.Viewport3D; public class Papervision3DParticleMaterial extends Sprite { private var scene :Scene3D; private var camera :Camera3D; private var viewport :Viewport3D; private var renderer :BasicRenderEngine; private var material :ParticleMaterial; private var object :ParticleField; public function Papervision3DParticleMaterial() { scene = new Scene3D(); camera = new Camera3D(); viewport = new Viewport3D(); viewport.autoScaleToStage = true; addChild(viewport); renderer = new BasicRenderEngine(); material = new ParticleMaterial(0x000000, 1); material.doubleSided = true; object = new ParticleField(material); scene.addChild(object); addEventListener(Event.ENTER_FRAME, handleEnterFrame); } private function handleEnterFrame(e:Event):void { object.yaw(1); renderer.renderScene(scene, camera, viewport); } } }