本文整理汇总了C#中VertexBuffer.SetIndices方法的典型用法代码示例。如果您正苦于以下问题:C# VertexBuffer.SetIndices方法的具体用法?C# VertexBuffer.SetIndices怎么用?C# VertexBuffer.SetIndices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VertexBuffer
的用法示例。
在下文中一共展示了VertexBuffer.SetIndices方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MonoGameSpriteBatchUnpacked
public MonoGameSpriteBatchUnpacked(GraphicsContext context, int size)
{
_context = context;
Size = size;
_indexArray = new ushort[6 * size];
for (int i = 0; i < size; i++)
{
_indexArray[i * 6 + 0] = (ushort)(i * 4);
_indexArray[i * 6 + 1] = (ushort)(i * 4 + 1);
_indexArray[i * 6 + 2] = (ushort)(i * 4 + 2);
_indexArray[i * 6 + 3] = (ushort)(i * 4 + 1);
_indexArray[i * 6 + 4] = (ushort)(i * 4 + 3);
_indexArray[i * 6 + 5] = (ushort)(i * 4 + 2);
}
_vertexArrayVector = new Vector2[4 * size];
_vertexArrayColor = new VertexElementColor[4 * size];
_vertexArrayTexture = new Vector2[4 * size];
_vertexBuffer = new VertexBuffer(4 * size, 6 * size, VertexFormat.Float2, VertexFormat.UByte4N, VertexFormat.Float2);
_vertexBuffer.SetIndices(_indexArray, 0, 0, 6 * size);
_shader = new ShaderProgram("/Application/shaders/Texture.cgx");
}
示例2: RenderNode
public RenderNode(IRenderable renderableObject)
{
Textures = new Texture2D[7];
this.renderableObject = renderableObject;
//Vertex TexCoord //Normals //Tangents
vbuffer = new VertexBuffer (renderableObject.GetVertexCount () / 3, renderableObject.GetIndexCount (), VertexFormat.Float3, VertexFormat.Float2, VertexFormat.Float3, VertexFormat.Float3);
vbuffer.SetVertices (0, renderableObject.GetVertices ());
if (renderableObject.GetTexCoords () != null)
vbuffer.SetVertices (1, renderableObject.GetTexCoords ());
if (renderableObject.HasNormals ())
vbuffer.SetVertices (2, renderableObject.GetNormals ());
if (renderableObject.GetTangents () != null)
vbuffer.SetVertices (3, renderableObject.GetTangents ());
vbuffer.SetIndices (renderableObject.GetIndices ());
}
示例3: InitializeVertexBuffer
private void InitializeVertexBuffer()
{
VertexBuffer = new VertexBuffer(VertexCount, IndexCount, VertexFormat.Float3, VertexFormat.Float2, VertexFormat.Float4);
VertexBuffer.SetVertices(0, Vertices);
VertexBuffer.SetVertices(1, TextureCoordinates);
VertexBuffer.SetVertices(2, VertexColors);
VertexBuffer.SetIndices(Indices);
}
示例4: GetAVertexBuffer
public VertexBuffer GetAVertexBuffer()
{
if ( m_free_list.Count == 0 )
{
int num_indices = 0;
VertexBuffer vb;
// #ifdef DEBUG
// System.Console.WriteLine( Common.FrameCount + " VertexBufferPool: create VertexBuffer, size=" + m_max_vertices );
// #endif
if ( null == m_parent.m_indices )
{
vb = new VertexBuffer( (int)m_max_vertices, 0, m_parent.m_format );
}
else
{
num_indices = ( m_max_vertices / m_parent.m_vertices_per_primitive ) * m_parent.m_indices_per_primitive;
vb = new VertexBuffer( (int)m_max_vertices, num_indices, m_parent.m_format );
// note: the real number of indices we are going to need is not the one based on the power of 2 snapped
// number of vertices, but SetIndices must be passed a size that matches the created VertexBuffer size
// I think? (or you get a native function error)
Common.Assert( num_indices <= m_parent.m_indices.Length);
vb.SetIndices( m_parent.m_indices, 0, 0, num_indices );
}
m_free_list.Add( new Entry() { m_vertex_buffer = vb, m_frame_count = Common.FrameCount } );
}
Entry ret = m_free_list[ m_free_list.Count - 1 ];
m_free_list.RemoveAt( m_free_list.Count - 1 );
m_active_list.Add( ret );
return ret.m_vertex_buffer;
}