本文整理汇总了C#中Surface.addFace方法的典型用法代码示例。如果您正苦于以下问题:C# Surface.addFace方法的具体用法?C# Surface.addFace怎么用?C# Surface.addFace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Surface
的用法示例。
在下文中一共展示了Surface.addFace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: readMesh
//.........这里部分代码省略.........
//vertex face
v0 =(int) file.ReadUInt16 ();
v1 =(int) file.ReadUInt16 ();
v2 =(int) file.ReadUInt16 ();
faces.Add (new Face (v0, v1, v2));
//texture faces
v0 =(int) file.ReadUInt16();
v1 =(int) file.ReadUInt16 ();
v2 =(int) file.ReadUInt16 ();
tfaces.Add (new Face (v0, v1, v2));
}
file.BaseStream.Seek(OffsetTexCoords,SeekOrigin.Begin);
Debug.Log("Num TextureCoord"+NumTexCoords);
for (int i=0; i<NumTexCoords; i++)
{
float u=(float) file.ReadInt16()/SkinWidth;
float v=(float)1*- file.ReadInt16()/SkinWidth;
uvCoords.Add(new Vector2(u,v));
}
//**************************************************
file.BaseStream.Seek(OffsetFrames,SeekOrigin.Begin);
Debug.Log("Num Frames"+OffsetFrames);
for (int i=0; i<NumFrames; i++)
{
Vector3 Scale=Vector3.zero;
Vector3 Translate=Vector3.zero;
Scale.x = file.ReadSingle();
Scale.y = file.ReadSingle();
Scale.z = file.ReadSingle();
Translate.x = file.ReadSingle();
Translate.y = file.ReadSingle();
Translate.z = file.ReadSingle();
char[] name= file.ReadChars(16);
//Debug.LogWarning(new string(name));
for (int j=0; j<NumVertices; j++)
{
byte x = file.ReadByte();
byte y = file.ReadByte();
byte z = file.ReadByte();
byte w = file.ReadByte();
// System.BitConverter.ToSingle(buffer, 0);
float sx = Scale.x * x + Translate.x;
float sy = Scale.z * z + Translate.z;
float sz = Scale.y * y + Translate.y;
model.vertex.Add(new Vector3(sx,sy,sz));
}
}
//meshFilter.sharedMesh =Surface.createCube ("cube");
for (int f=0; f<NumFrames; f++)
{
Surface surface= new Surface("frame");
for (int i=0; i<faces.Count; i++)
{
Vector3 v1 = model.vertex[f * vertex_Count + faces[i].v0];
Vector3 v2 = model.vertex[f * vertex_Count + faces[i].v1];
Vector3 v3 = model.vertex[f * vertex_Count + faces[i].v2];
Vector2 uv1 = uvCoords[0 * uv_count + tfaces[i].v0];
Vector2 uv2 = uvCoords[0 * uv_count + tfaces[i].v1];
Vector2 uv3 = uvCoords[0 * uv_count + tfaces[i].v2];
surface.addFace(v1, v2, v3, uv1, uv2, uv3);
}
surface.build();
surface.RecalculateNormals();
surface.Optimize();
model.Frames.Add(surface.getMesh());
}
model.meshFilter.sharedMesh=model.Frames[0];
model.ready=true;
Debug.LogWarning("read ok");
}
} else {
Debug.LogError (filename + " dont exits");
}
}