Posted By

allnatural on 03/13/09


Tagged

papervision


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

davidino1978


Papervision3D View3D Class


 / Published in: ActionScript 3
 

Basic 3D View Class, puts a light & sphere on the stage.

  1. package com
  2. {
  3.  
  4. import org.papervision3d.lights.PointLight3D;
  5. import org.papervision3d.view.BasicView;
  6. import org.papervision3d.objects.primitives.Sphere;
  7. import org.papervision3d.materials.shaders.PhongShader;
  8. import org.papervision3d.materials.shadematerials.PhongMaterial;
  9. import org.papervision3d.core.proto.MaterialObject3D;
  10.  
  11. public class View3D extends BasicView
  12. {
  13. private var light:PointLight3D;
  14. private var phongMaterial:MaterialObject3D;
  15.  
  16. public function View3D()
  17. {
  18. super();
  19. createSomeObjectsOnTheScene();
  20. this.startRendering();
  21. }
  22.  
  23. public function createSomeObjectsOnTheScene():void
  24. {
  25.  
  26. phongMaterial = new PhongMaterial(light, 0x6654FF, 0x060433, 150);
  27.  
  28.  
  29. light = new PointLight3D();
  30. light.x = 1000;
  31. light.y = 5000;
  32. light.z = -6000;
  33. scene.addChild(light);
  34.  
  35. var tSphere:Sphere = new Sphere(phongMaterial, 50, 10, 10);
  36. scene.addChild(tSphere);
  37.  
  38. }
  39. }
  40. }

Report this snippet  

You need to login to post a comment.