topical media & game development

talk show tell print

student-ar-org-papervision3d-core-culling-ViewportObjectFilter.ax

student-ar-org-papervision3d-core-culling-ViewportObjectFilter.ax [swf] [flash] flex


  package org.papervision3d.core.culling
  {
          import flash.utils.Dictionary;
          
          import org.papervision3d.objects.DisplayObject3D;
  
          
@Author Ralph Hauwert

  
          public class @ax-student-ar-org-papervision3d-core-culling-ViewportObjectFilter implements IObjectCuller
          {
                  
                  protected var _mode:int;
                  protected var objects:Dictionary;
                  
                  public function @ax-student-ar-org-papervision3d-core-culling-ViewportObjectFilter(mode:int):void
                  {
                          this.mode = mode;
                          init();
                  }
                  
                  private function init():void
                  {
                          objects = new Dictionary(true);
                  }
                  
                  public function testObject(object:DisplayObject3D):int
                  {
                          if(objects[object]){
                                  if(_mode == @fileMode.INCLUSIVE){
                                          return 1;
                                  }else if(_mode == @fileMode.EXCLUSIVE){
                                          return 0;
                                  }
                          }else{
                                  if(_mode == @fileMode.INCLUSIVE){
                                          return 0;
                                  }else if(_mode == @fileMode.EXCLUSIVE){
                                          return 1;
                                  }
                          }
                          return 0;
                  }
                  
                  public function addObject(do3d:DisplayObject3D):void
                  {
                          objects[do3d] = do3d;
                  }
                  
                  public function removeObject(do3d:DisplayObject3D):void
                  {
                          delete objects[do3d];
                  }
                  
                  public function set mode(mode:int):void
                  {
                          _mode = mode;        
                  }
                  
                  public function get mode():int
                  {
                          return _mode;
                  }
                  
                  public function destroy():void
                  {
                          objects = null;
                  }
                  
          }
  }


(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.