Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DLL_EXPORT void devRenderQueue2(Renderable* queue, char* const perObject, int perObjectSize, int queueSize, char* const perFrame, int poBuffer, int pfBuffer, unsigned shader, int primitive)
- {
- if(queueSize <= 0)
- return;
- //Device::CheckError("Error came from another place. Fuck. %c");
- Device::UseProgram(shader);
- //Debug::Log("Binding shader program: %i", shader);
- //Device::CheckError("Error binding shader. %c");
- if (pfBuffer >= 0)
- ConstantBuffer::Update(pfBuffer, perFrame);
- unsigned maxUsedTextures = 0;
- for (int i = 0; i < queueSize; ++i)
- {
- Device::BindVertexArray(queue[i].vao);
- //Debug::Log("Binding VAO: %i", queue[i].vao);
- //Device::CheckError("Error binding VAO.");
- if(maxUsedTextures < queue[i].textureCount)
- maxUsedTextures = queue[i].textureCount;
- for (unsigned j = 0; j < queue[i].textureCount; ++j)
- {
- Device::BindTexture2D(GL_TEXTURE0 + j, queue[i].textures[j]);
- //Debug::Log("Binding texture: %i. Total: %i", queue[i].textures[j], j);
- //Device::CheckError("Error binding Texture: %c");
- }
- if(poBuffer >= 0)
- {
- ConstantBuffer::Update(poBuffer, (perObject + perObjectSize * i));
- }
- if(queue[i].baseVertex)
- glDrawElementsBaseVertex(primitive, queue[i].numIndices, GL_UNSIGNED_INT, NULL, queue[i].baseVertex);
- else
- glDrawElements(primitive, queue[i].numIndices, GL_UNSIGNED_INT, NULL);
- //Debug::Log("Draw stuff: Base Vertex: %i, Number of Indices: %i, Primitive: %i", queue[i].numIndices, queue[i].baseVertex, primitive);
- //Device::CheckError("Error drawing stuff: %c");
- }
- for (unsigned i = 0; i < maxUsedTextures; ++i)
- {
- Device::BindTexture2D(GL_TEXTURE0 + i, 0);
- }
- Device::BindVertexArray(0);
- Device::UseProgram(0);
- }
- // size in floats
- DLL_EXPORT void devRenderQueue3(Renderable* queue, float* const perObject, int perObjectSize, int queueSize, float* const perFrame, int perFrameSize, int poBuffer, int pfBuffer, unsigned shader, int primitive)
- {
- if (queueSize <= 0)
- return;
- // Device::CheckError("Error came from another place. Fuck. %c");
- Device::UseProgram(shader);
- // Debug::Log("Binding shader program: %i", shader);
- // Device::CheckError("Error binding shader. %c");
- if (pfBuffer >= 0)
- {
- glUniformMatrix4fv(pfBuffer, perFrameSize / 16, false, perFrame);
- // Device::CheckError("Error binding pfBuffer. %c");
- }
- unsigned maxUsedTextures = 0;
- for (int i = 0; i < queueSize; ++i)
- {
- Device::BindVertexArray(queue[i].vao);
- //Debug::Log("Binding VAO: %i", queue[i].vao);
- // Device::CheckError("Error binding VAO.");
- if (maxUsedTextures < queue[i].textureCount)
- maxUsedTextures = queue[i].textureCount;
- for (unsigned j = 0; j < queue[i].textureCount; ++j)
- {
- Device::BindTexture2D(GL_TEXTURE0 + j, queue[i].textures[j]);
- //Debug::Log("Binding texture: %i. Total: %i", queue[i].textures[j], j);
- // Device::CheckError("Error binding Texture: %c");
- }
- if(poBuffer >= 0)
- glUniformMatrix4fv(poBuffer, perObjectSize / 16, false, (perObject + perObjectSize * i));
- if (queue[i].baseVertex)
- glDrawElementsBaseVertex(primitive, queue[i].numIndices, GL_UNSIGNED_INT, NULL, queue[i].baseVertex);
- else
- glDrawElements(primitive, queue[i].numIndices, GL_UNSIGNED_INT, NULL);
- //Debug::Log("Draw stuff: Base Vertex: %i, Number of Indices: %i, Primitive: %i", queue[i].numIndices, queue[i].baseVertex, primitive);
- //Device::CheckError("Error drawing stuff: %c");
- }
- for (unsigned i = 0; i < maxUsedTextures; ++i)
- {
- Device::BindTexture2D(GL_TEXTURE0 + i, 0);
- }
- Device::BindVertexArray(0);
- Device::UseProgram(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement