Moved more shaders.
This commit is contained in:
parent
3cb0c6f4c2
commit
78220d5ed7
@ -43,6 +43,22 @@
|
|||||||
#define MIN2(a, b) ((a) > (b) ? (b) : (a))
|
#define MIN2(a, b) ((a) > (b) ? (b) : (a))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
class InstancedColorizeShader : public Shader<InstancedColorizeShader>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
InstancedColorizeShader()
|
||||||
|
{
|
||||||
|
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert",
|
||||||
|
GL_VERTEX_SHADER, "glow_object.vert",
|
||||||
|
GL_FRAGMENT_SHADER, "glow_object.frag");
|
||||||
|
assignUniforms();
|
||||||
|
} // InstancedColorizeShader
|
||||||
|
}; // InstancedColorizeShader
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
extern std::vector<float> BoundingBoxes;
|
extern std::vector<float> BoundingBoxes;
|
||||||
|
|
||||||
void IrrDriver::renderGLSL(float dt)
|
void IrrDriver::renderGLSL(float dt)
|
||||||
@ -694,7 +710,7 @@ void IrrDriver::renderGlow(std::vector<GlowData>& glows)
|
|||||||
if (CVS->supportsIndirectInstancingRendering())
|
if (CVS->supportsIndirectInstancingRendering())
|
||||||
{
|
{
|
||||||
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, GlowPassCmd::getInstance()->drawindirectcmd);
|
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, GlowPassCmd::getInstance()->drawindirectcmd);
|
||||||
MeshShader::InstancedColorizeShader::getInstance()->use();
|
InstancedColorizeShader::getInstance()->use();
|
||||||
|
|
||||||
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(video::EVT_STANDARD, InstanceTypeGlow));
|
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(video::EVT_STANDARD, InstanceTypeGlow));
|
||||||
if (CVS->isAZDOEnabled())
|
if (CVS->isAZDOEnabled())
|
||||||
|
@ -413,6 +413,90 @@ public:
|
|||||||
} // InstancedObjectUnlitShader
|
} // InstancedObjectUnlitShader
|
||||||
}; // InstancedObjectUnlitShader
|
}; // InstancedObjectUnlitShader
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
class RefShadowShader : public TextureShader<RefShadowShader, 1,
|
||||||
|
int, core::matrix4>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RefShadowShader()
|
||||||
|
{
|
||||||
|
// Geometry shader needed
|
||||||
|
if (CVS->getGLSLVersion() < 150)
|
||||||
|
return;
|
||||||
|
if (CVS->isAMDVertexShaderLayerUsable())
|
||||||
|
{
|
||||||
|
loadProgram(OBJECT, GL_VERTEX_SHADER, "shadow.vert",
|
||||||
|
GL_FRAGMENT_SHADER, "shadowref.frag");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
loadProgram(OBJECT, GL_VERTEX_SHADER, "shadow.vert",
|
||||||
|
GL_GEOMETRY_SHADER, "shadow.geom",
|
||||||
|
GL_FRAGMENT_SHADER, "shadowref.frag");
|
||||||
|
}
|
||||||
|
assignUniforms("layer", "ModelMatrix");
|
||||||
|
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
|
||||||
|
} // RefShadowShader
|
||||||
|
}; // RefShadowShader
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
class InstancedRefShadowShader : public TextureShader<InstancedRefShadowShader,
|
||||||
|
1, int>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
InstancedRefShadowShader()
|
||||||
|
{
|
||||||
|
// Geometry shader needed
|
||||||
|
if (CVS->getGLSLVersion() < 150)
|
||||||
|
return;
|
||||||
|
if (CVS->isAMDVertexShaderLayerUsable())
|
||||||
|
{
|
||||||
|
loadProgram(OBJECT,GL_VERTEX_SHADER, "utils/getworldmatrix.vert",
|
||||||
|
GL_VERTEX_SHADER, "instanciedshadow.vert",
|
||||||
|
GL_FRAGMENT_SHADER, "instanced_shadowref.frag");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
loadProgram(OBJECT,GL_VERTEX_SHADER, "utils/getworldmatrix.vert",
|
||||||
|
GL_VERTEX_SHADER, "instanciedshadow.vert",
|
||||||
|
GL_GEOMETRY_SHADER, "instanced_shadow.geom",
|
||||||
|
GL_FRAGMENT_SHADER, "instanced_shadowref.frag");
|
||||||
|
}
|
||||||
|
assignUniforms("layer");
|
||||||
|
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
|
||||||
|
} // InstancedRefShadowShader
|
||||||
|
}; // InstancedRefShadowShader
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
class DisplaceMaskShader : public Shader<DisplaceMaskShader, core::matrix4>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DisplaceMaskShader()
|
||||||
|
{
|
||||||
|
loadProgram(OBJECT, GL_VERTEX_SHADER, "displace.vert",
|
||||||
|
GL_FRAGMENT_SHADER, "white.frag");
|
||||||
|
assignUniforms("ModelMatrix");
|
||||||
|
} // DisplaceMaskShader
|
||||||
|
}; // DisplaceMaskShader
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
class DisplaceShader : public TextureShader<DisplaceShader, 4, core::matrix4,
|
||||||
|
core::vector2df, core::vector2df>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DisplaceShader()
|
||||||
|
{
|
||||||
|
loadProgram(OBJECT, GL_VERTEX_SHADER, "displace.vert",
|
||||||
|
GL_FRAGMENT_SHADER, "displace.frag");
|
||||||
|
assignUniforms("ModelMatrix", "dir", "dir2");
|
||||||
|
|
||||||
|
assignSamplerNames(0, "displacement_tex", ST_BILINEAR_FILTERED,
|
||||||
|
1, "color_tex", ST_BILINEAR_FILTERED,
|
||||||
|
2, "mask_tex", ST_BILINEAR_FILTERED,
|
||||||
|
3, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
|
||||||
|
} // DisplaceShader
|
||||||
|
}; // DisplaceShader
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
struct DefaultMaterial
|
struct DefaultMaterial
|
||||||
{
|
{
|
||||||
@ -448,12 +532,12 @@ struct AlphaRef
|
|||||||
{
|
{
|
||||||
typedef InstancedObjectRefPass1Shader InstancedFirstPassShader;
|
typedef InstancedObjectRefPass1Shader InstancedFirstPassShader;
|
||||||
typedef InstancedObjectRefPass2Shader InstancedSecondPassShader;
|
typedef InstancedObjectRefPass2Shader InstancedSecondPassShader;
|
||||||
typedef MeshShader::InstancedRefShadowShader InstancedShadowPassShader;
|
typedef InstancedRefShadowShader InstancedShadowPassShader;
|
||||||
typedef CInstancedRSMShader InstancedRSMShader;
|
typedef CInstancedRSMShader InstancedRSMShader;
|
||||||
typedef ListInstancedMatAlphaRef InstancedList;
|
typedef ListInstancedMatAlphaRef InstancedList;
|
||||||
typedef ObjectRefPass1Shader FirstPassShader;
|
typedef ObjectRefPass1Shader FirstPassShader;
|
||||||
typedef ObjectRefPass2Shader SecondPassShader;
|
typedef ObjectRefPass2Shader SecondPassShader;
|
||||||
typedef MeshShader::RefShadowShader ShadowPassShader;
|
typedef RefShadowShader ShadowPassShader;
|
||||||
typedef CRSMShader RSMShader;
|
typedef CRSMShader RSMShader;
|
||||||
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;
|
||||||
@ -507,12 +591,12 @@ struct UnlitMat
|
|||||||
{
|
{
|
||||||
typedef InstancedObjectRefPass1Shader InstancedFirstPassShader;
|
typedef InstancedObjectRefPass1Shader InstancedFirstPassShader;
|
||||||
typedef InstancedObjectUnlitShader InstancedSecondPassShader;
|
typedef InstancedObjectUnlitShader InstancedSecondPassShader;
|
||||||
typedef MeshShader::InstancedRefShadowShader InstancedShadowPassShader;
|
typedef InstancedRefShadowShader InstancedShadowPassShader;
|
||||||
typedef CInstancedRSMShader InstancedRSMShader;
|
typedef CInstancedRSMShader InstancedRSMShader;
|
||||||
typedef ListInstancedMatUnlit InstancedList;
|
typedef ListInstancedMatUnlit InstancedList;
|
||||||
typedef ObjectRefPass1Shader FirstPassShader;
|
typedef ObjectRefPass1Shader FirstPassShader;
|
||||||
typedef ObjectUnlitShader SecondPassShader;
|
typedef ObjectUnlitShader SecondPassShader;
|
||||||
typedef MeshShader::RefShadowShader ShadowPassShader;
|
typedef RefShadowShader ShadowPassShader;
|
||||||
typedef CRSMShader RSMShader;
|
typedef CRSMShader RSMShader;
|
||||||
typedef ListMatUnlit List;
|
typedef ListMatUnlit List;
|
||||||
static const enum video::E_VERTEX_TYPE VertexType = video::EVT_STANDARD;
|
static const enum video::E_VERTEX_TYPE VertexType = video::EVT_STANDARD;
|
||||||
@ -1504,8 +1588,8 @@ void IrrDriver::renderTransparent()
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
MeshShader::DisplaceMaskShader::getInstance()->use();
|
DisplaceMaskShader::getInstance()->use();
|
||||||
MeshShader::DisplaceMaskShader::getInstance()->setUniforms(AbsoluteTransformation);
|
DisplaceMaskShader::getInstance()->setUniforms(AbsoluteTransformation);
|
||||||
glDrawElementsBaseVertex(ptype, (int)count, itype,
|
glDrawElementsBaseVertex(ptype, (int)count, itype,
|
||||||
(GLvoid *)mesh.vaoOffset, (int)mesh.vaoBaseVertex);
|
(GLvoid *)mesh.vaoOffset, (int)mesh.vaoBaseVertex);
|
||||||
}
|
}
|
||||||
@ -1528,13 +1612,13 @@ void IrrDriver::renderTransparent()
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
// Render the effect
|
// Render the effect
|
||||||
MeshShader::DisplaceShader::getInstance()->setTextureUnits(
|
DisplaceShader::getInstance()->setTextureUnits(
|
||||||
getTextureGLuint(displaceTex),
|
getTextureGLuint(displaceTex),
|
||||||
irr_driver->getRenderTargetTexture(RTT_COLOR),
|
irr_driver->getRenderTargetTexture(RTT_COLOR),
|
||||||
irr_driver->getRenderTargetTexture(RTT_TMP1),
|
irr_driver->getRenderTargetTexture(RTT_TMP1),
|
||||||
getTextureGLuint(mesh.textures[0]));
|
getTextureGLuint(mesh.textures[0]));
|
||||||
MeshShader::DisplaceShader::getInstance()->use();
|
DisplaceShader::getInstance()->use();
|
||||||
MeshShader::DisplaceShader::getInstance()->setUniforms(AbsoluteTransformation,
|
DisplaceShader::getInstance()->setUniforms(AbsoluteTransformation,
|
||||||
core::vector2df(cb->getDirX(), cb->getDirY()),
|
core::vector2df(cb->getDirX(), cb->getDirY()),
|
||||||
core::vector2df(cb->getDir2X(), cb->getDir2Y()));
|
core::vector2df(cb->getDir2X(), cb->getDir2Y()));
|
||||||
|
|
||||||
|
@ -25,6 +25,34 @@
|
|||||||
#define MAX2(a, b) ((a) > (b) ? (a) : (b))
|
#define MAX2(a, b) ((a) > (b) ? (a) : (b))
|
||||||
#define MIN2(a, b) ((a) > (b) ? (b) : (a))
|
#define MIN2(a, b) ((a) > (b) ? (b) : (a))
|
||||||
|
|
||||||
|
class SkyboxShader : public TextureShader<SkyboxShader,1>
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
GLuint m_vao;
|
||||||
|
|
||||||
|
public:
|
||||||
|
SkyboxShader()
|
||||||
|
{
|
||||||
|
loadProgram(OBJECT, GL_VERTEX_SHADER, "sky.vert",
|
||||||
|
GL_FRAGMENT_SHADER, "sky.frag");
|
||||||
|
assignUniforms();
|
||||||
|
assignSamplerNames(0, "tex", ST_TRILINEAR_CUBEMAP);
|
||||||
|
|
||||||
|
glGenVertexArrays(1, &m_vao);
|
||||||
|
glBindVertexArray(m_vao);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, SharedGPUObjects::getSkyTriVBO());
|
||||||
|
glEnableVertexAttribArray(0);
|
||||||
|
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), 0);
|
||||||
|
glBindVertexArray(0);
|
||||||
|
} // SkyboxShader
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
void bindVertexArray()
|
||||||
|
{
|
||||||
|
glBindVertexArray(m_vao);
|
||||||
|
} // bindVertexArray
|
||||||
|
}; // SkyboxShader
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
static float getTexelValue(unsigned i, unsigned j, size_t width, size_t height, float *Coeff, float *Y00, float *Y1minus1, float *Y10, float *Y11,
|
static float getTexelValue(unsigned i, unsigned j, size_t width, size_t height, float *Coeff, float *Y00, float *Y1minus1, float *Y10, float *Y11,
|
||||||
float *Y2minus2, float * Y2minus1, float * Y20, float *Y21, float *Y22)
|
float *Y2minus2, float * Y2minus1, float * Y20, float *Y21, float *Y22)
|
||||||
{
|
{
|
||||||
@ -403,11 +431,11 @@ void IrrDriver::renderSkybox(const scene::ICameraSceneNode *camera)
|
|||||||
|
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
|
||||||
MeshShader::SkyboxShader::getInstance()->use();
|
SkyboxShader::getInstance()->use();
|
||||||
glBindVertexArray(MeshShader::SkyboxShader::getInstance()->vao);
|
SkyboxShader::getInstance()->bindVertexArray();
|
||||||
MeshShader::SkyboxShader::getInstance()->setUniforms();
|
SkyboxShader::getInstance()->setUniforms();
|
||||||
|
|
||||||
MeshShader::SkyboxShader::getInstance()->setTextureUnits(SkyboxCubeMap);
|
SkyboxShader::getInstance()->setTextureUnits(SkyboxCubeMap);
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
|
@ -441,112 +441,6 @@ namespace MeshShader
|
|||||||
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
|
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ColorizeShader::ColorizeShader()
|
|
||||||
{
|
|
||||||
loadProgram(OBJECT,
|
|
||||||
GL_VERTEX_SHADER, "object_pass.vert",
|
|
||||||
GL_FRAGMENT_SHADER, "colorize.frag");
|
|
||||||
assignUniforms("ModelMatrix", "col");
|
|
||||||
}
|
|
||||||
|
|
||||||
InstancedColorizeShader::InstancedColorizeShader()
|
|
||||||
{
|
|
||||||
loadProgram(OBJECT,
|
|
||||||
GL_VERTEX_SHADER, "utils/getworldmatrix.vert",
|
|
||||||
GL_VERTEX_SHADER, "glow_object.vert",
|
|
||||||
GL_FRAGMENT_SHADER, "glow_object.frag");
|
|
||||||
assignUniforms();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RefShadowShader::RefShadowShader()
|
|
||||||
{
|
|
||||||
// Geometry shader needed
|
|
||||||
if (CVS->getGLSLVersion() < 150)
|
|
||||||
return;
|
|
||||||
if (CVS->isAMDVertexShaderLayerUsable())
|
|
||||||
{
|
|
||||||
loadProgram(OBJECT,
|
|
||||||
GL_VERTEX_SHADER, "shadow.vert",
|
|
||||||
GL_FRAGMENT_SHADER, "shadowref.frag");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
loadProgram(OBJECT,
|
|
||||||
GL_VERTEX_SHADER, "shadow.vert",
|
|
||||||
GL_GEOMETRY_SHADER, "shadow.geom",
|
|
||||||
GL_FRAGMENT_SHADER, "shadowref.frag");
|
|
||||||
}
|
|
||||||
assignUniforms("layer", "ModelMatrix");
|
|
||||||
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
|
|
||||||
}
|
|
||||||
|
|
||||||
InstancedRefShadowShader::InstancedRefShadowShader()
|
|
||||||
{
|
|
||||||
// Geometry shader needed
|
|
||||||
if (CVS->getGLSLVersion() < 150)
|
|
||||||
return;
|
|
||||||
if (CVS->isAMDVertexShaderLayerUsable())
|
|
||||||
{
|
|
||||||
loadProgram(OBJECT,
|
|
||||||
GL_VERTEX_SHADER, "utils/getworldmatrix.vert",
|
|
||||||
GL_VERTEX_SHADER, "instanciedshadow.vert",
|
|
||||||
GL_FRAGMENT_SHADER, "instanced_shadowref.frag");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
loadProgram(OBJECT,
|
|
||||||
GL_VERTEX_SHADER, "utils/getworldmatrix.vert",
|
|
||||||
GL_VERTEX_SHADER, "instanciedshadow.vert",
|
|
||||||
GL_GEOMETRY_SHADER, "instanced_shadow.geom",
|
|
||||||
GL_FRAGMENT_SHADER, "instanced_shadowref.frag");
|
|
||||||
}
|
|
||||||
assignUniforms("layer");
|
|
||||||
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DisplaceMaskShader::DisplaceMaskShader()
|
|
||||||
{
|
|
||||||
loadProgram(OBJECT,
|
|
||||||
GL_VERTEX_SHADER, "displace.vert",
|
|
||||||
GL_FRAGMENT_SHADER, "white.frag");
|
|
||||||
assignUniforms("ModelMatrix");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DisplaceShader::DisplaceShader()
|
|
||||||
{
|
|
||||||
loadProgram(OBJECT,
|
|
||||||
GL_VERTEX_SHADER, "displace.vert",
|
|
||||||
GL_FRAGMENT_SHADER, "displace.frag");
|
|
||||||
assignUniforms("ModelMatrix", "dir", "dir2");
|
|
||||||
|
|
||||||
assignSamplerNames(0, "displacement_tex", ST_BILINEAR_FILTERED,
|
|
||||||
1, "color_tex", ST_BILINEAR_FILTERED,
|
|
||||||
2, "mask_tex", ST_BILINEAR_FILTERED,
|
|
||||||
3, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
|
|
||||||
}
|
|
||||||
|
|
||||||
SkyboxShader::SkyboxShader()
|
|
||||||
{
|
|
||||||
loadProgram(OBJECT,
|
|
||||||
GL_VERTEX_SHADER, "sky.vert",
|
|
||||||
GL_FRAGMENT_SHADER, "sky.frag");
|
|
||||||
assignUniforms();
|
|
||||||
assignSamplerNames(0, "tex", ST_TRILINEAR_CUBEMAP);
|
|
||||||
|
|
||||||
glGenVertexArrays(1, &vao);
|
|
||||||
glBindVertexArray(vao);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, SharedGPUObjects::getSkyTriVBO());
|
|
||||||
glEnableVertexAttribArray(0);
|
|
||||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), 0);
|
|
||||||
glBindVertexArray(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
NormalVisualizer::NormalVisualizer()
|
NormalVisualizer::NormalVisualizer()
|
||||||
{
|
{
|
||||||
loadProgram(OBJECT,
|
loadProgram(OBJECT,
|
||||||
|
@ -66,53 +66,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ColorizeShader : public Shader<ColorizeShader, core::matrix4, video::SColorf>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ColorizeShader();
|
|
||||||
};
|
|
||||||
|
|
||||||
class InstancedColorizeShader : public Shader<InstancedColorizeShader>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
InstancedColorizeShader();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class RefShadowShader : public TextureShader<RefShadowShader, 1, int, core::matrix4>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RefShadowShader();
|
|
||||||
};
|
|
||||||
|
|
||||||
class InstancedRefShadowShader : public TextureShader<InstancedRefShadowShader, 1, int>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
InstancedRefShadowShader();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class DisplaceMaskShader : public Shader<DisplaceMaskShader, core::matrix4>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DisplaceMaskShader();
|
|
||||||
};
|
|
||||||
|
|
||||||
class DisplaceShader : public TextureShader<DisplaceShader, 4, core::matrix4,
|
|
||||||
core::vector2df, core::vector2df>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DisplaceShader();
|
|
||||||
};
|
|
||||||
|
|
||||||
class SkyboxShader : public TextureShader<SkyboxShader,1>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
SkyboxShader();
|
|
||||||
GLuint vao;
|
|
||||||
};
|
|
||||||
|
|
||||||
class NormalVisualizer : public Shader<NormalVisualizer, video::SColor>
|
class NormalVisualizer : public Shader<NormalVisualizer, video::SColor>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -32,6 +32,22 @@
|
|||||||
#include "utils/tuple.hpp"
|
#include "utils/tuple.hpp"
|
||||||
#include "utils/cpp2011.hpp"
|
#include "utils/cpp2011.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
class ColorizeShader : public Shader<ColorizeShader, core::matrix4,
|
||||||
|
video::SColorf>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ColorizeShader()
|
||||||
|
{
|
||||||
|
loadProgram(OBJECT, GL_VERTEX_SHADER, "object_pass.vert",
|
||||||
|
GL_FRAGMENT_SHADER, "colorize.frag");
|
||||||
|
assignUniforms("ModelMatrix", "col");
|
||||||
|
}
|
||||||
|
|
||||||
|
}; // ColorizeShader
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
STKMeshSceneNode::STKMeshSceneNode(irr::scene::IMesh* mesh, ISceneNode* parent, irr::scene::ISceneManager* mgr,
|
STKMeshSceneNode::STKMeshSceneNode(irr::scene::IMesh* mesh, ISceneNode* parent, irr::scene::ISceneManager* mgr,
|
||||||
irr::s32 id, const std::string& debug_name,
|
irr::s32 id, const std::string& debug_name,
|
||||||
const irr::core::vector3df& position,
|
const irr::core::vector3df& position,
|
||||||
@ -108,7 +124,7 @@ void STKMeshSceneNode::drawGlow(const GLMesh &mesh)
|
|||||||
GLenum ptype = mesh.PrimitiveType;
|
GLenum ptype = mesh.PrimitiveType;
|
||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
MeshShader::ColorizeShader::getInstance()->setUniforms(AbsoluteTransformation, video::SColorf(glowcolor.getRed() / 255.f, glowcolor.getGreen() / 255.f, glowcolor.getBlue() / 255.f));
|
ColorizeShader::getInstance()->setUniforms(AbsoluteTransformation, video::SColorf(glowcolor.getRed() / 255.f, glowcolor.getGreen() / 255.f, glowcolor.getBlue() / 255.f));
|
||||||
glDrawElementsBaseVertex(ptype, count, itype, (GLvoid *)mesh.vaoOffset, mesh.vaoBaseVertex);
|
glDrawElementsBaseVertex(ptype, count, itype, (GLvoid *)mesh.vaoOffset, mesh.vaoBaseVertex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,7 +382,7 @@ void STKMeshSceneNode::render()
|
|||||||
|
|
||||||
if (irr_driver->getPhase() == GLOW_PASS)
|
if (irr_driver->getPhase() == GLOW_PASS)
|
||||||
{
|
{
|
||||||
MeshShader::ColorizeShader::getInstance()->use();
|
ColorizeShader::getInstance()->use();
|
||||||
for (u32 i = 0; i < Mesh->getMeshBufferCount(); ++i)
|
for (u32 i = 0; i < Mesh->getMeshBufferCount(); ++i)
|
||||||
{
|
{
|
||||||
scene::IMeshBuffer* mb = Mesh->getMeshBuffer(i);
|
scene::IMeshBuffer* mb = Mesh->getMeshBuffer(i);
|
||||||
|
Loading…
Reference in New Issue
Block a user