GouraudMaterial
GouraudMaterial is a texture.
Example
Instructions
- Import
import org.papervision3d.materials.shadematerials.GouraudMaterial;
- Declare
private var material :GouraudMaterial;
- Initialize
material = new GouraudMaterial(light, lightColor, ambientColor, specularLevel);
Parameter Default Description light NONE light position lightColor 0xffffff light color ambientColor 0x000000 object color specularLevel 0 color distribution from 0 to 255
Code
package { import flash.display.Sprite; import flash.events.Event; import org.papervision3d.cameras.Camera3D; import org.papervision3d.lights.PointLight3D; import org.papervision3d.materials.shadematerials.GouraudMaterial; import org.papervision3d.objects.primitives.Cone; import org.papervision3d.render.BasicRenderEngine; import org.papervision3d.scenes.Scene3D; import org.papervision3d.view.Viewport3D; public class Papervision3DGouraudMaterial extends Sprite { private var scene :Scene3D; private var camera :Camera3D; private var viewport :Viewport3D; private var renderer :BasicRenderEngine; private var light :PointLight3D; private var material :GouraudMaterial; private var object :Cone; public function Papervision3DGouraudMaterial() { scene = new Scene3D(); camera = new Camera3D(); viewport = new Viewport3D(); viewport.autoScaleToStage = true; addChild(viewport); renderer = new BasicRenderEngine(); light = new PointLight3D(); material = new GouraudMaterial(light, 0xffffff, 0x000000, 0); object = new Cone(material, 400, 400); scene.addChild(object); addEventListener(Event.ENTER_FRAME, handleEnterFrame); } private function handleEnterFrame(e:Event):void { object.pitch(1); renderer.renderScene(scene, camera, viewport); } } }