标签:io ar java for on cti ad ef as
#pragma strict function Awake(){ var pMeshFilter : MeshFilter = gameObject.AddComponent(typeof(MeshFilter)) as MeshFilter;//网格过滤器 var pMeshRender : MeshRenderer = gameObject.AddComponent(typeof(MeshRenderer)) as MeshRenderer;//网格渲染 var pMesh : Mesh = pMeshFilter.mesh as Mesh; //网格过滤器的实例化的Mesh //u3d中绘制图形都是三角形绘制法,顺时针,所以先记录所有的点,然后在确定三角形绘制的顺序 var pVector : Vector3 [] = new Vector3[36]; var pTriangles : int [] = new int[pVector.length]; //forword pVector[0] = new Vector3(0.0f,0.0f,0.0f); pVector[1] = new Vector3(0.0f,1.0f,0.0f); pVector[2] = new Vector3(1.0f,0.0f,0.0f); pVector[3] = new Vector3(1.0f,0.0f,0.0f); pVector[4] = new Vector3(0.0f,1.0f,0.0f); pVector[5] = new Vector3(1.0f,1.0f,0.0f); //back pVector[6] = new Vector3(0.0f,0.0f,1.0f); pVector[7] = new Vector3(0.0f,1.0f,1.0f); pVector[8] = new Vector3(1.0f,0.0f,1.0f); pVector[9] = new Vector3(1.0f,0.0f,1.0f); pVector[10] = new Vector3(0.0f,1.0f,1.0f); pVector[11] = new Vector3(1.0f,1.0f,1.0f); //left pVector[12] = new Vector3(0.0f,0.0f,0.0f); pVector[13] = new Vector3(0.0f,0.0f,1.0f); pVector[14] = new Vector3(0.0f,1.0f,1.0f); pVector[15] = new Vector3(0.0f,1.0f,1.0f); pVector[16] = new Vector3(0.0f,1.0f,0.0f); pVector[17] = new Vector3(0.0f,0.0f,0.0f); //right pVector[18] = new Vector3(1.0f,0.0f,0.0f); pVector[19] = new Vector3(1.0f,0.0f,1.0f); pVector[20] = new Vector3(1.0f,1.0f,0.0f); pVector[21] = new Vector3(1.0f,1.0f,0.0f); pVector[22] = new Vector3(1.0f,0.0f,1.0f); pVector[23] = new Vector3(1.0f,1.0f,1.0f); //up pVector[24] = new Vector3(0.0f,1.0f,0.0f); pVector[25] = new Vector3(0.0f,1.0f,1.0f); pVector[26] = new Vector3(1.0f,1.0f,0.0f); pVector[27] = new Vector3(1.0f,1.0f,0.0f); pVector[28] = new Vector3(0.0f,1.0f,1.0f); pVector[29] = new Vector3(1.0f,1.0f,1.0f); //down pVector[30] = new Vector3(0.0f,0.0f,0.0f); pVector[31] = new Vector3(0.0f,0.0f,1.0f); pVector[32] = new Vector3(1.0f,0.0f,0.0f); pVector[33] = new Vector3(1.0f,0.0f,0.0f); pVector[34] = new Vector3(0.0f,0.0f,1.0f); pVector[35] = new Vector3(1.0f,0.0f,1.0f); for(var nIndex : int = 0; nIndex < pTriangles.length;++nIndex){ pTriangles[nIndex] =nIndex; } pMesh.Clear(); pMesh.vertices = pVector;//网格顶点 pMesh.triangles = pTriangles;//三角形 pMesh.RecalculateBounds(); }
标签:io ar java for on cti ad ef as
原文地址:http://blog.csdn.net/xiaxiang123/article/details/41217761