Added korean location
This commit is contained in:
1 parent
d5ef126264
commit
96e748715b
80 files changed
+18949
-80
No files matched your search
+67
-2
@@ -131,7 +131,7 @@ namespace FRG {
|
||||
glDeleteVertexArrays(1, &vao);
|
||||
#else
|
||||
//Windows
|
||||
glDeleteVertexArray(1, &vao);
|
||||
glDeleteVertexArrays(1, &vao);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
@@ -920,7 +920,73 @@ namespace FRG {
|
||||
glDisableVertexAttribArray(it->second);
|
||||
}
|
||||
|
||||
void InstancedBatch::RefreshInstanceVBO()
|
||||
{
|
||||
if (instances.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!instanceVBO)
|
||||
{
|
||||
instanceVBO = std::make_shared<VBOHolder>();
|
||||
}
|
||||
|
||||
// Matrix4f is column-major with no padding: 16 floats per instance.
|
||||
glBindBuffer(GL_ARRAY_BUFFER, instanceVBO->getBuffer());
|
||||
glBufferData(GL_ARRAY_BUFFER, instances.size() * sizeof(Matrix4f), instances.data(), GL_STATIC_DRAW);
|
||||
}
|
||||
|
||||
void Renderer::DrawVertexRenderStruct(const VertexRenderStruct& VertexRenderStruct)
|
||||
{
|
||||
BindVertexRenderStructAttribs(VertexRenderStruct);
|
||||
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(VertexRenderStruct.data.PositionData.size()));
|
||||
}
|
||||
|
||||
void Renderer::DrawInstanced(const InstancedBatch& batch)
|
||||
{
|
||||
if (batch.instances.empty() || !batch.instanceVBO || !batch.mesh.positionVBO)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BindVertexRenderStructAttribs(batch.mesh);
|
||||
|
||||
static const char* const instanceAttribNames[4] = { "iModel0", "iModel1", "iModel2", "iModel3" };
|
||||
|
||||
auto shader = shaderManager.GetCurrentShader();
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, batch.instanceVBO->getBuffer());
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
auto it = shader->attribList.find(instanceAttribNames[i]);
|
||||
if (it == shader->attribList.end())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
glVertexAttribPointer(it->second, 4, GL_FLOAT, GL_FALSE, sizeof(Matrix4f),
|
||||
reinterpret_cast<const void*>(static_cast<size_t>(i) * 4 * sizeof(float)));
|
||||
glVertexAttribDivisor(it->second, 1);
|
||||
}
|
||||
|
||||
glDrawArraysInstanced(GL_TRIANGLES, 0,
|
||||
static_cast<GLsizei>(batch.mesh.data.PositionData.size()),
|
||||
static_cast<GLsizei>(batch.instances.size()));
|
||||
|
||||
// The divisor is vertex array state: reset it so that later non-instanced draws
|
||||
// with these attribute locations are not affected.
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
auto it = shader->attribList.find(instanceAttribNames[i]);
|
||||
if (it != shader->attribList.end())
|
||||
{
|
||||
glVertexAttribDivisor(it->second, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::BindVertexRenderStructAttribs(const VertexRenderStruct& VertexRenderStruct)
|
||||
{
|
||||
#ifndef EMSCRIPTEN
|
||||
#ifndef __ANDROID__
|
||||
@@ -988,7 +1054,6 @@ namespace FRG {
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VertexRenderStruct.positionVBO->getBuffer());
|
||||
VertexAttribPointer3fv(vPosition, 0, NULL);
|
||||
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(VertexRenderStruct.data.PositionData.size()));
|
||||
}
|
||||
|
||||
void worldToScreenCoordinates(Vector3f objectPos,
|
||||
|
||||
Reference in new issue
Block a user