Fix AZDO with colorization
Also re-arrange texture layer
This commit is contained in:
parent
5884d7b9d8
commit
9e8fb63dc4
@ -7,7 +7,7 @@ uniform sampler2D SpecMap;
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat in sampler2D handle;
|
||||
flat in sampler2D secondhandle;
|
||||
flat in sampler2D thirdhandle;
|
||||
flat in sampler2D fourthhandle;
|
||||
#endif
|
||||
in vec2 uv;
|
||||
in vec2 uv_bis;
|
||||
@ -23,7 +23,7 @@ void main(void)
|
||||
#ifdef SRGBBindlessFix
|
||||
color.xyz = pow(color.xyz, vec3(2.2));
|
||||
#endif
|
||||
vec4 detail = texture(thirdhandle, uv_bis);
|
||||
vec4 detail = texture(fourthhandle, uv_bis);
|
||||
#else
|
||||
vec4 color = texture(Albedo, uv);
|
||||
vec4 detail = texture(Detail, uv_bis);
|
||||
|
@ -5,7 +5,7 @@ uniform sampler2D glossMap;
|
||||
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat in sampler2D secondhandle;
|
||||
flat in sampler2D thirdhandle;
|
||||
flat in sampler2D fourthhandle;
|
||||
#endif
|
||||
in vec3 tangent;
|
||||
in vec3 bitangent;
|
||||
@ -18,7 +18,7 @@ void main()
|
||||
{
|
||||
// normal in Tangent Space
|
||||
#ifdef Use_Bindless_Texture
|
||||
vec3 TS_normal = 2.0 * texture(thirdhandle, uv).rgb - 1.0;
|
||||
vec3 TS_normal = 2.0 * texture(fourthhandle, uv).rgb - 1.0;
|
||||
float gloss = texture(secondhandle, uv).x;
|
||||
#else
|
||||
vec3 TS_normal = 2.0 * texture(normalMap, uv).rgb - 1.0;
|
||||
|
@ -7,7 +7,7 @@ uniform sampler2D colorization_mask;
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat in sampler2D handle;
|
||||
flat in sampler2D secondhandle;
|
||||
flat in sampler2D fourthhandle;
|
||||
flat in sampler2D thirdhandle;
|
||||
#endif
|
||||
|
||||
in vec2 uv;
|
||||
@ -24,7 +24,7 @@ void main(void)
|
||||
vec4 col = texture(handle, uv);
|
||||
float specmap = texture(secondhandle, uv).g;
|
||||
float emitmap = texture(secondhandle, uv).b;
|
||||
float mask = texture(fourthhandle, uv).a;
|
||||
float mask = texture(thirdhandle, uv).a;
|
||||
#ifdef SRGBBindlessFix
|
||||
col.xyz = pow(col.xyz, vec3(2.2));
|
||||
#endif
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(bindless_sampler) uniform sampler2D Albedo;
|
||||
layout(bindless_sampler) uniform sampler2D SpecMap;
|
||||
layout(bindless_sampler) uniform sampler2D colorization_mask;
|
||||
|
||||
#else
|
||||
uniform sampler2D Albedo;
|
||||
uniform sampler2D SpecMap;
|
||||
@ -20,6 +22,7 @@ void main(void)
|
||||
{
|
||||
#ifdef Use_Bindless_Texture
|
||||
vec4 col = texture(Albedo, uv);
|
||||
float mask = texture(colorization_mask, uv).a;
|
||||
#ifdef SRGBBindlessFix
|
||||
col.xyz = pow(col.xyz, vec3(2.2));
|
||||
#endif
|
||||
|
@ -53,7 +53,7 @@ void InstanceFiller<InstanceDataThreeTex>::add(GLMesh* mesh,
|
||||
instance.MiscData.W = STK::tuple_get<2>(is).Y;
|
||||
instance.Texture = mesh->TextureHandles[0];
|
||||
instance.SecondTexture = mesh->TextureHandles[1];
|
||||
instance.ThirdTexture = mesh->TextureHandles[7];
|
||||
instance.ThirdTexture = mesh->TextureHandles[2];
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -70,7 +70,7 @@ void InstanceFiller<InstanceDataFourTex>::add(GLMesh* mesh,
|
||||
instance.Texture = mesh->TextureHandles[0];
|
||||
instance.SecondTexture = mesh->TextureHandles[1];
|
||||
instance.ThirdTexture = mesh->TextureHandles[2];
|
||||
instance.FourthTexture = mesh->TextureHandles[7];
|
||||
instance.FourthTexture = mesh->TextureHandles[3];
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -698,7 +698,7 @@ void IrrDriver::createSunInterposer()
|
||||
getUnicolorTexture(video::SColor(255, 255, 255, 255)));
|
||||
mb->getMaterial().setTexture(1,
|
||||
getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
mb->getMaterial().setTexture(7,
|
||||
mb->getMaterial().setTexture(2,
|
||||
getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
}
|
||||
m_sun_interposer = new STKMeshSceneNode(sphere,
|
||||
@ -1141,7 +1141,7 @@ scene::IMeshSceneNode *IrrDriver::addSphere(float radius,
|
||||
//m.setTexture(0, getUnicolorTexture(video::SColor(128, 255, 105, 180)));
|
||||
m.setTexture(0, getUnicolorTexture(color));
|
||||
m.setTexture(1, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
m.setTexture(7, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
m.setTexture(2, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
|
||||
if (CVS->isGLSL())
|
||||
{
|
||||
|
@ -733,7 +733,7 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
glossytex = getUnicolorTexture(SColor(0, 0, 0, 0));
|
||||
}
|
||||
|
||||
if (!m->getTexture(7))
|
||||
if (!m->getTexture(2))
|
||||
{
|
||||
// Only set colorization mask if not set
|
||||
ITexture *colorization_mask_tex = getUnicolorTexture(SColor(0, 0, 0, 0));
|
||||
@ -741,7 +741,7 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
{
|
||||
colorization_mask_tex = irr_driver->getTexture(m_colorization_mask);
|
||||
}
|
||||
m->setTexture(7, colorization_mask_tex);
|
||||
m->setTexture(2, colorization_mask_tex);
|
||||
}
|
||||
|
||||
|
||||
@ -796,26 +796,26 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
return;
|
||||
case SHADERTYPE_SPLATTING:
|
||||
tex = irr_driver->getTexture(m_splatting_texture_1);
|
||||
m->setTexture(2, tex);
|
||||
m->setTexture(3, tex);
|
||||
|
||||
if (m_splatting_texture_2.size() > 0)
|
||||
{
|
||||
tex = irr_driver->getTexture(m_splatting_texture_2);
|
||||
}
|
||||
m->setTexture(3, tex);
|
||||
m->setTexture(4, tex);
|
||||
|
||||
if (m_splatting_texture_3.size() > 0)
|
||||
{
|
||||
tex = irr_driver->getTexture(m_splatting_texture_3);
|
||||
}
|
||||
m->setTexture(4, tex);
|
||||
m->setTexture(5, tex);
|
||||
|
||||
if (m_splatting_texture_4.size() > 0)
|
||||
{
|
||||
tex = irr_driver->getTexture(m_splatting_texture_4);
|
||||
}
|
||||
m->setTexture(5, tex);
|
||||
m->setTexture(6, glossytex);
|
||||
m->setTexture(6, tex);
|
||||
m->setTexture(7, glossytex);
|
||||
|
||||
// Material and shaders
|
||||
m->MaterialType = Shaders::getShader(ES_SPLATTING);
|
||||
@ -850,7 +850,7 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
if (m_normal_map_tex.size() > 0)
|
||||
{
|
||||
tex = irr_driver->getTexture(m_normal_map_tex);
|
||||
m->setTexture(2, tex);
|
||||
m->setTexture(3, tex);
|
||||
|
||||
// Material and shaders
|
||||
m->MaterialType = Shaders::getShader(ES_NORMAL_MAP);
|
||||
@ -863,9 +863,9 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
if (mb && mb->getVertexType() == video::EVT_2TCOORDS)
|
||||
{
|
||||
if (m->getTexture(1) != glossytex)
|
||||
m->setTexture(2, m->getTexture(1));
|
||||
if (!m->getTexture(2))
|
||||
m->setTexture(2, getUnicolorTexture(SColor(255, 255, 255, 255)));
|
||||
m->setTexture(3, m->getTexture(1));
|
||||
if (!m->getTexture(3))
|
||||
m->setTexture(3, getUnicolorTexture(SColor(255, 255, 255, 255)));
|
||||
}
|
||||
m->setTexture(1, glossytex);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
const STK::Tuple<size_t> DefaultMaterial::FirstPassTextures
|
||||
= STK::Tuple<size_t>(1);
|
||||
const STK::Tuple<size_t, size_t, size_t> DefaultMaterial::SecondPassTextures
|
||||
= STK::Tuple<size_t, size_t, size_t>(0, 1, 7);
|
||||
= STK::Tuple<size_t, size_t, size_t>(0, 1, 2);
|
||||
const STK::Tuple<> DefaultMaterial::ShadowTextures;
|
||||
const STK::Tuple<size_t> DefaultMaterial::RSMTextures = STK::Tuple<size_t>(0);
|
||||
|
||||
@ -55,24 +55,24 @@ const STK::Tuple<size_t> GrassMat::RSMTextures = STK::Tuple<size_t>(0);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
const STK::Tuple<size_t, size_t> NormalMat::FirstPassTextures
|
||||
= STK::Tuple<size_t, size_t>(2, 1);
|
||||
= STK::Tuple<size_t, size_t>(3, 1);
|
||||
const STK::Tuple<size_t, size_t, size_t> NormalMat::SecondPassTextures
|
||||
= STK::Tuple<size_t, size_t, size_t>(0, 1, 7);
|
||||
= STK::Tuple<size_t, size_t, size_t>(0, 1, 2);
|
||||
const STK::Tuple<> NormalMat::ShadowTextures;
|
||||
const STK::Tuple<size_t> NormalMat::RSMTextures = STK::Tuple<size_t>(0);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
const STK::Tuple<size_t> DetailMat::FirstPassTextures = STK::Tuple<size_t>(1);
|
||||
const STK::Tuple<size_t, size_t, size_t> DetailMat::SecondPassTextures
|
||||
= STK::Tuple<size_t, size_t, size_t>(0, 2, 1);
|
||||
= STK::Tuple<size_t, size_t, size_t>(0, 3, 1);
|
||||
const STK::Tuple<> DetailMat::ShadowTextures;
|
||||
const STK::Tuple<size_t> DetailMat::RSMTextures = STK::Tuple<size_t>(0);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
const STK::Tuple<size_t> SplattingMat::FirstPassTextures = STK::Tuple<size_t>(6);
|
||||
const STK::Tuple<size_t> SplattingMat::FirstPassTextures = STK::Tuple<size_t>(7);
|
||||
const STK::Tuple<size_t, size_t, size_t, size_t, size_t>
|
||||
SplattingMat::SecondPassTextures
|
||||
= STK::Tuple<size_t, size_t, size_t, size_t, size_t>(1, 2, 3, 4, 5);
|
||||
= STK::Tuple<size_t, size_t, size_t, size_t, size_t>(1, 3, 4, 5, 6);
|
||||
const STK::Tuple<> SplattingMat::ShadowTextures;
|
||||
const STK::Tuple<size_t, size_t, size_t, size_t, size_t> SplattingMat::RSMTextures
|
||||
= STK::Tuple<size_t, size_t, size_t, size_t, size_t>(1, 2, 3, 4, 5);
|
||||
= STK::Tuple<size_t, size_t, size_t, size_t, size_t>(1, 3, 4, 5, 6);
|
||||
|
@ -67,7 +67,7 @@ void ShowCurve::addEmptyMesh()
|
||||
m_buffer = m_mesh->getMeshBuffer(0);
|
||||
m_buffer->getMaterial().setTexture(0, getUnicolorTexture(video::SColor(128, 255, 105, 180)));
|
||||
m_buffer->getMaterial().setTexture(1, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
m_buffer->getMaterial().setTexture(7, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
m_buffer->getMaterial().setTexture(2, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
|
||||
assert(m_buffer->getVertexType()==video::EVT_STANDARD);
|
||||
} // addEmptyMesh
|
||||
|
@ -409,14 +409,14 @@ void initTextures(GLMesh &mesh, Material::ShaderType mat)
|
||||
case Material::SHADERTYPE_SOLID_UNLIT:
|
||||
setTexture(mesh, 0, true, getShaderTypeName(mat));
|
||||
setTexture(mesh, 1, false, getShaderTypeName(mat));
|
||||
setTexture(mesh, 7, false, getShaderTypeName(mat));
|
||||
setTexture(mesh, 2, false, getShaderTypeName(mat));
|
||||
break;
|
||||
case Material::SHADERTYPE_DETAIL_MAP:
|
||||
case Material::SHADERTYPE_NORMAL_MAP:
|
||||
setTexture(mesh, 0, true, getShaderTypeName(mat));
|
||||
setTexture(mesh, 1, false, getShaderTypeName(mat));
|
||||
setTexture(mesh, 2, false, getShaderTypeName(mat));
|
||||
setTexture(mesh, 7, false, getShaderTypeName(mat));
|
||||
setTexture(mesh, 3, false, getShaderTypeName(mat));
|
||||
break;
|
||||
case Material::SHADERTYPE_SPLATTING:
|
||||
setTexture(mesh, 0, true, getShaderTypeName(mat));
|
||||
@ -426,6 +426,7 @@ void initTextures(GLMesh &mesh, Material::ShaderType mat)
|
||||
setTexture(mesh, 4, true, getShaderTypeName(mat));
|
||||
setTexture(mesh, 5, true, getShaderTypeName(mat));
|
||||
setTexture(mesh, 6, false, getShaderTypeName(mat));
|
||||
setTexture(mesh, 7, false, getShaderTypeName(mat));
|
||||
break;
|
||||
}
|
||||
} // initTextures
|
||||
|
@ -57,7 +57,7 @@ struct GLMesh
|
||||
size_t vaoBaseVertex;
|
||||
size_t vaoOffset;
|
||||
video::E_VERTEX_TYPE VAOType;
|
||||
uint64_t TextureHandles[6];
|
||||
uint64_t TextureHandles[8];
|
||||
scene::IMeshBuffer *mb;
|
||||
RenderInfo* m_render_info;
|
||||
Material* m_material;
|
||||
|
@ -122,7 +122,7 @@ scene::IMesh* STKTextBillboard::getTextMesh(core::stringw text, FontWithFace* fo
|
||||
buffer = new scene::SMeshBuffer();
|
||||
buffer->getMaterial().setTexture(0, m_chars[i].m_texture);
|
||||
buffer->getMaterial().setTexture(1, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
buffer->getMaterial().setTexture(7, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
buffer->getMaterial().setTexture(2, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
buffer->getMaterial().MaterialType = Shaders::getShader(ES_OBJECT_UNLIT);
|
||||
buffers[m_chars[i].m_texture] = buffer;
|
||||
}
|
||||
|
@ -182,15 +182,15 @@ void VAOInstanceUtil<InstanceDataThreeTex>::SetVertexAttrib()
|
||||
glEnableVertexAttribArray(10);
|
||||
glVertexAttribPointer(10, 4, GL_FLOAT, GL_FALSE, sizeof(InstanceDataThreeTex), (GLvoid*)(9 * sizeof(float)));
|
||||
glVertexAttribDivisorARB(10, 1);
|
||||
glEnableVertexAttribArray(11);
|
||||
glVertexAttribIPointer(11, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(13 * sizeof(float)));
|
||||
glVertexAttribDivisorARB(11, 1);
|
||||
glEnableVertexAttribArray(12);
|
||||
glVertexAttribIPointer(12, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(13 * sizeof(float)));
|
||||
glVertexAttribIPointer(12, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(13 * sizeof(float) + 2 * sizeof(unsigned)));
|
||||
glVertexAttribDivisorARB(12, 1);
|
||||
glEnableVertexAttribArray(13);
|
||||
glVertexAttribIPointer(13, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(13 * sizeof(float) + 2 * sizeof(unsigned)));
|
||||
glVertexAttribIPointer(13, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(13 * sizeof(float) + 4 * 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<>
|
||||
|
@ -73,7 +73,7 @@ RubberBand::RubberBand(Plunger *plunger, AbstractKart *kart)
|
||||
// Gloss
|
||||
mb->getMaterial().setTexture(1, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
// Colorization mask
|
||||
mb->getMaterial().setTexture(7, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
mb->getMaterial().setTexture(2, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
updatePosition();
|
||||
m_node = irr_driver->addMesh(m_mesh, "rubberband");
|
||||
irr_driver->applyObjectPassShader(m_node);
|
||||
|
@ -104,7 +104,7 @@ CheckLine::CheckLine(const XMLNode &node, unsigned int index)
|
||||
buffer->recalculateBoundingBox();
|
||||
buffer->getMaterial().setTexture(0, getUnicolorTexture(video::SColor(128, 255, 105, 180)));
|
||||
buffer->getMaterial().setTexture(1, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
buffer->getMaterial().setTexture(7, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
buffer->getMaterial().setTexture(2, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
buffer->getMaterial().BackfaceCulling = false;
|
||||
//mesh->setBoundingBox(buffer->getBoundingBox());
|
||||
m_debug_node = irr_driver->addMesh(mesh, "checkdebug");
|
||||
|
@ -109,7 +109,7 @@ void Graph::createMesh(bool show_invisible, bool enable_transparency,
|
||||
m.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
m.setTexture(0, getUnicolorTexture(video::SColor(255, 255, 255, 255)));
|
||||
m.setTexture(1, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
m.setTexture(7, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
m.setTexture(2, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
m_mesh = irr_driver->createQuadMesh(&m);
|
||||
m_mesh_buffer = m_mesh->getMeshBuffer(0);
|
||||
assert(m_mesh_buffer->getVertexType()==video::EVT_STANDARD);
|
||||
|
@ -792,7 +792,7 @@ void Track::createPhysicsModel(unsigned int main_track_count)
|
||||
// Gloss
|
||||
mb->getMaterial().setTexture(1, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
// Colorization mask
|
||||
mb->getMaterial().setTexture(7, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
mb->getMaterial().setTexture(2, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
|
||||
}
|
||||
else
|
||||
irr_driver->removeNode(m_static_physics_only_nodes[i]);
|
||||
|
Loading…
Reference in New Issue
Block a user