home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Esportes / CrossingCup.swf / scripts / __Packages / sandy / primitive / Plane3D.as < prev    next >
Text File  |  2007-12-11  |  4KB  |  88 lines

  1. class sandy.primitive.Plane3D extends sandy.core.Object3D implements sandy.primitive.Primitive3D
  2. {
  3.    function Plane3D(h, lg, q, mode)
  4.    {
  5.       super();
  6.       this._h = undefined != h ? Number(h) : 6;
  7.       this._lg = undefined != lg ? Number(lg) : 6;
  8.       this._q = !(undefined == q || q <= 0 || q > 10) ? Number(q) : 1;
  9.       this._mode = !(undefined == mode || mode != "tri" && mode != "quad") ? mode : "tri";
  10.       this.generate();
  11.    }
  12.    function generate(Void)
  13.    {
  14.       var _loc13_ = this._h / 2;
  15.       var _loc9_ = this._lg / 2;
  16.       var _loc14_ = this._h / this._q;
  17.       var _loc10_ = this._lg / this._q;
  18.       var _loc5_ = undefined;
  19.       var _loc12_ = undefined;
  20.       var _loc8_ = undefined;
  21.       var _loc11_ = undefined;
  22.       var _loc7_ = undefined;
  23.       var _loc2_ = undefined;
  24.       var _loc4_ = - _loc13_;
  25.       var _loc15_ = false;
  26.       var _loc6_ = undefined;
  27.       do
  28.       {
  29.          var _loc3_ = - _loc9_;
  30.          do
  31.          {
  32.             _loc5_ = new sandy.core.data.Vertex(_loc3_,0,_loc4_);
  33.             _loc12_ = this.aPoints.push(_loc5_) - 1;
  34.             _loc5_ = new sandy.core.data.Vertex(_loc3_ + _loc10_,0,_loc4_);
  35.             _loc8_ = this.aPoints.push(_loc5_) - 1;
  36.             _loc5_ = new sandy.core.data.Vertex(_loc3_ + _loc10_,0,_loc4_ + _loc14_);
  37.             _loc11_ = this.aPoints.push(_loc5_) - 1;
  38.             _loc5_ = new sandy.core.data.Vertex(_loc3_,0,_loc4_ + _loc14_);
  39.             _loc7_ = this.aPoints.push(_loc5_) - 1;
  40.             this.addUVCoordinate((_loc3_ + _loc9_) / this._lg,(_loc4_ + _loc13_) / this._h);
  41.             this.addUVCoordinate((_loc3_ + _loc9_ + _loc10_) / this._lg,(_loc4_ + _loc13_) / this._h);
  42.             this.addUVCoordinate((_loc3_ + _loc9_ + _loc10_) / this._lg,(_loc4_ + _loc13_ + _loc14_) / this._h);
  43.             this.addUVCoordinate((_loc3_ + _loc9_) / this._lg,(_loc4_ + _loc13_ + _loc14_) / this._h);
  44.             if(this._mode == "tri")
  45.             {
  46.                _loc2_ = new sandy.core.face.TriFace3D(this,this.aPoints[_loc12_],this.aPoints[_loc7_],this.aPoints[_loc8_]);
  47.                _loc2_.setUVCoordinates(this._aUv[_loc12_],this._aUv[_loc7_],this._aUv[_loc8_]);
  48.                this.addFace(_loc2_);
  49.                if(!_loc15_)
  50.                {
  51.                   _loc6_ = _loc2_.createNormale();
  52.                   this.aNormals.push(_loc6_);
  53.                   _loc15_ = true;
  54.                }
  55.                else
  56.                {
  57.                   _loc2_.setNormale(_loc6_);
  58.                }
  59.                _loc2_ = new sandy.core.face.TriFace3D(this,this.aPoints[_loc7_],this.aPoints[_loc11_],this.aPoints[_loc8_]);
  60.                _loc2_.setUVCoordinates(this._aUv[_loc7_],this._aUv[_loc11_],this._aUv[_loc8_]);
  61.                this.addFace(_loc2_);
  62.                _loc2_.setNormale(_loc6_);
  63.             }
  64.             else if(this._mode == "quad")
  65.             {
  66.                _loc2_ = new sandy.core.face.QuadFace3D(this,this.aPoints[_loc12_],this.aPoints[_loc7_],this.aPoints[_loc11_],this.aPoints[_loc8_]);
  67.                _loc2_.setUVCoordinates(this._aUv[_loc12_],this._aUv[_loc7_],this._aUv[_loc11_],this._aUv[_loc8_]);
  68.                this.addFace(_loc2_);
  69.                if(!_loc15_)
  70.                {
  71.                   _loc6_ = _loc2_.createNormale();
  72.                   this.aNormals.push(_loc6_);
  73.                   _loc15_ = true;
  74.                }
  75.                else
  76.                {
  77.                   _loc2_.setNormale(_loc6_);
  78.                }
  79.             }
  80.          }
  81.          while((_loc3_ += _loc10_) < _loc9_ - 1);
  82.          
  83.       }
  84.       while((_loc4_ += _loc14_) < _loc13_ - 1);
  85.       
  86.    }
  87. }
  88.