Use a more simple way to render red/blue karts
This commit is contained in:
parent
7e806fe86f
commit
416050a923
@ -7,11 +7,16 @@ uniform sampler2D SpecMap;
|
||||
flat in sampler2D handle;
|
||||
flat in sampler2D secondhandle;
|
||||
#endif
|
||||
|
||||
uniform vec2 color_change;
|
||||
|
||||
in vec2 uv;
|
||||
in vec4 color;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
float rgbToValue(vec3 c);
|
||||
vec3 hsvToRgb(vec3 c);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
@ -27,7 +32,14 @@ void main(void)
|
||||
float specmap = texture(SpecMap, uv).g;
|
||||
float emitmap = texture(SpecMap, uv).b;
|
||||
#endif
|
||||
|
||||
if (color_change.x > 0)
|
||||
{
|
||||
vec3 new_color = hsvToRgb(vec3(color_change.x, color_change.y, rgbToValue(col.rgb)));
|
||||
col = vec4(new_color.b, new_color.g, new_color.r, col.a);
|
||||
}
|
||||
|
||||
col.xyz *= pow(color.xyz, vec3(2.2));
|
||||
|
||||
|
||||
FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap, emitmap) , 1.);
|
||||
}
|
||||
|
@ -1,39 +0,0 @@
|
||||
#ifndef Use_Bindless_Texture
|
||||
uniform sampler2D Albedo;
|
||||
uniform sampler2D SpecMap;
|
||||
#endif
|
||||
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat in sampler2D handle;
|
||||
flat in sampler2D secondhandle;
|
||||
#endif
|
||||
in vec2 uv;
|
||||
in vec4 color;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
vec3 rgbToHsv(vec3 c);
|
||||
vec3 hsvToRgb(vec3 c);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
#ifdef Use_Bindless_Texture
|
||||
vec4 col = texture(handle, uv);
|
||||
float specmap = texture(secondhandle, uv).g;
|
||||
float emitmap = texture(secondhandle, uv).b;
|
||||
#ifdef SRGBBindlessFix
|
||||
col.xyz = pow(col.xyz, vec3(2.2));
|
||||
#endif
|
||||
#else
|
||||
vec4 col = texture(Albedo, uv);
|
||||
float specmap = texture(SpecMap, uv).g;
|
||||
float emitmap = texture(SpecMap, uv).b;
|
||||
#endif
|
||||
|
||||
vec3 old_color = rgbToHsv(col.rgb);
|
||||
vec3 new_color = hsvToRgb(vec3(0.1,0.5,old_color.z));
|
||||
col = vec4(new_color.b, new_color.g, new_color.r, col.a);
|
||||
col.xyz *= pow(color.xyz, vec3(2.2));
|
||||
|
||||
FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap, emitmap) , 1.);
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
#ifndef Use_Bindless_Texture
|
||||
uniform sampler2D Albedo;
|
||||
uniform sampler2D SpecMap;
|
||||
#endif
|
||||
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat in sampler2D handle;
|
||||
flat in sampler2D secondhandle;
|
||||
#endif
|
||||
in vec2 uv;
|
||||
in vec4 color;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
vec3 rgbToHsv(vec3 c);
|
||||
vec3 hsvToRgb(vec3 c);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
#ifdef Use_Bindless_Texture
|
||||
vec4 col = texture(handle, uv);
|
||||
float specmap = texture(secondhandle, uv).g;
|
||||
float emitmap = texture(secondhandle, uv).b;
|
||||
#ifdef SRGBBindlessFix
|
||||
col.xyz = pow(col.xyz, vec3(2.2));
|
||||
#endif
|
||||
#else
|
||||
vec4 col = texture(Albedo, uv);
|
||||
float specmap = texture(SpecMap, uv).g;
|
||||
float emitmap = texture(SpecMap, uv).b;
|
||||
#endif
|
||||
|
||||
vec3 old_color = rgbToHsv(col.rgb);
|
||||
vec3 new_color = hsvToRgb(vec3(0.7,0.7,old_color.z));
|
||||
col = vec4(new_color.b, new_color.g, new_color.r, col.a);
|
||||
col.xyz *= pow(color.xyz, vec3(2.2));
|
||||
|
||||
FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap, emitmap) , 1.);
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(bindless_sampler) uniform sampler2D Albedo;
|
||||
layout(bindless_sampler) uniform sampler2D SpecMap;
|
||||
#else
|
||||
uniform sampler2D Albedo;
|
||||
uniform sampler2D SpecMap;
|
||||
#endif
|
||||
|
||||
in vec2 uv;
|
||||
in vec4 color;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
vec3 rgbToHsv(vec3 c);
|
||||
vec3 hsvToRgb(vec3 c);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
#ifdef Use_Bindless_Texture
|
||||
vec4 col = texture(Albedo, uv);
|
||||
#ifdef SRGBBindlessFix
|
||||
col.xyz = pow(col.xyz, vec3(2.2));
|
||||
#endif
|
||||
#else
|
||||
vec4 col = texture(Albedo, uv);
|
||||
#endif
|
||||
|
||||
vec3 old_color = rgbToHsv(col.rgb);
|
||||
vec3 new_color = hsvToRgb(vec3(0.1,0.5,old_color.z));
|
||||
col = vec4(new_color.b, new_color.g, new_color.r, col.a);
|
||||
col.xyz *= pow(color.xyz, vec3(2.2));
|
||||
float specmap = texture(SpecMap, uv).g;
|
||||
float emitmap = texture(SpecMap, uv).b;
|
||||
FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap, emitmap), 1.);
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(bindless_sampler) uniform sampler2D Albedo;
|
||||
layout(bindless_sampler) uniform sampler2D SpecMap;
|
||||
#else
|
||||
uniform sampler2D Albedo;
|
||||
uniform sampler2D SpecMap;
|
||||
#endif
|
||||
|
||||
in vec2 uv;
|
||||
in vec4 color;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
vec3 rgbToHsv(vec3 c);
|
||||
vec3 hsvToRgb(vec3 c);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
#ifdef Use_Bindless_Texture
|
||||
vec4 col = texture(Albedo, uv);
|
||||
#ifdef SRGBBindlessFix
|
||||
col.xyz = pow(col.xyz, vec3(2.2));
|
||||
#endif
|
||||
#else
|
||||
vec4 col = texture(Albedo, uv);
|
||||
#endif
|
||||
|
||||
vec3 old_color = rgbToHsv(col.rgb);
|
||||
vec3 new_color = hsvToRgb(vec3(0.7,0.7,old_color.z));
|
||||
col = vec4(new_color.b, new_color.g, new_color.r, col.a);
|
||||
col.xyz *= pow(color.xyz, vec3(2.2));
|
||||
float specmap = texture(SpecMap, uv).g;
|
||||
float emitmap = texture(SpecMap, uv).b;
|
||||
FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap, emitmap), 1.);
|
||||
}
|
@ -9,6 +9,15 @@ vec3 rgbToHsv(vec3 c)
|
||||
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
}
|
||||
|
||||
float rgbToValue(vec3 c)
|
||||
{
|
||||
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
||||
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
||||
|
||||
return q.x;
|
||||
}
|
||||
|
||||
vec3 hsvToRgb(vec3 c)
|
||||
{
|
||||
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
|
@ -47,8 +47,6 @@ public:
|
||||
enum ShaderType
|
||||
{
|
||||
SHADERTYPE_SOLID,
|
||||
SHADERTYPE_SOLID_RED,
|
||||
SHADERTYPE_SOLID_BLUE,
|
||||
SHADERTYPE_ALPHA_TEST,
|
||||
SHADERTYPE_ALPHA_BLEND,
|
||||
SHADERTYPE_ADDITIVE,
|
||||
|
@ -133,13 +133,18 @@ public:
|
||||
// ============================================================================
|
||||
class InstancedObjectPass2Shader : public TextureShader<InstancedObjectPass2Shader, 5>
|
||||
{
|
||||
private:
|
||||
GLint m_color_change_location;
|
||||
|
||||
public:
|
||||
InstancedObjectPass2Shader()
|
||||
{
|
||||
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert",
|
||||
GL_VERTEX_SHADER, "instanced_object_pass.vert",
|
||||
GL_FRAGMENT_SHADER, "utils/getLightFactor.frag",
|
||||
GL_FRAGMENT_SHADER, "utils/rgb_conversion.frag",
|
||||
GL_FRAGMENT_SHADER, "instanced_object_pass2.frag");
|
||||
m_color_change_location = glGetUniformLocation(m_program, "color_change");
|
||||
assignUniforms();
|
||||
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
|
||||
1, "SpecularMap", ST_NEAREST_FILTERED,
|
||||
@ -147,48 +152,13 @@ public:
|
||||
3, "Albedo", ST_TRILINEAR_ANISOTROPIC_FILTERED,
|
||||
4, "SpecMap", ST_TRILINEAR_ANISOTROPIC_FILTERED);
|
||||
} // InstancedObjectPass2Shader
|
||||
|
||||
void setHueSaturation(float hue, float saturation) const
|
||||
{
|
||||
glUniform2f(m_color_change_location, hue, saturation);
|
||||
} // setHueSaturation
|
||||
}; // InstancedObjectPass2Shader
|
||||
|
||||
// ============================================================================
|
||||
class InstancedObjectPass2ShaderRed : public TextureShader<InstancedObjectPass2ShaderRed, 5>
|
||||
{
|
||||
public:
|
||||
InstancedObjectPass2ShaderRed()
|
||||
{
|
||||
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert",
|
||||
GL_VERTEX_SHADER, "instanced_object_pass.vert",
|
||||
GL_FRAGMENT_SHADER, "utils/getLightFactor.frag",
|
||||
GL_FRAGMENT_SHADER, "utils/rgb_conversion.frag",
|
||||
GL_FRAGMENT_SHADER, "instanced_object_pass2_red.frag");
|
||||
assignUniforms();
|
||||
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
|
||||
1, "SpecularMap", ST_NEAREST_FILTERED,
|
||||
2, "SSAO", ST_BILINEAR_FILTERED,
|
||||
3, "Albedo", ST_TRILINEAR_ANISOTROPIC_FILTERED,
|
||||
4, "SpecMap", ST_TRILINEAR_ANISOTROPIC_FILTERED);
|
||||
} // InstancedObjectPass2ShaderRed
|
||||
}; // InstancedObjectPass2ShaderRed
|
||||
|
||||
// ============================================================================
|
||||
class InstancedObjectPass2ShaderBlue : public TextureShader<InstancedObjectPass2ShaderBlue, 5>
|
||||
{
|
||||
public:
|
||||
InstancedObjectPass2ShaderBlue()
|
||||
{
|
||||
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert",
|
||||
GL_VERTEX_SHADER, "instanced_object_pass.vert",
|
||||
GL_FRAGMENT_SHADER, "utils/getLightFactor.frag",
|
||||
GL_FRAGMENT_SHADER, "utils/rgb_conversion.frag",
|
||||
GL_FRAGMENT_SHADER, "instanced_object_pass2_blue.frag");
|
||||
assignUniforms();
|
||||
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
|
||||
1, "SpecularMap", ST_NEAREST_FILTERED,
|
||||
2, "SSAO", ST_BILINEAR_FILTERED,
|
||||
3, "Albedo", ST_TRILINEAR_ANISOTROPIC_FILTERED,
|
||||
4, "SpecMap", ST_TRILINEAR_ANISOTROPIC_FILTERED);
|
||||
} // InstancedObjectPass2ShaderBlue
|
||||
}; // InstancedObjectPass2ShaderBlue
|
||||
|
||||
// ============================================================================
|
||||
class InstancedObjectRefPass2Shader : public TextureShader<InstancedObjectRefPass2Shader, 5>
|
||||
{
|
||||
@ -582,66 +552,6 @@ const STK::Tuple<size_t, size_t> DefaultMaterial::SecondPassTextures
|
||||
const STK::Tuple<> DefaultMaterial::ShadowTextures;
|
||||
const STK::Tuple<size_t> DefaultMaterial::RSMTextures = STK::Tuple<size_t>(0);
|
||||
|
||||
// ============================================================================
|
||||
struct RedMaterial
|
||||
{
|
||||
typedef InstancedObjectPass1Shader InstancedFirstPassShader;
|
||||
typedef InstancedObjectPass2ShaderRed InstancedSecondPassShader;
|
||||
typedef InstancedShadowShader InstancedShadowPassShader;
|
||||
typedef CInstancedRSMShader InstancedRSMShader;
|
||||
typedef ListInstancedMatRed InstancedList;
|
||||
typedef Shaders::ObjectPass1Shader FirstPassShader;
|
||||
typedef Shaders::ObjectPass2ShaderRed SecondPassShader;
|
||||
typedef ShadowShader ShadowPassShader;
|
||||
typedef CRSMShader RSMShader;
|
||||
typedef ListMatRed List;
|
||||
static const enum video::E_VERTEX_TYPE VertexType = video::EVT_STANDARD;
|
||||
static const enum Material::ShaderType MaterialType
|
||||
= Material::SHADERTYPE_SOLID_RED;
|
||||
static const enum InstanceType Instance = InstanceTypeDualTex;
|
||||
static const STK::Tuple<size_t> FirstPassTextures;
|
||||
static const STK::Tuple<size_t, size_t> SecondPassTextures;
|
||||
static const STK::Tuple<> ShadowTextures;
|
||||
static const STK::Tuple<size_t> RSMTextures;
|
||||
}; // struct RedMaterial
|
||||
|
||||
const STK::Tuple<size_t> RedMaterial::FirstPassTextures
|
||||
= STK::Tuple<size_t>(1);
|
||||
const STK::Tuple<size_t, size_t> RedMaterial::SecondPassTextures
|
||||
= STK::Tuple<size_t, size_t>(0, 1);
|
||||
const STK::Tuple<> RedMaterial::ShadowTextures;
|
||||
const STK::Tuple<size_t> RedMaterial::RSMTextures = STK::Tuple<size_t>(0);
|
||||
|
||||
// ============================================================================
|
||||
struct BlueMaterial
|
||||
{
|
||||
typedef InstancedObjectPass1Shader InstancedFirstPassShader;
|
||||
typedef InstancedObjectPass2ShaderBlue InstancedSecondPassShader;
|
||||
typedef InstancedShadowShader InstancedShadowPassShader;
|
||||
typedef CInstancedRSMShader InstancedRSMShader;
|
||||
typedef ListInstancedMatBlue InstancedList;
|
||||
typedef Shaders::ObjectPass1Shader FirstPassShader;
|
||||
typedef Shaders::ObjectPass2ShaderBlue SecondPassShader;
|
||||
typedef ShadowShader ShadowPassShader;
|
||||
typedef CRSMShader RSMShader;
|
||||
typedef ListMatBlue List;
|
||||
static const enum video::E_VERTEX_TYPE VertexType = video::EVT_STANDARD;
|
||||
static const enum Material::ShaderType MaterialType
|
||||
= Material::SHADERTYPE_SOLID_BLUE;
|
||||
static const enum InstanceType Instance = InstanceTypeDualTex;
|
||||
static const STK::Tuple<size_t> FirstPassTextures;
|
||||
static const STK::Tuple<size_t, size_t> SecondPassTextures;
|
||||
static const STK::Tuple<> ShadowTextures;
|
||||
static const STK::Tuple<size_t> RSMTextures;
|
||||
}; // struct BlueMaterial
|
||||
|
||||
const STK::Tuple<size_t> BlueMaterial::FirstPassTextures
|
||||
= STK::Tuple<size_t>(1);
|
||||
const STK::Tuple<size_t, size_t> BlueMaterial::SecondPassTextures
|
||||
= STK::Tuple<size_t, size_t>(0, 1);
|
||||
const STK::Tuple<> BlueMaterial::ShadowTextures;
|
||||
const STK::Tuple<size_t> BlueMaterial::RSMTextures = STK::Tuple<size_t>(0);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
struct AlphaRef
|
||||
{
|
||||
@ -1087,6 +997,26 @@ void draw(const T *Shader, const GLMesh *mesh, uniforms... Args)
|
||||
GLenum itype = mesh->IndexType;
|
||||
size_t count = mesh->IndexCount;
|
||||
|
||||
const Shaders::ObjectPass2Shader* op2s = dynamic_cast<const Shaders::ObjectPass2Shader*>
|
||||
(Shader);
|
||||
if (op2s)
|
||||
{
|
||||
const video::E_RENDER_TYPE rt = mesh->mb->getRenderType();
|
||||
if (rt == video::ERT_RED)
|
||||
{
|
||||
op2s->setHueSaturation(0.7f, 0.7f);
|
||||
}
|
||||
else if (rt == video::ERT_BLUE)
|
||||
{
|
||||
op2s->setHueSaturation(0.1f, 0.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reset if not using custom render type
|
||||
op2s->setHueSaturation(-1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
Shader->setUniforms(Args...);
|
||||
glDrawElementsBaseVertex(ptype, (int)count, itype,
|
||||
(GLvoid *)mesh->vaoOffset,
|
||||
@ -1287,8 +1217,6 @@ void IrrDriver::renderSolidFirstPass()
|
||||
ImmediateDrawList::getInstance()->at(i)->render();
|
||||
|
||||
renderMeshes1stPass<DefaultMaterial, 2, 1>();
|
||||
renderMeshes1stPass<RedMaterial, 2, 1>();
|
||||
renderMeshes1stPass<BlueMaterial, 2, 1>();
|
||||
renderMeshes1stPass<SplattingMat, 2, 1>();
|
||||
renderMeshes1stPass<UnlitMat, 3, 2, 1>();
|
||||
renderMeshes1stPass<AlphaRef, 3, 2, 1>();
|
||||
@ -1300,8 +1228,6 @@ void IrrDriver::renderSolidFirstPass()
|
||||
if (CVS->isAZDOEnabled())
|
||||
{
|
||||
multidraw1stPass<DefaultMaterial>();
|
||||
multidraw1stPass<RedMaterial>();
|
||||
multidraw1stPass<BlueMaterial>();
|
||||
multidraw1stPass<AlphaRef>();
|
||||
multidraw1stPass<SphereMap>();
|
||||
multidraw1stPass<UnlitMat>();
|
||||
@ -1313,8 +1239,6 @@ void IrrDriver::renderSolidFirstPass()
|
||||
else if (CVS->supportsIndirectInstancingRendering())
|
||||
{
|
||||
renderInstancedMeshes1stPass<DefaultMaterial>();
|
||||
renderInstancedMeshes1stPass<RedMaterial>();
|
||||
renderInstancedMeshes1stPass<BlueMaterial>();
|
||||
renderInstancedMeshes1stPass<AlphaRef>();
|
||||
renderInstancedMeshes1stPass<UnlitMat>();
|
||||
renderInstancedMeshes1stPass<SphereMap>();
|
||||
@ -1372,12 +1296,32 @@ void renderInstancedMeshes2ndPass(const std::vector<GLuint> &Prefilled_tex, Args
|
||||
T::InstancedSecondPassShader::getInstance()->use();
|
||||
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType,
|
||||
T::Instance));
|
||||
InstancedObjectPass2Shader* iop2s = dynamic_cast<InstancedObjectPass2Shader*>
|
||||
(T::InstancedSecondPassShader::getInstance());
|
||||
for (unsigned i = 0; i < meshes.size(); i++)
|
||||
{
|
||||
GLMesh *mesh = meshes[i];
|
||||
TexExpander<typename T::InstancedSecondPassShader>::template
|
||||
ExpandTex(*mesh, T::SecondPassTextures, Prefilled_tex[0],
|
||||
Prefilled_tex[1], Prefilled_tex[2]);
|
||||
if (iop2s)
|
||||
{
|
||||
const video::E_RENDER_TYPE rt = mesh->mb->getRenderType();
|
||||
if (rt == video::ERT_RED)
|
||||
{
|
||||
iop2s->setHueSaturation(0.7f, 0.7f);
|
||||
}
|
||||
else if (rt == video::ERT_BLUE)
|
||||
{
|
||||
iop2s->setHueSaturation(0.1f, 0.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reset if not using custom render type
|
||||
iop2s->setHueSaturation(-1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
T::InstancedSecondPassShader::getInstance()->setUniforms(args...);
|
||||
glDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT,
|
||||
(const void*)((SolidPassCmd::getInstance()->Offset[T::MaterialType] + i)
|
||||
@ -1457,8 +1401,6 @@ void IrrDriver::renderSolidSecondPass()
|
||||
m_rtts->getRenderTarget(RTT_HALF1_R));
|
||||
|
||||
renderMeshes2ndPass<DefaultMaterial, 3, 1>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle), DiffSpecSSAOTex);
|
||||
renderMeshes2ndPass<RedMaterial, 3, 1>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle), DiffSpecSSAOTex);
|
||||
renderMeshes2ndPass<BlueMaterial, 3, 1>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle), DiffSpecSSAOTex);
|
||||
renderMeshes2ndPass<AlphaRef, 3, 1 >(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle), DiffSpecSSAOTex);
|
||||
renderMeshes2ndPass<UnlitMat, 3, 1>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle), DiffSpecSSAOTex);
|
||||
renderMeshes2ndPass<SplattingMat, 1>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle), DiffSpecSSAOTex);
|
||||
@ -1470,8 +1412,6 @@ void IrrDriver::renderSolidSecondPass()
|
||||
if (CVS->isAZDOEnabled())
|
||||
{
|
||||
multidraw2ndPass<DefaultMaterial>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0, 0));
|
||||
multidraw2ndPass<RedMaterial>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0, 0));
|
||||
multidraw2ndPass<BlueMaterial>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0, 0));
|
||||
multidraw2ndPass<AlphaRef>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0, 0));
|
||||
multidraw2ndPass<SphereMap>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0));
|
||||
multidraw2ndPass<UnlitMat>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0));
|
||||
@ -1502,8 +1442,6 @@ void IrrDriver::renderSolidSecondPass()
|
||||
else if (CVS->supportsIndirectInstancingRendering())
|
||||
{
|
||||
renderInstancedMeshes2ndPass<DefaultMaterial>(DiffSpecSSAOTex);
|
||||
renderInstancedMeshes2ndPass<RedMaterial>(DiffSpecSSAOTex);
|
||||
renderInstancedMeshes2ndPass<BlueMaterial>(DiffSpecSSAOTex);
|
||||
renderInstancedMeshes2ndPass<AlphaRef>(DiffSpecSSAOTex);
|
||||
renderInstancedMeshes2ndPass<UnlitMat>(DiffSpecSSAOTex);
|
||||
renderInstancedMeshes2ndPass<SphereMap>(DiffSpecSSAOTex);
|
||||
@ -1571,8 +1509,6 @@ void IrrDriver::renderNormalsVisualisation()
|
||||
{
|
||||
if (CVS->isAZDOEnabled()) {
|
||||
renderMultiMeshNormals<DefaultMaterial>();
|
||||
renderMultiMeshNormals<RedMaterial>();
|
||||
renderMultiMeshNormals<BlueMaterial>();
|
||||
renderMultiMeshNormals<AlphaRef>();
|
||||
renderMultiMeshNormals<UnlitMat>();
|
||||
renderMultiMeshNormals<SphereMap>();
|
||||
@ -1582,8 +1518,6 @@ void IrrDriver::renderNormalsVisualisation()
|
||||
else if (CVS->supportsIndirectInstancingRendering())
|
||||
{
|
||||
renderInstancedMeshNormals<DefaultMaterial>();
|
||||
renderInstancedMeshNormals<RedMaterial>();
|
||||
renderInstancedMeshNormals<BlueMaterial>();
|
||||
renderInstancedMeshNormals<AlphaRef>();
|
||||
renderInstancedMeshNormals<UnlitMat>();
|
||||
renderInstancedMeshNormals<SphereMap>();
|
||||
@ -1893,8 +1827,6 @@ void IrrDriver::renderShadows()
|
||||
ScopedGPUTimer Timer(getGPUTimer(Q_SHADOWS_CASCADE0 + cascade));
|
||||
|
||||
renderShadow<DefaultMaterial, 1>(cascade);
|
||||
renderShadow<RedMaterial, 1>(cascade);
|
||||
renderShadow<BlueMaterial, 1>(cascade);
|
||||
renderShadow<SphereMap, 1>(cascade);
|
||||
renderShadow<DetailMat, 1>(cascade);
|
||||
renderShadow<SplattingMat, 1>(cascade);
|
||||
@ -1909,8 +1841,6 @@ void IrrDriver::renderShadows()
|
||||
if (CVS->isAZDOEnabled())
|
||||
{
|
||||
multidrawShadow<DefaultMaterial>(cascade);
|
||||
multidrawShadow<RedMaterial>(cascade);
|
||||
multidrawShadow<BlueMaterial>(cascade);
|
||||
multidrawShadow<DetailMat>(cascade);
|
||||
multidrawShadow<NormalMat>(cascade);
|
||||
multidrawShadow<AlphaRef>(cascade);
|
||||
@ -1920,8 +1850,6 @@ void IrrDriver::renderShadows()
|
||||
else if (CVS->supportsIndirectInstancingRendering())
|
||||
{
|
||||
renderInstancedShadow<DefaultMaterial>(cascade);
|
||||
renderInstancedShadow<RedMaterial>(cascade);
|
||||
renderInstancedShadow<BlueMaterial>(cascade);
|
||||
renderInstancedShadow<DetailMat>(cascade);
|
||||
renderInstancedShadow<AlphaRef>(cascade);
|
||||
renderInstancedShadow<UnlitMat>(cascade);
|
||||
@ -2054,8 +1982,6 @@ void IrrDriver::renderRSM()
|
||||
|
||||
const core::matrix4 &rsm_matrix = getShadowMatrices()->getRSMMatrix();
|
||||
drawRSM<DefaultMaterial, 3, 1>(rsm_matrix);
|
||||
drawRSM<RedMaterial, 3, 1>(rsm_matrix);
|
||||
drawRSM<BlueMaterial, 3, 1>(rsm_matrix);
|
||||
drawRSM<AlphaRef, 3, 1>(rsm_matrix);
|
||||
drawRSM<NormalMat, 3, 1>(rsm_matrix);
|
||||
drawRSM<UnlitMat, 3, 1>(rsm_matrix);
|
||||
@ -2069,8 +1995,6 @@ void IrrDriver::renderRSM()
|
||||
if (CVS->isAZDOEnabled())
|
||||
{
|
||||
multidrawRSM<DefaultMaterial>(rsm_matrix);
|
||||
multidrawRSM<RedMaterial>(rsm_matrix);
|
||||
multidrawRSM<BlueMaterial>(rsm_matrix);
|
||||
multidrawRSM<NormalMat>(rsm_matrix);
|
||||
multidrawRSM<AlphaRef>(rsm_matrix);
|
||||
multidrawRSM<UnlitMat>(rsm_matrix);
|
||||
@ -2079,8 +2003,6 @@ void IrrDriver::renderRSM()
|
||||
else if (CVS->supportsIndirectInstancingRendering())
|
||||
{
|
||||
renderRSMShadow<DefaultMaterial>(rsm_matrix);
|
||||
renderRSMShadow<RedMaterial>(rsm_matrix);
|
||||
renderRSMShadow<BlueMaterial>(rsm_matrix);
|
||||
renderRSMShadow<AlphaRef>(rsm_matrix);
|
||||
renderRSMShadow<UnlitMat>(rsm_matrix);
|
||||
renderRSMShadow<NormalMat>(rsm_matrix);
|
||||
|
@ -340,7 +340,9 @@ Shaders::ObjectPass2Shader::ObjectPass2Shader()
|
||||
{
|
||||
loadProgram(OBJECT, GL_VERTEX_SHADER, "object_pass.vert",
|
||||
GL_FRAGMENT_SHADER, "utils/getLightFactor.frag",
|
||||
GL_FRAGMENT_SHADER, "utils/rgb_conversion.frag",
|
||||
GL_FRAGMENT_SHADER, "object_pass2.frag");
|
||||
m_color_change_location = glGetUniformLocation(m_program, "color_change");
|
||||
assignUniforms("ModelMatrix", "TextureMatrix");
|
||||
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
|
||||
1, "SpecularMap", ST_NEAREST_FILTERED,
|
||||
@ -349,38 +351,6 @@ Shaders::ObjectPass2Shader::ObjectPass2Shader()
|
||||
4, "SpecMap", ST_TRILINEAR_ANISOTROPIC_FILTERED);
|
||||
} // ObjectPass2Shader
|
||||
|
||||
// ============================================================================
|
||||
// Solid Lit pass shaders (red version)
|
||||
Shaders::ObjectPass2ShaderRed::ObjectPass2ShaderRed()
|
||||
{
|
||||
loadProgram(OBJECT, GL_VERTEX_SHADER, "object_pass.vert",
|
||||
GL_FRAGMENT_SHADER, "utils/getLightFactor.frag",
|
||||
GL_FRAGMENT_SHADER, "utils/rgb_conversion.frag",
|
||||
GL_FRAGMENT_SHADER, "object_pass2_red.frag");
|
||||
assignUniforms("ModelMatrix", "TextureMatrix");
|
||||
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
|
||||
1, "SpecularMap", ST_NEAREST_FILTERED,
|
||||
2, "SSAO", ST_BILINEAR_FILTERED,
|
||||
3, "Albedo", ST_TRILINEAR_ANISOTROPIC_FILTERED,
|
||||
4, "SpecMap", ST_TRILINEAR_ANISOTROPIC_FILTERED);
|
||||
} // ObjectPass2ShaderRed
|
||||
|
||||
// ============================================================================
|
||||
// Solid Lit pass shaders (blue version)
|
||||
Shaders::ObjectPass2ShaderBlue::ObjectPass2ShaderBlue()
|
||||
{
|
||||
loadProgram(OBJECT, GL_VERTEX_SHADER, "object_pass.vert",
|
||||
GL_FRAGMENT_SHADER, "utils/getLightFactor.frag",
|
||||
GL_FRAGMENT_SHADER, "utils/rgb_conversion.frag",
|
||||
GL_FRAGMENT_SHADER, "object_pass2_blue.frag");
|
||||
assignUniforms("ModelMatrix", "TextureMatrix");
|
||||
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
|
||||
1, "SpecularMap", ST_NEAREST_FILTERED,
|
||||
2, "SSAO", ST_BILINEAR_FILTERED,
|
||||
3, "Albedo", ST_TRILINEAR_ANISOTROPIC_FILTERED,
|
||||
4, "SpecMap", ST_TRILINEAR_ANISOTROPIC_FILTERED);
|
||||
} // ObjectPass2ShaderBlue
|
||||
|
||||
// ============================================================================
|
||||
Shaders::TransparentShader::TransparentShader()
|
||||
{
|
||||
|
@ -146,27 +146,17 @@ public:
|
||||
class ObjectPass2Shader : public TextureShader < ObjectPass2Shader, 5,
|
||||
core::matrix4, core::matrix4 >
|
||||
{
|
||||
private:
|
||||
GLint m_color_change_location;
|
||||
public:
|
||||
ObjectPass2Shader();
|
||||
void setHueSaturation(float hue, float saturation) const
|
||||
{
|
||||
glUniform2f(m_color_change_location, hue, saturation);
|
||||
} // setHueSaturation
|
||||
}; // ObjectPass2Shader
|
||||
|
||||
// ========================================================================
|
||||
class ObjectPass2ShaderRed : public TextureShader < ObjectPass2ShaderRed, 5,
|
||||
core::matrix4, core::matrix4 >
|
||||
{
|
||||
public:
|
||||
ObjectPass2ShaderRed();
|
||||
}; // ObjectPass2ShaderRed
|
||||
|
||||
// ========================================================================
|
||||
class ObjectPass2ShaderBlue : public TextureShader < ObjectPass2ShaderBlue, 5,
|
||||
core::matrix4, core::matrix4 >
|
||||
{
|
||||
public:
|
||||
ObjectPass2ShaderBlue();
|
||||
}; // ObjectPass2ShaderBlue
|
||||
|
||||
// ========================================================================
|
||||
|
||||
|
||||
}; // class Shaders
|
||||
|
@ -132,11 +132,11 @@ void STKAnimatedMesh::updateNoGL()
|
||||
}
|
||||
else if (mb->getRenderType() == video::ERT_RED)
|
||||
{
|
||||
MeshSolidMaterial[Material::SHADERTYPE_SOLID_RED].push_back(&mesh);
|
||||
MeshSolidMaterial[Material::SHADERTYPE_SOLID].push_back(&mesh);
|
||||
}
|
||||
else if (mb->getRenderType() == video::ERT_BLUE)
|
||||
{
|
||||
MeshSolidMaterial[Material::SHADERTYPE_SOLID_BLUE].push_back(&mesh);
|
||||
MeshSolidMaterial[Material::SHADERTYPE_SOLID].push_back(&mesh);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -122,28 +122,10 @@ class ListMatDefault : public MeshList<ListMatDefault, GLMesh *, core::matrix4,
|
||||
core::matrix4, core::matrix4>
|
||||
{};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
class ListMatRed : public MeshList<ListMatRed, GLMesh *, core::matrix4,
|
||||
core::matrix4, core::matrix4>
|
||||
{};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
class ListMatBlue : public MeshList<ListMatBlue, GLMesh *, core::matrix4,
|
||||
core::matrix4, core::matrix4>
|
||||
{};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
class ListInstancedMatDefault : public InstancedMeshList<ListInstancedMatDefault>
|
||||
{};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
class ListInstancedMatRed : public InstancedMeshList<ListInstancedMatRed>
|
||||
{};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
class ListInstancedMatBlue : public InstancedMeshList<ListInstancedMatBlue>
|
||||
{};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
class ListMatAlphaRef : public MeshList<ListMatAlphaRef, GLMesh *, core::matrix4,
|
||||
core::matrix4, core::matrix4>
|
||||
|
@ -191,12 +191,12 @@ void STKMeshSceneNode::updateNoGL()
|
||||
else if (mb->getRenderType() == video::ERT_RED)
|
||||
{
|
||||
if (!immediate_draw)
|
||||
MeshSolidMaterial[Material::SHADERTYPE_SOLID_RED].push_back(&mesh);
|
||||
MeshSolidMaterial[Material::SHADERTYPE_SOLID].push_back(&mesh);
|
||||
}
|
||||
else if (mb->getRenderType() == video::ERT_BLUE)
|
||||
{
|
||||
if (!immediate_draw)
|
||||
MeshSolidMaterial[Material::SHADERTYPE_SOLID_BLUE].push_back(&mesh);
|
||||
MeshSolidMaterial[Material::SHADERTYPE_SOLID].push_back(&mesh);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -331,12 +331,6 @@ handleSTKCommon(scene::ISceneNode *Node, std::vector<scene::ISceneNode *> *Immed
|
||||
case Material::SHADERTYPE_SOLID:
|
||||
ListMatDefault::getInstance()->SolidPass.emplace_back(mesh, ModelMatrix, InvModelMatrix, mesh->TextureMatrix);
|
||||
break;
|
||||
case Material::SHADERTYPE_SOLID_RED:
|
||||
ListMatRed::getInstance()->SolidPass.emplace_back(mesh, ModelMatrix, InvModelMatrix, mesh->TextureMatrix);
|
||||
break;
|
||||
case Material::SHADERTYPE_SOLID_BLUE:
|
||||
ListMatBlue::getInstance()->SolidPass.emplace_back(mesh, ModelMatrix, InvModelMatrix, mesh->TextureMatrix);
|
||||
break;
|
||||
case Material::SHADERTYPE_ALPHA_TEST:
|
||||
ListMatAlphaRef::getInstance()->SolidPass.emplace_back(mesh, ModelMatrix, InvModelMatrix, mesh->TextureMatrix);
|
||||
break;
|
||||
@ -362,12 +356,6 @@ handleSTKCommon(scene::ISceneNode *Node, std::vector<scene::ISceneNode *> *Immed
|
||||
case Material::SHADERTYPE_SOLID:
|
||||
ListMatDefault::getInstance()->SolidPass.emplace_back(mesh, ModelMatrix, InvModelMatrix, mesh->TextureMatrix);
|
||||
break;
|
||||
case Material::SHADERTYPE_SOLID_RED:
|
||||
ListMatRed::getInstance()->SolidPass.emplace_back(mesh, ModelMatrix, InvModelMatrix, mesh->TextureMatrix);
|
||||
break;
|
||||
case Material::SHADERTYPE_SOLID_BLUE:
|
||||
ListMatBlue::getInstance()->SolidPass.emplace_back(mesh, ModelMatrix, InvModelMatrix, mesh->TextureMatrix);
|
||||
break;
|
||||
case Material::SHADERTYPE_ALPHA_TEST:
|
||||
ListMatAlphaRef::getInstance()->SolidPass.emplace_back(mesh, ModelMatrix, InvModelMatrix, mesh->TextureMatrix);
|
||||
break;
|
||||
@ -428,12 +416,6 @@ handleSTKCommon(scene::ISceneNode *Node, std::vector<scene::ISceneNode *> *Immed
|
||||
case Material::SHADERTYPE_SOLID:
|
||||
ListMatDefault::getInstance()->Shadows[cascade].emplace_back(mesh, ModelMatrix, InvModelMatrix, mesh->TextureMatrix);
|
||||
break;
|
||||
case Material::SHADERTYPE_SOLID_RED:
|
||||
ListMatRed::getInstance()->Shadows[cascade].emplace_back(mesh, ModelMatrix, InvModelMatrix, mesh->TextureMatrix);
|
||||
break;
|
||||
case Material::SHADERTYPE_SOLID_BLUE:
|
||||
ListMatBlue::getInstance()->Shadows[cascade].emplace_back(mesh, ModelMatrix, InvModelMatrix, mesh->TextureMatrix);
|
||||
break;
|
||||
case Material::SHADERTYPE_ALPHA_TEST:
|
||||
ListMatAlphaRef::getInstance()->Shadows[cascade].emplace_back(mesh, ModelMatrix, InvModelMatrix, mesh->TextureMatrix);
|
||||
break;
|
||||
@ -493,12 +475,6 @@ handleSTKCommon(scene::ISceneNode *Node, std::vector<scene::ISceneNode *> *Immed
|
||||
case Material::SHADERTYPE_SOLID:
|
||||
ListMatDefault::getInstance()->RSM.emplace_back(mesh, ModelMatrix, InvModelMatrix, mesh->TextureMatrix);
|
||||
break;
|
||||
case Material::SHADERTYPE_SOLID_RED:
|
||||
ListMatRed::getInstance()->RSM.emplace_back(mesh, ModelMatrix, InvModelMatrix, mesh->TextureMatrix);
|
||||
break;
|
||||
case Material::SHADERTYPE_SOLID_BLUE:
|
||||
ListMatBlue::getInstance()->RSM.emplace_back(mesh, ModelMatrix, InvModelMatrix, mesh->TextureMatrix);
|
||||
break;
|
||||
case Material::SHADERTYPE_ALPHA_TEST:
|
||||
ListMatAlphaRef::getInstance()->RSM.emplace_back(mesh, ModelMatrix, InvModelMatrix, mesh->TextureMatrix);
|
||||
break;
|
||||
@ -597,8 +573,6 @@ void IrrDriver::PrepareDrawCalls(scene::ICameraSceneNode *camnode)
|
||||
ListDisplacement::getInstance()->clear();
|
||||
|
||||
ListMatDefault::getInstance()->clear();
|
||||
ListMatRed::getInstance()->clear();
|
||||
ListMatBlue::getInstance()->clear();
|
||||
ListMatAlphaRef::getInstance()->clear();
|
||||
ListMatSphereMap::getInstance()->clear();
|
||||
ListMatDetails::getInstance()->clear();
|
||||
@ -700,8 +674,6 @@ PROFILER_POP_CPU_MARKER();
|
||||
enableOpenMP = 0;
|
||||
|
||||
ListInstancedMatDefault::getInstance()->clear();
|
||||
ListInstancedMatRed::getInstance()->clear();
|
||||
ListInstancedMatBlue::getInstance()->clear();
|
||||
ListInstancedMatAlphaRef::getInstance()->clear();
|
||||
ListInstancedMatGrass::getInstance()->clear();
|
||||
ListInstancedMatNormalMap::getInstance()->clear();
|
||||
@ -731,14 +703,6 @@ PROFILER_POP_CPU_MARKER();
|
||||
SolidPassCmd::getInstance()->Offset[Material::SHADERTYPE_SOLID] = current_cmd;
|
||||
FillInstances(MeshForSolidPass[Material::SHADERTYPE_SOLID], ListInstancedMatDefault::getInstance()->SolidPass, InstanceBufferDualTex, CmdBuffer, offset, current_cmd, SolidPoly);
|
||||
SolidPassCmd::getInstance()->Size[Material::SHADERTYPE_SOLID] = current_cmd - SolidPassCmd::getInstance()->Offset[Material::SHADERTYPE_SOLID];
|
||||
// Red Material
|
||||
SolidPassCmd::getInstance()->Offset[Material::SHADERTYPE_SOLID_RED] = current_cmd;
|
||||
FillInstances(MeshForSolidPass[Material::SHADERTYPE_SOLID_RED], ListInstancedMatRed::getInstance()->SolidPass, InstanceBufferDualTex, CmdBuffer, offset, current_cmd, SolidPoly);
|
||||
SolidPassCmd::getInstance()->Size[Material::SHADERTYPE_SOLID_RED] = current_cmd - SolidPassCmd::getInstance()->Offset[Material::SHADERTYPE_SOLID_RED];
|
||||
// Blue Material
|
||||
SolidPassCmd::getInstance()->Offset[Material::SHADERTYPE_SOLID_BLUE] = current_cmd;
|
||||
FillInstances(MeshForSolidPass[Material::SHADERTYPE_SOLID_BLUE], ListInstancedMatBlue::getInstance()->SolidPass, InstanceBufferDualTex, CmdBuffer, offset, current_cmd, SolidPoly);
|
||||
SolidPassCmd::getInstance()->Size[Material::SHADERTYPE_SOLID_BLUE] = current_cmd - SolidPassCmd::getInstance()->Offset[Material::SHADERTYPE_SOLID_BLUE];
|
||||
// Alpha Ref
|
||||
SolidPassCmd::getInstance()->Offset[Material::SHADERTYPE_ALPHA_TEST] = current_cmd;
|
||||
FillInstances(MeshForSolidPass[Material::SHADERTYPE_ALPHA_TEST], ListInstancedMatAlphaRef::getInstance()->SolidPass, InstanceBufferDualTex, CmdBuffer, offset, current_cmd, SolidPoly);
|
||||
|
Loading…
Reference in New Issue
Block a user