PointLight3D
PointLight3D is a light.
Example
Instructions
- Import
import org.papervision3d.lights.PointLight3D;
- Declare
private var light :PointLight3D;
- Initialize
light = new PointLight3D(showLight, flipped)
Parameter Default Description showLight false visibility flipped false flip light direction - Add
scene.addChild(light);
Code
package { import flash.display.Sprite; import flash.events.Event; import flash.ui.Mouse; import org.papervision3d.cameras.Camera3D; import org.papervision3d.core.utils.Mouse3D; import org.papervision3d.lights.PointLight3D; import org.papervision3d.materials.shadematerials.PhongMaterial; import org.papervision3d.objects.primitives.Cone; import org.papervision3d.render.BasicRenderEngine; import org.papervision3d.scenes.Scene3D; import org.papervision3d.view.Viewport3D; public class Papervision3DPointLight3D extends Sprite { private var scene :Scene3D; private var camera :Camera3D; private var viewport :Viewport3D; private var renderer :BasicRenderEngine; private var mouse :Mouse3D; private var light :PointLight3D; private var material :PhongMaterial; private var object :Cone; public function Papervision3DPointLight3D() { scene = new Scene3D(); camera = new Camera3D(); viewport = new Viewport3D(); viewport.autoScaleToStage = true; viewport.interactive = true; addChild(viewport); renderer = new BasicRenderEngine(); Mouse3D.enabled = true; mouse = viewport.interactiveSceneManager.mouse3D; light = new PointLight3D(); scene.addChild(light); material = new PhongMaterial(light, 0xffffff, 0x000000, 100); material.interactive = true; object = new Cone(material, 400, 400); scene.addChild(object); addEventListener(Event.ENTER_FRAME, handleEnterFrame); } private function handleEnterFrame(e:Event):void { light.copyTransform(mouse); object.pitch(1); renderer.renderScene(scene, camera, viewport); } } }