/ Published in: ActionScript 3
Basic 3D View Class, puts a light & sphere on the stage.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package com { import org.papervision3d.lights.PointLight3D; import org.papervision3d.view.BasicView; import org.papervision3d.objects.primitives.Sphere; import org.papervision3d.materials.shaders.PhongShader; import org.papervision3d.materials.shadematerials.PhongMaterial; import org.papervision3d.core.proto.MaterialObject3D; public class View3D extends BasicView { private var light:PointLight3D; private var phongMaterial:MaterialObject3D; public function View3D() { super(); createSomeObjectsOnTheScene(); this.startRendering(); } public function createSomeObjectsOnTheScene():void { phongMaterial = new PhongMaterial(light, 0x6654FF, 0x060433, 150); light = new PointLight3D(); light.x = 1000; light.y = 5000; light.z = -6000; scene.addChild(light); var tSphere:Sphere = new Sphere(phongMaterial, 50, 10, 10); scene.addChild(tSphere); } } }