本文整理汇总了C#中IndexBuffer.FreeClientData方法的典型用法代码示例。如果您正苦于以下问题:C# IndexBuffer.FreeClientData方法的具体用法?C# IndexBuffer.FreeClientData怎么用?C# IndexBuffer.FreeClientData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IndexBuffer
的用法示例。
在下文中一共展示了IndexBuffer.FreeClientData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TerrainBlock
internal TerrainBlock(int x_start, int y_start, int x_count, int y_count, BoundingBox box, int subdivision, Terrain owner)
{
bounds = box;
if (subdivision < owner.Subdivisions)
{
x_count /= 2;
y_count /= 2;
Vector3 new_size = box.Size / 2;
new_size.y = box.Size.y;
float offset = box.Size.x / 4;
children = new List<TerrainBlock>();
children.Add(new TerrainBlock(x_start, y_start, x_count, y_count, new BoundingBox() { Size = new_size, Position = box.Position + new Vector3(-offset, 0, offset) }, subdivision + 1, owner));
children.Add(new TerrainBlock(x_start + x_count, y_start, x_count, y_count, new BoundingBox() { Size = new_size, Position = box.Position + new Vector3(offset, 0, offset) }, subdivision + 1, owner));
children.Add(new TerrainBlock(x_start + x_count, y_start + y_count, x_count, y_count, new BoundingBox() { Size = new_size, Position = box.Position + new Vector3(offset, 0, -offset) }, subdivision + 1, owner));
children.Add(new TerrainBlock(x_start, y_start + y_count, x_count, y_count, new BoundingBox() { Size = new_size, Position = box.Position + new Vector3(-offset, 0, -offset) }, subdivision + 1, owner));
}
else
{
ib = new IndexBuffer<int>();
ib.Allocate(6 * (x_count) * (y_count));
int index = 0;
for (int i = 0; i < y_count; i++)
{
for (int j = 0; j < x_count; j++)
{
int i1 = (y_start + i) * owner.heightmap.Width + x_start + j;
int i2 = (y_start + i) * owner.heightmap.Width + x_start + j + 1;
int i3 = (y_start + i + 1) * owner.heightmap.Width + x_start + j + 1;
int i4 = (y_start + i + 1) * owner.heightmap.Width + x_start + j;
ib[index++] = i1;
ib[index++] = i3;
ib[index++] = i2;
ib[index++] = i1;
ib[index++] = i4;
ib[index++] = i3;
}
}
ib.BufferData(VboUsage.GL_STATIC_DRAW);
ib.FreeClientData();
}
}
示例2: Build
protected override void Build()
{
vb = new VertexBuffer<Vector3>(Vector3.Descriptor);
vb.Allocate(8);
ib = new IndexBuffer<ushort>();
ib.Allocate(4 * 6);
vb[0] = new Vector3(-0.5f, -0.5f, -0.5f);
vb[1] = new Vector3(0.5f, -0.5f, -0.5f);
vb[2] = new Vector3(0.5f, 0.5f, -0.5f);
vb[3] = new Vector3(-0.5f, 0.5f, -0.5f);
vb[4] = new Vector3(-0.5f, -0.5f, 0.5f);
vb[5] = new Vector3(0.5f, -0.5f, 0.5f);
vb[6] = new Vector3(0.5f, 0.5f, 0.5f);
vb[7] = new Vector3(-0.5f, 0.5f, 0.5f);
ib[0] = 0;
ib[1] = 1;
ib[2] = 2;
ib[3] = 3;
ib[4] = 4;
ib[5] = 0;
ib[6] = 3;
ib[7] = 7;
ib[8] = 5;
ib[9] = 4;
ib[10] = 7;
ib[11] = 6;
ib[12] = 1;
ib[13] = 5;
ib[14] = 6;
ib[15] = 2;
ib[16] = 6;
ib[17] = 7;
ib[18] = 3;
ib[19] = 2;
ib[20] = 0;
ib[21] = 4;
ib[22] = 5;
ib[23] = 1;
vb.BufferData(VboUsage.GL_STATIC_DRAW);
ib.BufferData(VboUsage.GL_STATIC_DRAW);
// Client data is no longer needed. Free it!
vb.FreeClientData();
ib.FreeClientData();
}