📄 plane.as
字号:
/**
* project3D Engine
* @author John Sword
* @version 2 - AS3
*
* simple Plane Primitive
*/
package engine.objects
{
import engine.objects.Object3D;
import engine.geom.Vertex;
import engine.geom.Vector;
import engine.geom.Face;
import engine.materials.*;
import engine.FlashOutAS3;
public class Plane extends Object3D
{
private var h:Number;
private var w:Number;
/**
* Constructor
* @param h Height of the Box
* @param d Depth of the Box
* @param w Width of the Box
* @param r Render mode
*/
public function Plane ( w:int, h:int, m:Material )
{
this.h = (!w) ? 10 : w;
this.w = (!h) ? 10 : h;
this.position = new Vector();
this.material = m;
build();
}
// initialization
private function build () : void
{
// build vertexes
createVertex(new Vertex (-w,h,0));
createVertex(new Vertex (w,h,0));
createVertex(new Vertex (-w,h,0));
// build faces (a Tri Poly box has 12 faces)
//createFaceVertexCoords(0,2,3);
//createFaceVertexCoords(3,1,0);
// texture coordinates
//createUV(0,2,3,[[1,0],[1,1],[0,1]]);
//createUV(3,1,0,[[0,1],[0,0],[1,0]]);
/*
var i:Number = aFacesAssoVertex.length;
while (i--)
{
var v1:Number = int(aFacesAssoVertex[i][0]);
var v2:Number = int(aFacesAssoVertex[i][1]);
var v3:Number = int(aFacesAssoVertex[i][2]);
// for retrieving texture uvs from textures array
var texVs:String = v1+","+v2+","+v3; // 3 vertices form a face
// get uv coords for this face
var texsUVs:Array = aFacesTextures[texVs];
var a:Vertex = tVertices[aFacesAssoVertex[i][0]];
var b:Vertex = tVertices[aFacesAssoVertex[i][1]];
var c:Vertex = tVertices[aFacesAssoVertex[i][2]];
//faces.push( new Face ( [ a, b, c ], material, texsUVs ) );
}
transform_vertices ( null );
*/
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -