topical media & game development

talk show tell print

student-ar-org-papervision3d-core-material-AbstractLightShadeMaterial.ax

student-ar-org-papervision3d-core-material-AbstractLightShadeMaterial.ax [swf] [flash] flex


  package org.papervision3d.core.material
  {
          import flash.utils.Dictionary;
          
          import org.papervision3d.core.material.TriangleMaterial;
          import org.papervision3d.core.math.Matrix3D;
          import org.papervision3d.core.proto.LightObject3D;
          import org.papervision3d.core.render.data.RenderSessionData;
          import org.papervision3d.core.render.draw.ITriangleDrawer;
          import org.papervision3d.core.render.material.IUpdateBeforeMaterial;
          import org.papervision3d.materials.utils.LightMatrix;
          import org.papervision3d.objects.DisplayObject3D;
  
          public class @ax-student-ar-org-papervision3d-core-material-AbstractLightShadeMaterial extends TriangleMaterial implements ITriangleDrawer, IUpdateBeforeMaterial
          {
          
                  public var lightMatrices:Dictionary;
                  private var _light:LightObject3D;
                  protected static var lightMatrix:Matrix3D;
                  
                  public function @ax-student-ar-org-papervision3d-core-material-AbstractLightShadeMaterial()
                  {
                          super();
                          init();
                  }
                  
                  protected function init():void
                  {
                          lightMatrices = new Dictionary();
                  }
                  
                  public function updateBeforeRender(renderSessionData:RenderSessionData):void
                  {        
                          var object:DisplayObject3D;
                          for each(object in objects){
                                  lightMatrices[object] = LightMatrix.getLightMatrix(light, object,renderSessionData,lightMatrices[object]);
                          }
                  }
                  
                  public function set light(light:LightObject3D):void
                  {
                          _light = light;
                  }
                  
                  public function get light():LightObject3D
                  {
                          return _light;        
                  }
                  
          }
  }


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.