MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / requestInstanceDataBuffer

Method requestInstanceDataBuffer

src/render/RenderSystem.cpp:111–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111uint32_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
137void RenderSystem::unregisterInstanceDataBuffer(uint32_t idx)
138{

Callers 1

drawWorldFunction · 0.80

Calls 7

backMethod · 0.80
pop_backMethod · 0.80
push_backMethod · 0.80
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected