本文整理汇总了C#中Mesh.getTriangleCount方法的典型用法代码示例。如果您正苦于以下问题:C# Mesh.getTriangleCount方法的具体用法?C# Mesh.getTriangleCount怎么用?C# Mesh.getTriangleCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mesh
的用法示例。
在下文中一共展示了Mesh.getTriangleCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: encode
public void encode(Mesh m, String comment)
{
// Check mesh integrity
m.checkIntegrity();
// Determine flags
int flags = 0;
if (m.normals != null) {
flags |= MeshInfo.HAS_NORMAL_BIT;
}
// Write header to stream
output.writeLittleInt(CtmFileReader.OCTM);
output.writeLittleInt(encoder.getFormatVersion());
output.writeLittleInt(encoder.getTag());
output.writeLittleInt(m.getVertexCount());
output.writeLittleInt(m.getTriangleCount());
output.writeLittleInt(m.getUVCount());
output.writeLittleInt(m.getAttrCount());
output.writeLittleInt(flags);
output.writeString(comment);
// Compress to stream
encoder.encode(m, output);
}
示例2: MG2MeshEqualsTest
private void MG2MeshEqualsTest(MG2Encoder enc, Mesh orig, Mesh read)
{
Assert.AreEqual (orig.getTriangleCount (), read.getTriangleCount (), "Trianglecount differs");
Assert.AreEqual (orig.getVertexCount (), read.getVertexCount (), "Vertexcount differs");
Assert.AreEqual (orig.hasNormals (), read.hasNormals (), "Only one has normals");
Grid grid = enc.setupGrid (orig.vertices);
SortableVertex[] sorted = enc.sortVertices (grid, orig.vertices);
int[] indexLUT = new int[sorted.Length];
for (int i = 0; i < sorted.Length; ++i) {
indexLUT [sorted [i].originalIndex] = i;
}
for (int i=0; i < orig.getVertexCount(); i++) {
int newIndex = indexLUT [i];
for (int e = 0; e < Mesh.CTM_POSITION_ELEMENT_COUNT; e++) {
Assert.IsTrue (compare (orig.vertices [i * 3 + e], read.vertices [newIndex * 3 + e], enc.vertexPrecision * 2),
"positions not in precision");
}
if (orig.hasNormals ()) {
for (int e = 0; e < Mesh.CTM_NORMAL_ELEMENT_COUNT; e++) {
Assert.IsTrue (compare (orig.normals [i * 3 + e], read.normals [newIndex * 3 + e], enc.normalPrecision * 10),
"normals not in precision");
}
}
}
testAttributeArrays (orig.texcoordinates, read.texcoordinates, indexLUT);
testAttributeArrays (orig.attributs, read.attributs, indexLUT);
}
示例3: encode
public override void encode(Mesh m, CtmOutputStream output)
{
Grid grid = setupGrid (m.vertices);
SortableVertex[] sorted = sortVertices (grid, m.vertices);
int[] vdeltas = makeVertexDeltas (m.vertices, sorted, grid);
int[] gridIndicies = new int[m.getVertexCount ()];
gridIndicies [0] = sorted [0].gridIndex;
for (int i = 1; i < m.getVertexCount(); ++i) {
gridIndicies [i] = sorted [i].gridIndex - sorted [i - 1].gridIndex;
}
output.writeLittleInt (MG2Decoder.MG2_HEADER_TAG);
output.writeLittleFloat (vertexPrecision);
output.writeLittleFloat (normalPrecision);
grid.writeToStream (output);
output.writeLittleInt (MeshDecoder.VERT);
output.writePackedInts (vdeltas, m.getVertexCount (), Mesh.CTM_POSITION_ELEMENT_COUNT, false);
output.writeLittleInt (MG2Decoder.GIDX);
output.writePackedInts (gridIndicies, m.getVertexCount (), 1, false);
output.writeLittleInt (MeshDecoder.INDX);
int[] indices = reIndexIndices (sorted, m.indices);
rearrangeTriangles (indices);
//write indicies
{
int[] deltas = new int[indices.Length];
Array.Copy(indices, deltas, indices.Length);
makeIndexDeltas (deltas);
output.writePackedInts (deltas, m.getTriangleCount (), 3, false);
}
if (m.hasNormals ()) {
for (int i = 1; i < m.getVertexCount(); i++) {
gridIndicies [i] += gridIndicies [i - 1];
}
float[] restoredv = CommonAlgorithm.restoreVertices (vdeltas, gridIndicies, grid, vertexPrecision);
output.writeLittleInt (MeshDecoder.NORM);
int[] intNormals = makeNormalDeltas (restoredv, m.normals, indices, sorted);
output.writePackedInts (intNormals, m.getVertexCount (), Mesh.CTM_NORMAL_ELEMENT_COUNT, false);
}
foreach (AttributeData ad in m.texcoordinates) {
output.writeLittleInt (MeshDecoder.TEXC);
output.writeString (ad.name);
output.writeString (ad.materialName);
output.writeLittleFloat (ad.precision);
int[] deltas = makeUVCoordDeltas (ad, sorted);
output.writePackedInts (deltas, m.getVertexCount (), Mesh.CTM_UV_ELEMENT_COUNT, true);
}
foreach (AttributeData ad in m.attributs) {
output.writeLittleInt (MeshDecoder.ATTR);
output.writeString (ad.name);
output.writeLittleFloat (ad.precision);
int[] deltas = makeAttribDeltas (ad, sorted);
output.writePackedInts (deltas, m.getVertexCount (), Mesh.CTM_ATTR_ELEMENT_COUNT, true);
}
}