mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 10:35:43 -05:00
Added ability to set start vertex when setting vertex buffer.
This commit is contained in:
parent
9534f26868
commit
78475a30e6
4 changed files with 10 additions and 13 deletions
|
@ -65,7 +65,7 @@ static PosColorVertex s_cubeVertices[28] =
|
|||
{ 1.0f, -1.0f, 1.0f, 2.0f, -2.0f, 2.0f },
|
||||
};
|
||||
|
||||
static const uint16_t s_cubeIndices[42] =
|
||||
static const uint16_t s_cubeIndices[36] =
|
||||
{
|
||||
0, 1, 2, // 0
|
||||
1, 3, 2,
|
||||
|
@ -84,9 +84,6 @@ static const uint16_t s_cubeIndices[42] =
|
|||
|
||||
20, 22, 21, // 10
|
||||
21, 22, 23,
|
||||
|
||||
24, 25, 26, //
|
||||
25, 27, 26,
|
||||
};
|
||||
|
||||
static const char* s_shaderPath = NULL;
|
||||
|
@ -478,8 +475,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
bgfx::setProgram(programCmp);
|
||||
|
||||
// Set vertex and index buffer.
|
||||
bgfx::setVertexBuffer(vbh);
|
||||
bgfx::setIndexBuffer(ibh, 36, 6);
|
||||
bgfx::setVertexBuffer(vbh, 24, 4);
|
||||
bgfx::setIndexBuffer(ibh, 0, 6);
|
||||
|
||||
// Bind texture.
|
||||
bgfx::setTexture(0, u_texColor, textures[ii]);
|
||||
|
|
|
@ -1245,7 +1245,7 @@ namespace bgfx
|
|||
void setIndexBuffer(const TransientIndexBuffer* _tib, uint32_t _numIndices = UINT32_MAX);
|
||||
|
||||
/// Set vertex buffer for draw primitive.
|
||||
void setVertexBuffer(VertexBufferHandle _handle, uint32_t _numVertices = UINT32_MAX);
|
||||
void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex = 0, uint32_t _numVertices = UINT32_MAX);
|
||||
|
||||
/// Set vertex buffer for draw primitive.
|
||||
void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices = UINT32_MAX);
|
||||
|
|
|
@ -2275,10 +2275,10 @@ namespace bgfx
|
|||
s_ctx->setIndexBuffer(_tib, numIndices);
|
||||
}
|
||||
|
||||
void setVertexBuffer(VertexBufferHandle _handle, uint32_t _numVertices)
|
||||
void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
s_ctx->setVertexBuffer(_handle, _numVertices);
|
||||
s_ctx->setVertexBuffer(_handle, _startVertex, _numVertices);
|
||||
}
|
||||
|
||||
void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices)
|
||||
|
|
|
@ -1137,10 +1137,10 @@ namespace bgfx
|
|||
m_discard = 0 == _numIndices;
|
||||
}
|
||||
|
||||
void setVertexBuffer(VertexBufferHandle _handle, uint32_t _numVertices)
|
||||
void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices)
|
||||
{
|
||||
BX_CHECK(_handle.idx < BGFX_CONFIG_MAX_VERTEX_BUFFERS, "Invalid vertex buffer handle. %d (< %d)", _handle.idx, BGFX_CONFIG_MAX_VERTEX_BUFFERS);
|
||||
m_state.m_startVertex = 0;
|
||||
m_state.m_startVertex = _startVertex;
|
||||
m_state.m_numVertices = _numVertices;
|
||||
m_state.m_vertexBuffer = _handle;
|
||||
}
|
||||
|
@ -2481,9 +2481,9 @@ namespace bgfx
|
|||
m_submit->setIndexBuffer(_tib, _numIndices);
|
||||
}
|
||||
|
||||
BGFX_API_FUNC(void setVertexBuffer(VertexBufferHandle _handle, uint32_t _numVertices) )
|
||||
BGFX_API_FUNC(void setVertexBuffer(VertexBufferHandle _handle, uint32_t _numVertices, uint32_t _startVertex) )
|
||||
{
|
||||
m_submit->setVertexBuffer(_handle, _numVertices);
|
||||
m_submit->setVertexBuffer(_handle, _numVertices, _startVertex);
|
||||
}
|
||||
|
||||
BGFX_API_FUNC(void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices) )
|
||||
|
|
Loading…
Reference in a new issue