| 109 | } |
| 110 | |
| 111 | uint32_t RenderSystem::requestInstanceDataBuffer() |
| 112 | { |
| 113 | // Check for a free spot |
| 114 | if (!m_FreeInstanceDataBuffers.empty()) |
| 115 | { |
| 116 | uint32_t p = m_FreeInstanceDataBuffers.back(); |
| 117 | m_FreeInstanceDataBuffers.pop_back(); |
| 118 | |
| 119 | return p; |
| 120 | } |
| 121 | |
| 122 | // TODO: Move this so we can have more than that |
| 123 | bgfx::VertexDecl decl; |
| 124 | decl.begin(); |
| 125 | decl.add(bgfx::Attrib::TexCoord0, 4, bgfx::AttribType::Float); |
| 126 | decl.add(bgfx::Attrib::TexCoord1, 4, bgfx::AttribType::Float); |
| 127 | decl.add(bgfx::Attrib::TexCoord2, 4, bgfx::AttribType::Float); |
| 128 | decl.add(bgfx::Attrib::TexCoord3, 4, bgfx::AttribType::Float); |
| 129 | decl.add(bgfx::Attrib::TexCoord4, 4, bgfx::AttribType::Float); |
| 130 | decl.end(); |
| 131 | |
| 132 | // Create a new spot |
| 133 | m_InstanceDataBuffers.push_back(bgfx::createDynamicVertexBuffer(1, decl, BGFX_BUFFER_ALLOW_RESIZE)); |
| 134 | return (uint32_t)m_InstanceDataBuffers.size() - 1; |
| 135 | } |
| 136 | |
| 137 | void RenderSystem::unregisterInstanceDataBuffer(uint32_t idx) |
| 138 | { |