本文整理汇总了C#中FastList.Trim方法的典型用法代码示例。如果您正苦于以下问题:C# FastList.Trim方法的具体用法?C# FastList.Trim怎么用?C# FastList.Trim使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FastList
的用法示例。
在下文中一共展示了FastList.Trim方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: load
//.........这里部分代码省略.........
p.n.Y = ptr[j].n.Y;
p.tex1 = new Vector3(ptr[j].u, ptr[j].v, instanceData);
fixed (byte* dst = &vtxBldBuffer[0])
{
Memory.Copy(&p, dst, TreeVertex.Size);
}
vertices2.Add(vtxBldBuffer);
}
}
material2 = meshData2.Materials[0];
partVtxCount2 += meshData2.PartVtxCount[0];
int[] meshIdx2 = meshData2.Indices[0];
for (int j = 0; j < meshIdx2.Length; j++)
{
indices2.Add(meshIdx2[j] + vtxOffset2);
}
vtxOffset2 += meshData2.VertexCount;
#endregion
plantCount++;
}
}
}
// ============================================================================
ObjectFactory fac = renderSys.ObjectFactory;
vtxDecl = fac.CreateVertexDeclaration(TreeVertex.Elements);
int vtxSize = vtxDecl.GetVertexSize();
vtxBuffer = fac.CreateVertexBuffer(vtxCount, vtxDecl, BufferUsage.Static);
vertices.Trim();
vtxBuffer.SetData<byte>(vertices.Elements);
vtxBuffer2 = fac.CreateVertexBuffer(vtxCount2, vtxDecl, BufferUsage.Static);
vertices2.Trim();
vtxBuffer2.SetData<byte>(vertices2.Elements);
int partCount = indices.Count;
idxBuffer = new IndexBuffer[partCount];
materials = new Material[partCount];
opBuf = new RenderOperation[partCount];
int index = 0;
foreach (KeyValuePair<Material, FastList<int>> e in indices)
{
FastList<int> list = e.Value;
list.Trim();
materials[index] = e.Key;
idxBuffer[index] = fac.CreateIndexBuffer(IndexBufferType.Bit32, list.Count, BufferUsage.Static);
idxBuffer[index].SetData<int>(list.Elements);
resourceSize += sizeof(int) * list.Count;
// ==============================================================================================
opBuf[index].Material = e.Key;
opBuf[index].Geomentry = new GeomentryData();
opBuf[index].Geomentry.BaseIndexStart = 0;
opBuf[index].Geomentry.BaseVertex = 0;
opBuf[index].Geomentry.IndexBuffer = idxBuffer[index];
opBuf[index].Geomentry.PrimCount = idxBuffer[index].IndexCount / 3;
opBuf[index].Geomentry.PrimitiveType = RenderPrimitiveType.TriangleList;
opBuf[index].Geomentry.VertexBuffer = vtxBuffer;
opBuf[index].Geomentry.VertexCount = partVtxCount[e.Key];
opBuf[index].Geomentry.VertexDeclaration = vtxDecl;
opBuf[index].Geomentry.VertexSize = vtxSize;
opBuf[index].Sender = this;
index++;
}
indices2.Trim();
idxBuffer2 = fac.CreateIndexBuffer(IndexBufferType.Bit32, indices2.Count, BufferUsage.Static);
idxBuffer2.SetData<int>(indices2.Elements);
opbuf2 = new RenderOperation[1];
opbuf2[0].Material = material2;
opbuf2[0].Geomentry = new GeomentryData();
opbuf2[0].Geomentry.BaseIndexStart = 0;
opbuf2[0].Geomentry.BaseVertex = 0;
opbuf2[0].Geomentry.IndexBuffer = idxBuffer2;
opbuf2[0].Geomentry.PrimCount = idxBuffer2.IndexCount / 3;
opbuf2[0].Geomentry.PrimitiveType = RenderPrimitiveType.TriangleList;
opbuf2[0].Geomentry.VertexBuffer = vtxBuffer2;
opbuf2[0].Geomentry.VertexCount = partVtxCount2;
opbuf2[0].Geomentry.VertexDeclaration = vtxDecl;
opbuf2[0].Geomentry.VertexSize = vtxSize;
opbuf2[0].Sender = this;
}