home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
404 Jogos
/
CLJG.iso
/
Esportes
/
CrossingCup.swf
/
scripts
/
__Packages
/
sandy
/
primitive
/
Plane3D.as
< prev
next >
Wrap
Text File
|
2007-12-11
|
4KB
|
88 lines
class sandy.primitive.Plane3D extends sandy.core.Object3D implements sandy.primitive.Primitive3D
{
function Plane3D(h, lg, q, mode)
{
super();
this._h = undefined != h ? Number(h) : 6;
this._lg = undefined != lg ? Number(lg) : 6;
this._q = !(undefined == q || q <= 0 || q > 10) ? Number(q) : 1;
this._mode = !(undefined == mode || mode != "tri" && mode != "quad") ? mode : "tri";
this.generate();
}
function generate(Void)
{
var _loc13_ = this._h / 2;
var _loc9_ = this._lg / 2;
var _loc14_ = this._h / this._q;
var _loc10_ = this._lg / this._q;
var _loc5_ = undefined;
var _loc12_ = undefined;
var _loc8_ = undefined;
var _loc11_ = undefined;
var _loc7_ = undefined;
var _loc2_ = undefined;
var _loc4_ = - _loc13_;
var _loc15_ = false;
var _loc6_ = undefined;
do
{
var _loc3_ = - _loc9_;
do
{
_loc5_ = new sandy.core.data.Vertex(_loc3_,0,_loc4_);
_loc12_ = this.aPoints.push(_loc5_) - 1;
_loc5_ = new sandy.core.data.Vertex(_loc3_ + _loc10_,0,_loc4_);
_loc8_ = this.aPoints.push(_loc5_) - 1;
_loc5_ = new sandy.core.data.Vertex(_loc3_ + _loc10_,0,_loc4_ + _loc14_);
_loc11_ = this.aPoints.push(_loc5_) - 1;
_loc5_ = new sandy.core.data.Vertex(_loc3_,0,_loc4_ + _loc14_);
_loc7_ = this.aPoints.push(_loc5_) - 1;
this.addUVCoordinate((_loc3_ + _loc9_) / this._lg,(_loc4_ + _loc13_) / this._h);
this.addUVCoordinate((_loc3_ + _loc9_ + _loc10_) / this._lg,(_loc4_ + _loc13_) / this._h);
this.addUVCoordinate((_loc3_ + _loc9_ + _loc10_) / this._lg,(_loc4_ + _loc13_ + _loc14_) / this._h);
this.addUVCoordinate((_loc3_ + _loc9_) / this._lg,(_loc4_ + _loc13_ + _loc14_) / this._h);
if(this._mode == "tri")
{
_loc2_ = new sandy.core.face.TriFace3D(this,this.aPoints[_loc12_],this.aPoints[_loc7_],this.aPoints[_loc8_]);
_loc2_.setUVCoordinates(this._aUv[_loc12_],this._aUv[_loc7_],this._aUv[_loc8_]);
this.addFace(_loc2_);
if(!_loc15_)
{
_loc6_ = _loc2_.createNormale();
this.aNormals.push(_loc6_);
_loc15_ = true;
}
else
{
_loc2_.setNormale(_loc6_);
}
_loc2_ = new sandy.core.face.TriFace3D(this,this.aPoints[_loc7_],this.aPoints[_loc11_],this.aPoints[_loc8_]);
_loc2_.setUVCoordinates(this._aUv[_loc7_],this._aUv[_loc11_],this._aUv[_loc8_]);
this.addFace(_loc2_);
_loc2_.setNormale(_loc6_);
}
else if(this._mode == "quad")
{
_loc2_ = new sandy.core.face.QuadFace3D(this,this.aPoints[_loc12_],this.aPoints[_loc7_],this.aPoints[_loc11_],this.aPoints[_loc8_]);
_loc2_.setUVCoordinates(this._aUv[_loc12_],this._aUv[_loc7_],this._aUv[_loc11_],this._aUv[_loc8_]);
this.addFace(_loc2_);
if(!_loc15_)
{
_loc6_ = _loc2_.createNormale();
this.aNormals.push(_loc6_);
_loc15_ = true;
}
else
{
_loc2_.setNormale(_loc6_);
}
}
}
while((_loc3_ += _loc10_) < _loc9_ - 1);
}
while((_loc4_ += _loc14_) < _loc13_ - 1);
}
}