EnvMapMaterial
EnvMapMaterial is a texture.
Example
Instructions
- Import
import org.papervision3d.materials.shadematerials.EnvMapMaterial;
- Declare
private var material :EnvMapMaterial;
- Initialize
material = new EnvMapMaterial(light, lightMap, backEnvMap, ambientColor);
Parameter Default Description light NONE light position lightMap NONE bitmap backEnvMap null bitmap ambientColor 0 object color
Code
package { import flash.display.Bitmap; import flash.display.Sprite; import flash.events.Event; import org.papervision3d.cameras.Camera3D; import org.papervision3d.lights.PointLight3D; import org.papervision3d.materials.shadematerials.EnvMapMaterial; import org.papervision3d.objects.primitives.Plane; import org.papervision3d.render.BasicRenderEngine; import org.papervision3d.scenes.Scene3D; import org.papervision3d.view.Viewport3D; public class Papervision3DEnvMapMaterial extends Sprite { [Embed(source="HappyFace.jpg")] private var Asset :Class; private var scene :Scene3D; private var camera :Camera3D; private var viewport :Viewport3D; private var renderer :BasicRenderEngine; private var light :PointLight3D; private var material :EnvMapMaterial; private var object :Plane; public function Papervision3DEnvMapMaterial() { scene = new Scene3D(); camera = new Camera3D(); viewport = new Viewport3D(); viewport.autoScaleToStage = true; addChild(viewport); renderer = new BasicRenderEngine(); light = new PointLight3D(); var bitmap :Bitmap = new Asset(); material = new EnvMapMaterial(light, bitmap.bitmapData); material.doubleSided = true; object = new Plane(material); scene.addChild(object); addEventListener(Event.ENTER_FRAME, handleEnterFrame); } private function handleEnterFrame(e:Event):void { object.yaw(1); renderer.renderScene(scene, camera, viewport); } } }