4 bindless textures + texture translation + colorization in vao
This commit is contained in:
parent
60908c3e1d
commit
decf3b9715
@ -8,7 +8,7 @@ layout(location = 6) in vec3 Bitangent;
|
|||||||
layout(location = 7) in vec3 Origin;
|
layout(location = 7) in vec3 Origin;
|
||||||
layout(location = 8) in vec3 Orientation;
|
layout(location = 8) in vec3 Orientation;
|
||||||
layout(location = 9) in vec3 Scale;
|
layout(location = 9) in vec3 Scale;
|
||||||
layout(location = 12) in vec4 GlowColor;
|
layout(location = 15) in vec4 GlowColor;
|
||||||
|
|
||||||
flat out vec4 glowColor;
|
flat out vec4 glowColor;
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ layout(location = 7) in vec3 Origin;
|
|||||||
layout(location = 8) in vec3 Orientation;
|
layout(location = 8) in vec3 Orientation;
|
||||||
layout(location = 9) in vec3 Scale;
|
layout(location = 9) in vec3 Scale;
|
||||||
#ifdef Use_Bindless_Texture
|
#ifdef Use_Bindless_Texture
|
||||||
layout(location = 10) in sampler2D Handle;
|
layout(location = 11) in sampler2D Handle;
|
||||||
layout(location = 11) in sampler2D SecondHandle;
|
layout(location = 12) in sampler2D SecondHandle;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -10,10 +10,12 @@ layout(location = 6) in vec3 Bitangent;
|
|||||||
layout(location = 7) in vec3 Origin;
|
layout(location = 7) in vec3 Origin;
|
||||||
layout(location = 8) in vec3 Orientation;
|
layout(location = 8) in vec3 Orientation;
|
||||||
layout(location = 9) in vec3 Scale;
|
layout(location = 9) in vec3 Scale;
|
||||||
|
layout(location = 10) in vec4 misc_data;
|
||||||
#ifdef Use_Bindless_Texture
|
#ifdef Use_Bindless_Texture
|
||||||
layout(location = 10) in sampler2D Handle;
|
layout(location = 11) in sampler2D Handle;
|
||||||
layout(location = 11) in sampler2D SecondHandle;
|
layout(location = 12) in sampler2D SecondHandle;
|
||||||
layout(location = 13) in sampler2D ThirdHandle;
|
layout(location = 13) in sampler2D ThirdHandle;
|
||||||
|
layout(location = 14) in sampler2D FourthHandle;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -9,7 +9,7 @@ layout(location = 7) in vec3 Origin;
|
|||||||
layout(location = 8) in vec3 Orientation;
|
layout(location = 8) in vec3 Orientation;
|
||||||
layout(location = 9) in vec3 Scale;
|
layout(location = 9) in vec3 Scale;
|
||||||
#ifdef Use_Bindless_Texture
|
#ifdef Use_Bindless_Texture
|
||||||
layout(location = 10) in uvec2 Handle;
|
layout(location = 11) in uvec2 Handle;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
out vec3 nor;
|
out vec3 nor;
|
||||||
|
@ -10,7 +10,7 @@ layout(location = 7) in vec3 Origin;
|
|||||||
layout(location = 8) in vec3 Orientation;
|
layout(location = 8) in vec3 Orientation;
|
||||||
layout(location = 9) in vec3 Scale;
|
layout(location = 9) in vec3 Scale;
|
||||||
#ifdef Use_Bindless_Texture
|
#ifdef Use_Bindless_Texture
|
||||||
layout(location = 10) in uvec2 Handle;
|
layout(location = 11) in uvec2 Handle;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -8,7 +8,7 @@ layout(location = 7) in vec3 Origin;
|
|||||||
layout(location = 8) in vec3 Orientation;
|
layout(location = 8) in vec3 Orientation;
|
||||||
layout(location = 9) in vec3 Scale;
|
layout(location = 9) in vec3 Scale;
|
||||||
#ifdef Use_Bindless_Texture
|
#ifdef Use_Bindless_Texture
|
||||||
layout(location = 10) in uvec2 Handle;
|
layout(location = 11) in uvec2 Handle;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -41,9 +41,28 @@ template<>
|
|||||||
void InstanceFiller<InstanceDataThreeTex>::add(GLMesh *mesh, scene::ISceneNode *node, InstanceDataThreeTex &instance)
|
void InstanceFiller<InstanceDataThreeTex>::add(GLMesh *mesh, scene::ISceneNode *node, InstanceDataThreeTex &instance)
|
||||||
{
|
{
|
||||||
fillOriginOrientationScale<InstanceDataThreeTex>(node, instance);
|
fillOriginOrientationScale<InstanceDataThreeTex>(node, instance);
|
||||||
|
instance.MiscData.X = 0;
|
||||||
|
instance.MiscData.Y = 0;
|
||||||
|
instance.MiscData.Z = 0;
|
||||||
|
instance.MiscData.W = 0;
|
||||||
|
instance.Texture = mesh->TextureHandles[0];
|
||||||
|
instance.SecondTexture = mesh->TextureHandles[1];
|
||||||
|
instance.ThirdTexture = mesh->TextureHandles[7];
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
template<>
|
||||||
|
void InstanceFiller<InstanceDataFourTex>::add(GLMesh *mesh, scene::ISceneNode *node, InstanceDataFourTex &instance)
|
||||||
|
{
|
||||||
|
fillOriginOrientationScale<InstanceDataFourTex>(node, instance);
|
||||||
|
instance.MiscData.X = 0;
|
||||||
|
instance.MiscData.Y = 0;
|
||||||
|
instance.MiscData.Z = 0;
|
||||||
|
instance.MiscData.W = 0;
|
||||||
instance.Texture = mesh->TextureHandles[0];
|
instance.Texture = mesh->TextureHandles[0];
|
||||||
instance.SecondTexture = mesh->TextureHandles[1];
|
instance.SecondTexture = mesh->TextureHandles[1];
|
||||||
instance.ThirdTexture = mesh->TextureHandles[2];
|
instance.ThirdTexture = mesh->TextureHandles[2];
|
||||||
|
instance.FourthTexture = mesh->TextureHandles[7];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -142,23 +161,27 @@ void SolidCommandBuffer::fill(SolidPassMeshMap *mesh_map)
|
|||||||
mapIndirectBuffer();
|
mapIndirectBuffer();
|
||||||
|
|
||||||
std::vector<int> dual_tex_material_list =
|
std::vector<int> dual_tex_material_list =
|
||||||
|
createVector<int>(Material::SHADERTYPE_VEGETATION);
|
||||||
|
|
||||||
|
fillInstanceData<InstanceDataDualTex, SolidPassMeshMap>
|
||||||
|
(mesh_map, dual_tex_material_list, InstanceTypeDualTex);
|
||||||
|
|
||||||
|
std::vector<int> three_tex_material_list =
|
||||||
createVector<int>(Material::SHADERTYPE_SOLID,
|
createVector<int>(Material::SHADERTYPE_SOLID,
|
||||||
Material::SHADERTYPE_ALPHA_TEST,
|
Material::SHADERTYPE_ALPHA_TEST,
|
||||||
Material::SHADERTYPE_SOLID_UNLIT,
|
Material::SHADERTYPE_SOLID_UNLIT,
|
||||||
Material::SHADERTYPE_SPHERE_MAP,
|
Material::SHADERTYPE_SPHERE_MAP);
|
||||||
Material::SHADERTYPE_VEGETATION);
|
|
||||||
|
|
||||||
fillInstanceData<InstanceDataDualTex, SolidPassMeshMap>
|
|
||||||
(mesh_map, dual_tex_material_list, InstanceTypeDualTex);
|
|
||||||
|
|
||||||
std::vector<int> three_tex_material_list =
|
|
||||||
createVector<int>(Material::SHADERTYPE_DETAIL_MAP,
|
|
||||||
Material::SHADERTYPE_NORMAL_MAP);
|
|
||||||
|
|
||||||
fillInstanceData<InstanceDataThreeTex, SolidPassMeshMap>
|
fillInstanceData<InstanceDataThreeTex, SolidPassMeshMap>
|
||||||
(mesh_map, three_tex_material_list, InstanceTypeThreeTex);
|
(mesh_map, three_tex_material_list, InstanceTypeThreeTex);
|
||||||
|
|
||||||
|
std::vector<int> four_tex_material_list =
|
||||||
|
createVector<int>(Material::SHADERTYPE_DETAIL_MAP,
|
||||||
|
Material::SHADERTYPE_NORMAL_MAP);
|
||||||
|
|
||||||
|
fillInstanceData<InstanceDataFourTex, SolidPassMeshMap>
|
||||||
|
(mesh_map, four_tex_material_list, InstanceTypeFourTex);
|
||||||
|
|
||||||
if (!CVS->supportsAsyncInstanceUpload())
|
if (!CVS->supportsAsyncInstanceUpload())
|
||||||
glUnmapBuffer(GL_DRAW_INDIRECT_BUFFER);
|
glUnmapBuffer(GL_DRAW_INDIRECT_BUFFER);
|
||||||
} //SolidCommandBuffer::fill
|
} //SolidCommandBuffer::fill
|
||||||
|
@ -97,7 +97,7 @@ void FillInstances_impl(InstanceList instance_list,
|
|||||||
{
|
{
|
||||||
scene::ISceneNode *node = instance_list.m_scene_nodes[i];
|
scene::ISceneNode *node = instance_list.m_scene_nodes[i];
|
||||||
InstanceFiller<T>::add(mesh, node, instance_buffer[instance_buffer_offset++]);
|
InstanceFiller<T>::add(mesh, node, instance_buffer[instance_buffer_offset++]);
|
||||||
assert(instance_buffer_offset * sizeof(T) < 10000 * sizeof(InstanceDataDualTex));
|
assert(instance_buffer_offset * sizeof(T) < 10000 * sizeof(InstanceDataThreeTex));
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawElementsIndirectCommand &CurrentCommand = command_buffer[command_buffer_offset++];
|
DrawElementsIndirectCommand &CurrentCommand = command_buffer[command_buffer_offset++];
|
||||||
@ -227,7 +227,7 @@ protected:
|
|||||||
VAOManager::getInstance()->getInstanceBuffer(instance_type));
|
VAOManager::getInstance()->getInstanceBuffer(instance_type));
|
||||||
instance_buffer = (InstanceData*)
|
instance_buffer = (InstanceData*)
|
||||||
glMapBufferRange(GL_ARRAY_BUFFER, 0,
|
glMapBufferRange(GL_ARRAY_BUFFER, 0,
|
||||||
10000 * sizeof(InstanceDataDualTex),
|
10000 * sizeof(InstanceDataThreeTex),
|
||||||
GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -636,7 +636,7 @@ struct DefaultMaterial
|
|||||||
static const enum video::E_VERTEX_TYPE VertexType = video::EVT_STANDARD;
|
static const enum video::E_VERTEX_TYPE VertexType = video::EVT_STANDARD;
|
||||||
static const enum Material::ShaderType MaterialType
|
static const enum Material::ShaderType MaterialType
|
||||||
= Material::SHADERTYPE_SOLID;
|
= Material::SHADERTYPE_SOLID;
|
||||||
static const enum InstanceType Instance = InstanceTypeDualTex;
|
static const enum InstanceType Instance = InstanceTypeThreeTex;
|
||||||
static const STK::Tuple<size_t> FirstPassTextures;
|
static const STK::Tuple<size_t> FirstPassTextures;
|
||||||
static const STK::Tuple<size_t, size_t, size_t> SecondPassTextures;
|
static const STK::Tuple<size_t, size_t, size_t> SecondPassTextures;
|
||||||
static const STK::Tuple<> ShadowTextures;
|
static const STK::Tuple<> ShadowTextures;
|
||||||
@ -657,7 +657,7 @@ struct AlphaRef
|
|||||||
typedef ListMatAlphaRef List;
|
typedef ListMatAlphaRef List;
|
||||||
static const enum video::E_VERTEX_TYPE VertexType = video::EVT_STANDARD;
|
static const enum video::E_VERTEX_TYPE VertexType = video::EVT_STANDARD;
|
||||||
static const enum Material::ShaderType MaterialType = Material::SHADERTYPE_ALPHA_TEST;
|
static const enum Material::ShaderType MaterialType = Material::SHADERTYPE_ALPHA_TEST;
|
||||||
static const enum InstanceType Instance = InstanceTypeDualTex;
|
static const enum InstanceType Instance = InstanceTypeThreeTex;
|
||||||
static const STK::Tuple<size_t, size_t> FirstPassTextures;
|
static const STK::Tuple<size_t, size_t> FirstPassTextures;
|
||||||
static const STK::Tuple<size_t, size_t> SecondPassTextures;
|
static const STK::Tuple<size_t, size_t> SecondPassTextures;
|
||||||
static const STK::Tuple<size_t> ShadowTextures;
|
static const STK::Tuple<size_t> ShadowTextures;
|
||||||
@ -679,7 +679,7 @@ struct SphereMap
|
|||||||
static const enum video::E_VERTEX_TYPE VertexType = video::EVT_STANDARD;
|
static const enum video::E_VERTEX_TYPE VertexType = video::EVT_STANDARD;
|
||||||
static const enum Material::ShaderType MaterialType
|
static const enum Material::ShaderType MaterialType
|
||||||
= Material::SHADERTYPE_SPHERE_MAP;
|
= Material::SHADERTYPE_SPHERE_MAP;
|
||||||
static const enum InstanceType Instance = InstanceTypeDualTex;
|
static const enum InstanceType Instance = InstanceTypeThreeTex;
|
||||||
static const STK::Tuple<size_t> FirstPassTextures;
|
static const STK::Tuple<size_t> FirstPassTextures;
|
||||||
static const STK::Tuple<size_t> SecondPassTextures;
|
static const STK::Tuple<size_t> SecondPassTextures;
|
||||||
static const STK::Tuple<> ShadowTextures;
|
static const STK::Tuple<> ShadowTextures;
|
||||||
@ -701,7 +701,7 @@ struct UnlitMat
|
|||||||
static const enum video::E_VERTEX_TYPE VertexType = video::EVT_STANDARD;
|
static const enum video::E_VERTEX_TYPE VertexType = video::EVT_STANDARD;
|
||||||
static const enum Material::ShaderType MaterialType =
|
static const enum Material::ShaderType MaterialType =
|
||||||
Material::SHADERTYPE_SOLID_UNLIT;
|
Material::SHADERTYPE_SOLID_UNLIT;
|
||||||
static const enum InstanceType Instance = InstanceTypeDualTex;
|
static const enum InstanceType Instance = InstanceTypeThreeTex;
|
||||||
static const STK::Tuple<size_t, size_t> FirstPassTextures;
|
static const STK::Tuple<size_t, size_t> FirstPassTextures;
|
||||||
static const STK::Tuple<size_t> SecondPassTextures;
|
static const STK::Tuple<size_t> SecondPassTextures;
|
||||||
static const STK::Tuple<size_t> ShadowTextures;
|
static const STK::Tuple<size_t> ShadowTextures;
|
||||||
@ -745,7 +745,7 @@ struct NormalMat
|
|||||||
static const enum video::E_VERTEX_TYPE VertexType = video::EVT_TANGENTS;
|
static const enum video::E_VERTEX_TYPE VertexType = video::EVT_TANGENTS;
|
||||||
static const enum Material::ShaderType MaterialType
|
static const enum Material::ShaderType MaterialType
|
||||||
= Material::SHADERTYPE_NORMAL_MAP;
|
= Material::SHADERTYPE_NORMAL_MAP;
|
||||||
static const enum InstanceType Instance = InstanceTypeThreeTex;
|
static const enum InstanceType Instance = InstanceTypeFourTex;
|
||||||
static const STK::Tuple<size_t, size_t> FirstPassTextures;
|
static const STK::Tuple<size_t, size_t> FirstPassTextures;
|
||||||
static const STK::Tuple<size_t, size_t, size_t> SecondPassTextures;
|
static const STK::Tuple<size_t, size_t, size_t> SecondPassTextures;
|
||||||
static const STK::Tuple<> ShadowTextures;
|
static const STK::Tuple<> ShadowTextures;
|
||||||
@ -767,7 +767,7 @@ struct DetailMat
|
|||||||
static const enum video::E_VERTEX_TYPE VertexType = video::EVT_2TCOORDS;
|
static const enum video::E_VERTEX_TYPE VertexType = video::EVT_2TCOORDS;
|
||||||
static const enum Material::ShaderType MaterialType
|
static const enum Material::ShaderType MaterialType
|
||||||
= Material::SHADERTYPE_DETAIL_MAP;
|
= Material::SHADERTYPE_DETAIL_MAP;
|
||||||
static const enum InstanceType Instance = InstanceTypeThreeTex;
|
static const enum InstanceType Instance = InstanceTypeFourTex;
|
||||||
static const STK::Tuple<size_t> FirstPassTextures;
|
static const STK::Tuple<size_t> FirstPassTextures;
|
||||||
static const STK::Tuple<size_t, size_t, size_t> SecondPassTextures;
|
static const STK::Tuple<size_t, size_t, size_t> SecondPassTextures;
|
||||||
static const STK::Tuple<> ShadowTextures;
|
static const STK::Tuple<> ShadowTextures;
|
||||||
|
@ -42,13 +42,13 @@ VAOManager::VAOManager()
|
|||||||
#if !defined(USE_GLES2)
|
#if !defined(USE_GLES2)
|
||||||
if (CVS->supportsAsyncInstanceUpload())
|
if (CVS->supportsAsyncInstanceUpload())
|
||||||
{
|
{
|
||||||
glBufferStorage(GL_ARRAY_BUFFER, 10000 * sizeof(InstanceDataDualTex), 0, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT);
|
glBufferStorage(GL_ARRAY_BUFFER, 10000 * sizeof(InstanceDataThreeTex), 0, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT);
|
||||||
Ptr[i] = glMapBufferRange(GL_ARRAY_BUFFER, 0, 10000 * sizeof(InstanceDataDualTex), GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT);
|
Ptr[i] = glMapBufferRange(GL_ARRAY_BUFFER, 0, 10000 * sizeof(InstanceDataThreeTex), GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
glBufferData(GL_ARRAY_BUFFER, 10000 * sizeof(InstanceDataDualTex), 0, GL_STREAM_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, 10000 * sizeof(InstanceDataThreeTex), 0, GL_STREAM_DRAW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,21 +158,21 @@ template<>
|
|||||||
void VAOInstanceUtil<InstanceDataSingleTex>::SetVertexAttrib()
|
void VAOInstanceUtil<InstanceDataSingleTex>::SetVertexAttrib()
|
||||||
{
|
{
|
||||||
SetVertexAttrib_impl();
|
SetVertexAttrib_impl();
|
||||||
glEnableVertexAttribArray(10);
|
glEnableVertexAttribArray(11);
|
||||||
glVertexAttribIPointer(10, 2, GL_UNSIGNED_INT, sizeof(InstanceDataSingleTex), (GLvoid*)(9 * sizeof(float)));
|
glVertexAttribIPointer(11, 2, GL_UNSIGNED_INT, sizeof(InstanceDataSingleTex), (GLvoid*)(9 * sizeof(float)));
|
||||||
glVertexAttribDivisorARB(10, 1);
|
glVertexAttribDivisorARB(11, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void VAOInstanceUtil<InstanceDataDualTex>::SetVertexAttrib()
|
void VAOInstanceUtil<InstanceDataDualTex>::SetVertexAttrib()
|
||||||
{
|
{
|
||||||
SetVertexAttrib_impl();
|
SetVertexAttrib_impl();
|
||||||
glEnableVertexAttribArray(10);
|
|
||||||
glVertexAttribIPointer(10, 2, GL_UNSIGNED_INT, sizeof(InstanceDataDualTex), (GLvoid*)(9 * sizeof(float)));
|
|
||||||
glVertexAttribDivisorARB(10, 1);
|
|
||||||
glEnableVertexAttribArray(11);
|
glEnableVertexAttribArray(11);
|
||||||
glVertexAttribIPointer(11, 2, GL_UNSIGNED_INT, sizeof(InstanceDataDualTex), (GLvoid*)(9 * sizeof(float) + 2 * sizeof(unsigned)));
|
glVertexAttribIPointer(11, 2, GL_UNSIGNED_INT, sizeof(InstanceDataDualTex), (GLvoid*)(9 * sizeof(float)));
|
||||||
glVertexAttribDivisorARB(11, 1);
|
glVertexAttribDivisorARB(11, 1);
|
||||||
|
glEnableVertexAttribArray(12);
|
||||||
|
glVertexAttribIPointer(12, 2, GL_UNSIGNED_INT, sizeof(InstanceDataDualTex), (GLvoid*)(9 * sizeof(float) + 2 * sizeof(unsigned)));
|
||||||
|
glVertexAttribDivisorARB(12, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
@ -180,23 +180,47 @@ void VAOInstanceUtil<InstanceDataThreeTex>::SetVertexAttrib()
|
|||||||
{
|
{
|
||||||
SetVertexAttrib_impl();
|
SetVertexAttrib_impl();
|
||||||
glEnableVertexAttribArray(10);
|
glEnableVertexAttribArray(10);
|
||||||
glVertexAttribIPointer(10, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(9 * sizeof(float)));
|
glVertexAttribPointer(10, 4, GL_FLOAT, GL_FALSE, sizeof(InstanceDataThreeTex), (GLvoid*)(9 * sizeof(float)));
|
||||||
|
glVertexAttribDivisorARB(10, 1);
|
||||||
|
glEnableVertexAttribArray(12);
|
||||||
|
glVertexAttribIPointer(12, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(13 * sizeof(float)));
|
||||||
|
glVertexAttribDivisorARB(12, 1);
|
||||||
|
glEnableVertexAttribArray(13);
|
||||||
|
glVertexAttribIPointer(13, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(13 * sizeof(float) + 2 * sizeof(unsigned)));
|
||||||
|
glVertexAttribDivisorARB(13, 1);
|
||||||
|
glEnableVertexAttribArray(14);
|
||||||
|
glVertexAttribIPointer(14, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(13 * sizeof(float) + 4 * sizeof(unsigned)));
|
||||||
|
glVertexAttribDivisorARB(14, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void VAOInstanceUtil<InstanceDataFourTex>::SetVertexAttrib()
|
||||||
|
{
|
||||||
|
SetVertexAttrib_impl();
|
||||||
|
glEnableVertexAttribArray(10);
|
||||||
|
glVertexAttribPointer(10, 4, GL_FLOAT, GL_FALSE, sizeof(InstanceDataFourTex), (GLvoid*)(9 * sizeof(float)));
|
||||||
glVertexAttribDivisorARB(10, 1);
|
glVertexAttribDivisorARB(10, 1);
|
||||||
glEnableVertexAttribArray(11);
|
glEnableVertexAttribArray(11);
|
||||||
glVertexAttribIPointer(11, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(9 * sizeof(float) + 2 * sizeof(unsigned)));
|
glVertexAttribIPointer(11, 2, GL_UNSIGNED_INT, sizeof(InstanceDataFourTex), (GLvoid*)(13 * sizeof(float)));
|
||||||
glVertexAttribDivisorARB(11, 1);
|
glVertexAttribDivisorARB(11, 1);
|
||||||
|
glEnableVertexAttribArray(12);
|
||||||
|
glVertexAttribIPointer(12, 2, GL_UNSIGNED_INT, sizeof(InstanceDataFourTex), (GLvoid*)(13 * sizeof(float) + 2 * sizeof(unsigned)));
|
||||||
|
glVertexAttribDivisorARB(12, 1);
|
||||||
glEnableVertexAttribArray(13);
|
glEnableVertexAttribArray(13);
|
||||||
glVertexAttribIPointer(13, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(9 * sizeof(float) + 4 * sizeof(unsigned)));
|
glVertexAttribIPointer(13, 2, GL_UNSIGNED_INT, sizeof(InstanceDataFourTex), (GLvoid*)(13 * sizeof(float) + 4 * sizeof(unsigned)));
|
||||||
glVertexAttribDivisorARB(13, 1);
|
glVertexAttribDivisorARB(13, 1);
|
||||||
|
glEnableVertexAttribArray(14);
|
||||||
|
glVertexAttribIPointer(14, 2, GL_UNSIGNED_INT, sizeof(InstanceDataFourTex), (GLvoid*)(13 * sizeof(float) + 6 * sizeof(unsigned)));
|
||||||
|
glVertexAttribDivisorARB(14, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void VAOInstanceUtil<GlowInstanceData>::SetVertexAttrib()
|
void VAOInstanceUtil<GlowInstanceData>::SetVertexAttrib()
|
||||||
{
|
{
|
||||||
SetVertexAttrib_impl();
|
SetVertexAttrib_impl();
|
||||||
glEnableVertexAttribArray(12);
|
glEnableVertexAttribArray(15);
|
||||||
glVertexAttribPointer(12, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(GlowInstanceData), (GLvoid*)(9 * sizeof(float)));
|
glVertexAttribPointer(15, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(GlowInstanceData), (GLvoid*)(9 * sizeof(float)));
|
||||||
glVertexAttribDivisorARB(12, 1);
|
glVertexAttribDivisorARB(15, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -220,6 +244,11 @@ void VAOManager::regenerateInstancedVAO()
|
|||||||
VAOInstanceUtil<InstanceDataThreeTex>::SetVertexAttrib();
|
VAOInstanceUtil<InstanceDataThreeTex>::SetVertexAttrib();
|
||||||
InstanceVAO[std::pair<video::E_VERTEX_TYPE, InstanceType>(tp, InstanceTypeThreeTex)] = vao;
|
InstanceVAO[std::pair<video::E_VERTEX_TYPE, InstanceType>(tp, InstanceTypeThreeTex)] = vao;
|
||||||
|
|
||||||
|
vao = createVAO(vbo[tp], ibo[tp], tp);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, instance_vbo[InstanceTypeFourTex]);
|
||||||
|
VAOInstanceUtil<InstanceDataFourTex>::SetVertexAttrib();
|
||||||
|
InstanceVAO[std::pair<video::E_VERTEX_TYPE, InstanceType>(tp, InstanceTypeFourTex)] = vao;
|
||||||
|
|
||||||
vao = createVAO(vbo[tp], ibo[tp], tp);
|
vao = createVAO(vbo[tp], ibo[tp], tp);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, instance_vbo[InstanceTypeShadow]);
|
glBindBuffer(GL_ARRAY_BUFFER, instance_vbo[InstanceTypeShadow]);
|
||||||
VAOInstanceUtil<InstanceDataSingleTex>::SetVertexAttrib();
|
VAOInstanceUtil<InstanceDataSingleTex>::SetVertexAttrib();
|
||||||
|
@ -32,6 +32,7 @@ enum InstanceType
|
|||||||
{
|
{
|
||||||
InstanceTypeDualTex,
|
InstanceTypeDualTex,
|
||||||
InstanceTypeThreeTex,
|
InstanceTypeThreeTex,
|
||||||
|
InstanceTypeFourTex,
|
||||||
InstanceTypeShadow,
|
InstanceTypeShadow,
|
||||||
InstanceTypeRSM,
|
InstanceTypeRSM,
|
||||||
InstanceTypeGlow,
|
InstanceTypeGlow,
|
||||||
@ -116,6 +117,13 @@ struct InstanceDataThreeTex
|
|||||||
float Y;
|
float Y;
|
||||||
float Z;
|
float Z;
|
||||||
} Scale;
|
} Scale;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
float X;
|
||||||
|
float Y;
|
||||||
|
float Z;
|
||||||
|
float W;
|
||||||
|
} MiscData;
|
||||||
uint64_t Texture;
|
uint64_t Texture;
|
||||||
uint64_t SecondTexture;
|
uint64_t SecondTexture;
|
||||||
uint64_t ThirdTexture;
|
uint64_t ThirdTexture;
|
||||||
@ -125,6 +133,43 @@ struct InstanceDataThreeTex
|
|||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
struct InstanceDataFourTex
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
float X;
|
||||||
|
float Y;
|
||||||
|
float Z;
|
||||||
|
} Origin;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
float X;
|
||||||
|
float Y;
|
||||||
|
float Z;
|
||||||
|
} Orientation;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
float X;
|
||||||
|
float Y;
|
||||||
|
float Z;
|
||||||
|
} Scale;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
float X;
|
||||||
|
float Y;
|
||||||
|
float Z;
|
||||||
|
float W;
|
||||||
|
} MiscData;
|
||||||
|
uint64_t Texture;
|
||||||
|
uint64_t SecondTexture;
|
||||||
|
uint64_t ThirdTexture;
|
||||||
|
uint64_t FourthTexture;
|
||||||
|
#ifdef WIN32
|
||||||
|
};
|
||||||
|
#else
|
||||||
|
} __attribute__((packed));
|
||||||
|
#endif
|
||||||
|
|
||||||
struct GlowInstanceData
|
struct GlowInstanceData
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
|
Loading…
Reference in New Issue
Block a user