Merge branch 'master' of github.com:supertuxkart/stk-code

This commit is contained in:
hiker 2014-02-21 13:38:55 +11:00
commit 1921dbdacd
9 changed files with 197 additions and 31 deletions

View File

@ -0,0 +1,22 @@
#version 330
uniform sampler2D Albedo;
uniform sampler2D DiffuseMap;
uniform sampler2D SpecularMap;
uniform sampler2D SSAO;
uniform vec2 screen;
uniform vec3 ambient;
in vec2 uv;
out vec4 FragColor;
void main(void)
{
vec2 tc = gl_FragCoord.xy / screen;
vec4 color = texture(Albedo, uv);
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
float ao = texture(SSAO, tc).x;
vec3 LightFactor = ao * ambient + DiffuseComponent + SpecularComponent * (1. - color.a);
FragColor = vec4(color.xyz * LightFactor * (0.4 + ao*0.6), 1.);
//FragColor = vec4(color.xyz * LightFactor, 1.);
}

View File

@ -0,0 +1,16 @@
#version 330
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TextureMatrix;
in vec3 Position;
in vec2 Texcoord;
in vec2 SecondTexcoord;
out vec2 uv;
out vec2 uv_bis;
void main(void)
{
uv = (TextureMatrix * vec4(Texcoord, 1., 1.)).xy;
uv_bis = SecondTexcoord;
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
}

View File

@ -1,5 +1,6 @@
#version 330
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TextureMatrix;
in vec3 Position;
in vec2 Texcoord;
@ -7,6 +8,6 @@ out vec2 uv;
void main()
{
uv = Texcoord;
uv = (TextureMatrix * vec4(Texcoord, 1., 1.)).xy;
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
}

View File

@ -424,12 +424,24 @@ void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect
{
glDisable(GL_BLEND);
}
if (clipRect)
{
if (!clipRect->isValid())
return;
glEnable(GL_SCISSOR_TEST);
const core::dimension2d<u32>& renderTargetSize = irr_driver->getVideoDriver()->getCurrentRenderTargetSize();
glScissor(clipRect->UpperLeftCorner.X, renderTargetSize.Height - clipRect->LowerRightCorner.Y,
clipRect->getWidth(), clipRect->getHeight());
}
if (colors)
drawTexColoredQuad(texture, colors, width, height, center_pos_x, center_pos_y,
tex_center_pos_x, tex_center_pos_y, tex_width, tex_height);
else
drawTexQuad(texture, width, height, center_pos_x, center_pos_y,
tex_center_pos_x, tex_center_pos_y, tex_width, tex_height);
if (clipRect)
glDisable(GL_SCISSOR_TEST);
glUseProgram(0);
}
@ -468,6 +480,17 @@ void GL32_draw2DRectangle(video::SColor color, const core::rect<s32>& position,
glDisable(GL_BLEND);
}
if (clip)
{
if (!clip->isValid())
return;
glEnable(GL_SCISSOR_TEST);
const core::dimension2d<u32>& renderTargetSize = irr_driver->getVideoDriver()->getCurrentRenderTargetSize();
glScissor(clip->UpperLeftCorner.X, renderTargetSize.Height - clip->LowerRightCorner.Y,
clip->getWidth(), clip->getHeight());
}
glUseProgram(UIShader::ColoredRectShader::Program);
glBindVertexArray(UIShader::ColoredRectShader::vao);
UIShader::ColoredRectShader::setUniforms(center_pos_x, center_pos_y, width, height, color);
@ -475,5 +498,7 @@ void GL32_draw2DRectangle(video::SColor color, const core::rect<s32>& position,
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
if (clip)
glDisable(GL_SCISSOR_TEST);
glUseProgram(0);
}

View File

@ -243,6 +243,7 @@ void Shaders::loadShaders()
MeshShader::ObjectPass1Shader::init();
MeshShader::ObjectRefPass1Shader::init();
MeshShader::ObjectPass2Shader::init();
MeshShader::MovingTextureShader::init();
MeshShader::DetailledObjectPass2Shader::init();
MeshShader::ObjectRimLimitShader::init();
MeshShader::UntexturedObjectShader::init();
@ -381,6 +382,46 @@ namespace MeshShader
glUniform3f(uniform_ambient, s.r, s.g, s.b);
}
GLuint MovingTextureShader::Program;
GLuint MovingTextureShader::attrib_position;
GLuint MovingTextureShader::attrib_texcoord;
GLuint MovingTextureShader::uniform_MVP;
GLuint MovingTextureShader::uniform_TM;
GLuint MovingTextureShader::uniform_Albedo;
GLuint MovingTextureShader::uniform_DiffuseMap;
GLuint MovingTextureShader::uniform_SpecularMap;
GLuint MovingTextureShader::uniform_SSAO;
GLuint MovingTextureShader::uniform_screen;
GLuint MovingTextureShader::uniform_ambient;
void MovingTextureShader::init()
{
Program = LoadProgram(file_manager->getAsset("shaders/movingtexture.vert").c_str(), file_manager->getAsset("shaders/movingtexture.frag").c_str());
attrib_position = glGetAttribLocation(Program, "Position");
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
uniform_Albedo = glGetUniformLocation(Program, "Albedo");
uniform_DiffuseMap = glGetUniformLocation(Program, "DiffuseMap");
uniform_SpecularMap = glGetUniformLocation(Program, "SpecularMap");
uniform_SSAO = glGetUniformLocation(Program, "SSAO");
uniform_screen = glGetUniformLocation(Program, "screen");
uniform_ambient = glGetUniformLocation(Program, "ambient");
}
void MovingTextureShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix, unsigned TU_Albedo, unsigned TU_DiffuseMap, unsigned TU_SpecularMap, unsigned TU_SSAO)
{
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
glUniformMatrix4fv(uniform_TM, 1, GL_FALSE, TextureMatrix.pointer());
glUniform1i(uniform_Albedo, TU_Albedo);
glUniform1i(uniform_DiffuseMap, TU_DiffuseMap);
glUniform1i(uniform_SpecularMap, TU_SpecularMap);
glUniform1i(uniform_SSAO, TU_SSAO);
glUniform2f(uniform_screen, UserConfigParams::m_width, UserConfigParams::m_height);
const video::SColorf s = irr_driver->getSceneManager()->getAmbientLight();
glUniform3f(uniform_ambient, s.r, s.g, s.b);
}
GLuint DetailledObjectPass2Shader::Program;
GLuint DetailledObjectPass2Shader::attrib_position;
GLuint DetailledObjectPass2Shader::attrib_texcoord;
@ -753,7 +794,7 @@ namespace MeshShader
uniform_time = glGetUniformLocation(Program, "time");
uniform_transparency = glGetUniformLocation(Program, "transparency");
}
void BubbleShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, unsigned TU_tex, float time, float transparency)
void BubbleShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, unsigned TU_tex, float time, float transparency)
{
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
glUniform1i(uniform_tex, TU_tex);
@ -765,6 +806,7 @@ namespace MeshShader
GLuint TransparentShader::attrib_position;
GLuint TransparentShader::attrib_texcoord;
GLuint TransparentShader::uniform_MVP;
GLuint TransparentShader::uniform_TM;
GLuint TransparentShader::uniform_tex;
void TransparentShader::init()
@ -773,12 +815,14 @@ namespace MeshShader
attrib_position = glGetAttribLocation(Program, "Position");
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
uniform_tex = glGetUniformLocation(Program, "tex");
}
void TransparentShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, unsigned TU_tex)
void TransparentShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix, unsigned TU_tex)
{
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
glUniformMatrix4fv(uniform_TM, 1, GL_FALSE, TextureMatrix.pointer());
glUniform1i(uniform_tex, TU_tex);
}
@ -786,6 +830,7 @@ namespace MeshShader
GLuint TransparentFogShader::attrib_position;
GLuint TransparentFogShader::attrib_texcoord;
GLuint TransparentFogShader::uniform_MVP;
GLuint TransparentFogShader::uniform_TM;
GLuint TransparentFogShader::uniform_tex;
GLuint TransparentFogShader::uniform_fogmax;
GLuint TransparentFogShader::uniform_startH;
@ -802,6 +847,7 @@ namespace MeshShader
attrib_position = glGetAttribLocation(Program, "Position");
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
uniform_tex = glGetUniformLocation(Program, "tex");
uniform_fogmax = glGetUniformLocation(Program, "fogmax");
uniform_startH = glGetUniformLocation(Program, "startH");
@ -813,9 +859,10 @@ namespace MeshShader
uniform_ipvmat = glGetUniformLocation(Program, "ipvmat");
}
void TransparentFogShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &ipvmat, float fogmax, float startH, float endH, float start, float end, const core::vector3df &col, const core::vector3df &campos, unsigned TU_tex)
void TransparentFogShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix, const core::matrix4 &ipvmat, float fogmax, float startH, float endH, float start, float end, const core::vector3df &col, const core::vector3df &campos, unsigned TU_tex)
{
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
glUniformMatrix4fv(uniform_TM, 1, GL_FALSE, TextureMatrix.pointer());
glUniform1f(uniform_fogmax, fogmax);
glUniform1f(uniform_startH, startH);
glUniform1f(uniform_endH, endH);

View File

@ -59,6 +59,17 @@ public:
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, unsigned TU_Albedo, unsigned TU_DiffuseMap, unsigned TU_SpecularMap, unsigned TU_SSAO);
};
class MovingTextureShader
{
public:
static GLuint Program;
static GLuint attrib_position, attrib_texcoord;
static GLuint uniform_MVP, uniform_TM, uniform_Albedo, uniform_DiffuseMap, uniform_SpecularMap, uniform_SSAO, uniform_screen, uniform_ambient;
static void init();
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix, unsigned TU_Albedo, unsigned TU_DiffuseMap, unsigned TU_SpecularMap, unsigned TU_SSAO);
};
class DetailledObjectPass2Shader
{
public:
@ -174,10 +185,10 @@ class BubbleShader
public:
static GLuint Program;
static GLuint attrib_position, attrib_texcoord;
static GLuint uniform_MVP, uniform_tex, uniform_time, uniform_transparency;
static GLuint uniform_MVP, uniform_tex, uniform_time, uniform_transparency;
static void init();
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, unsigned TU_tex, float time, float transparency);
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, unsigned TU_tex, float time, float transparency);
};
class TransparentShader
@ -185,10 +196,10 @@ class TransparentShader
public:
static GLuint Program;
static GLuint attrib_position, attrib_texcoord;
static GLuint uniform_MVP, uniform_tex;
static GLuint uniform_MVP, uniform_TM, uniform_tex;
static void init();
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, unsigned TU_tex);
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix, unsigned TU_tex);
};
class TransparentFogShader
@ -196,10 +207,10 @@ class TransparentFogShader
public:
static GLuint Program;
static GLuint attrib_position, attrib_texcoord;
static GLuint uniform_MVP, uniform_tex, uniform_fogmax, uniform_startH, uniform_endH, uniform_start, uniform_end, uniform_col, uniform_screen, uniform_ipvmat;
static GLuint uniform_MVP, uniform_TM, uniform_tex, uniform_fogmax, uniform_startH, uniform_endH, uniform_start, uniform_end, uniform_col, uniform_screen, uniform_ipvmat;
static void init();
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &ipvmat, float fogmax, float startH, float endH, float start, float end, const core::vector3df &col, const core::vector3df &campos, unsigned TU_tex);
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix, const core::matrix4 &ipvmat, float fogmax, float startH, float endH, float start, float end, const core::vector3df &col, const core::vector3df &campos, unsigned TU_tex);
};
class BillboardShader

View File

@ -33,9 +33,9 @@ void STKAnimatedMesh::drawTransparent(const GLMesh &mesh, video::E_MATERIAL_TYPE
computeMVP(ModelViewProjectionMatrix);
if (World::getWorld()->getTrack()->isFogEnabled())
drawTransparentFogObject(mesh, ModelViewProjectionMatrix);
drawTransparentFogObject(mesh, ModelViewProjectionMatrix, core::matrix4::EM4CONST_IDENTITY);
else
drawTransparentObject(mesh, ModelViewProjectionMatrix);
drawTransparentObject(mesh, ModelViewProjectionMatrix, core::matrix4::EM4CONST_IDENTITY);
return;
}
@ -159,7 +159,7 @@ void STKAnimatedMesh::render()
if (isObjectPass(material.MaterialType))
{
irr_driver->IncreaseObjectCount();
initvaostate(GLmeshes[i], material.MaterialType);
initvaostate(GLmeshes[i], material.MaterialType, false);
if (irr_driver->getPhase() == SOLID_NORMAL_AND_DEPTH_PASS)
{
glBindVertexArray(0);

View File

@ -611,7 +611,41 @@ void drawObjectPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjectio
glDrawElements(ptype, count, itype, 0);
}
void drawTransparentObject(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix)
void drawMovingTexture(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix)
{
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
setTexture(0, mesh.textures[0], GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
if (irr_driver->getLightViz())
{
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ALPHA };
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
else
{
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
setTexture(1, getTextureGLuint(irr_driver->getRTT(RTT_TMP1)), GL_NEAREST, GL_NEAREST);
setTexture(2, getTextureGLuint(irr_driver->getRTT(RTT_TMP2)), GL_NEAREST, GL_NEAREST);
setTexture(3, getTextureGLuint(irr_driver->getRTT(RTT_SSAO)), GL_NEAREST, GL_NEAREST);
if (!UserConfigParams::m_ssao)
{
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ONE };
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
glUseProgram(MeshShader::MovingTextureShader::Program);
MeshShader::MovingTextureShader::setUniforms(ModelViewProjectionMatrix, TextureMatrix, 0, 1, 2, 3);
glBindVertexArray(mesh.vao_second_pass);
glDrawElements(ptype, count, itype, 0);
}
void drawTransparentObject(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix)
{
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
@ -620,13 +654,13 @@ void drawTransparentObject(const GLMesh &mesh, const core::matrix4 &ModelViewPro
setTexture(0, mesh.textures[0], GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
glUseProgram(MeshShader::TransparentShader::Program);
MeshShader::TransparentShader::setUniforms(ModelViewProjectionMatrix, 0);
MeshShader::TransparentShader::setUniforms(ModelViewProjectionMatrix, TextureMatrix, 0);
glBindVertexArray(mesh.vao_first_pass);
glDrawElements(ptype, count, itype, 0);
}
void drawTransparentFogObject(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix)
void drawTransparentFogObject(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix)
{
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
@ -649,7 +683,7 @@ void drawTransparentFogObject(const GLMesh &mesh, const core::matrix4 &ModelView
setTexture(0, mesh.textures[0], GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
glUseProgram(MeshShader::TransparentFogShader::Program);
MeshShader::TransparentFogShader::setUniforms(ModelViewProjectionMatrix, irr_driver->getInvProjMatrix(), fogmax, startH, endH, start, end, col, Camera::getCamera(0)->getCameraSceneNode()->getAbsolutePosition(), 0);
MeshShader::TransparentFogShader::setUniforms(ModelViewProjectionMatrix, TextureMatrix, irr_driver->getInvProjMatrix(), fogmax, startH, endH, start, end, col, Camera::getCamera(0)->getCameraSceneNode()->getAbsolutePosition(), 0);
glBindVertexArray(mesh.vao_first_pass);
glDrawElements(ptype, count, itype, 0);
@ -717,9 +751,9 @@ void STKMesh::drawTransparent(const GLMesh &mesh, video::E_MATERIAL_TYPE type)
if (type == irr_driver->getShader(ES_BUBBLES))
drawBubble(mesh, ModelViewProjectionMatrix);
else if (World::getWorld()->getTrack()->isFogEnabled())
drawTransparentFogObject(mesh, ModelViewProjectionMatrix);
drawTransparentFogObject(mesh, ModelViewProjectionMatrix, TextureMatrix);
else
drawTransparentObject(mesh, ModelViewProjectionMatrix);
drawTransparentObject(mesh, ModelViewProjectionMatrix, TextureMatrix);
return;
}
@ -793,8 +827,10 @@ void STKMesh::drawSolid(const GLMesh &mesh, video::E_MATERIAL_TYPE type)
drawObjectUnlit(mesh, ModelViewProjectionMatrix);
else if (mesh.textures[1] && type != irr_driver->getShader(ES_NORMAL_MAP))
drawDetailledObjectPass2(mesh, ModelViewProjectionMatrix);
else if (!mesh.textures[0])
drawUntexturedObject(mesh, ModelViewProjectionMatrix);
else if (!mesh.textures[0])
drawUntexturedObject(mesh, ModelViewProjectionMatrix);
else if (!TextureMatrix.isIdentity())
drawMovingTexture(mesh, ModelViewProjectionMatrix, TextureMatrix);
else
drawObjectPass2(mesh, ModelViewProjectionMatrix);
break;
@ -837,7 +873,7 @@ static bool isObject(video::E_MATERIAL_TYPE type)
return false;
}
void initvaostate(GLMesh &mesh, video::E_MATERIAL_TYPE type)
void initvaostate(GLMesh &mesh, video::E_MATERIAL_TYPE type, bool MovingTexture)
{
switch (irr_driver->getPhase())
{
@ -908,6 +944,11 @@ void initvaostate(GLMesh &mesh, video::E_MATERIAL_TYPE type)
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
MeshShader::UntexturedObjectShader::attrib_position, -1, -1, -1, -1, -1, MeshShader::UntexturedObjectShader::attrib_color, mesh.Stride);
}
else if (MovingTexture)
{
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
MeshShader::MovingTextureShader::attrib_position, MeshShader::MovingTextureShader::attrib_texcoord, -1, -1, -1, -1, -1, mesh.Stride);
}
else
{
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
@ -982,7 +1023,8 @@ void STKMesh::render()
scene::IMeshBuffer* mb = Mesh->getMeshBuffer(i);
if (mb)
{
const video::SMaterial& material = ReadOnlyMaterials ? mb->getMaterial() : Materials[i];
TextureMatrix = getMaterial(i).getTextureMatrix(0);
const video::SMaterial& material = ReadOnlyMaterials ? mb->getMaterial() : Materials[i];
video::IMaterialRenderer* rnd = driver->getMaterialRenderer(material.MaterialType);
bool transparent = (rnd && rnd->isTransparent());
@ -991,7 +1033,7 @@ void STKMesh::render()
continue;
if (irr_driver->getPhase() == DISPLACEMENT_PASS)
{
initvaostate(GLmeshes[i], material.MaterialType);
initvaostate(GLmeshes[i], material.MaterialType, false);
drawDisplace(GLmeshes[i]);
continue;
}
@ -1007,18 +1049,18 @@ void STKMesh::render()
// and solid only in solid pass
if (irr_driver->getPhase() == GLOW_PASS)
{
initvaostate(GLmeshes[i], material.MaterialType);
initvaostate(GLmeshes[i], material.MaterialType, TextureMatrix.isIdentity());
drawGlow(GLmeshes[i]);
}
else if (irr_driver->getPhase() == SHADOW_PASS)
{
initvaostate(GLmeshes[i], material.MaterialType);
initvaostate(GLmeshes[i], material.MaterialType, TextureMatrix.isIdentity());
drawShadow(GLmeshes[i], material.MaterialType);
}
else
{
irr_driver->IncreaseObjectCount();
initvaostate(GLmeshes[i], material.MaterialType);
initvaostate(GLmeshes[i], material.MaterialType, TextureMatrix.isIdentity());
if (transparent)
drawTransparent(GLmeshes[i], material.MaterialType);
else

View File

@ -25,7 +25,7 @@ struct GLMesh {
GLuint createVAO(GLuint vbo, GLuint idx, GLuint attrib_position, GLuint attrib_texcoord, GLuint attrib_second_texcoord, GLuint attrib_normal, GLuint attrib_tangent, GLuint attrib_bitangent, GLuint attrib_color, size_t stride);
GLMesh allocateMeshBuffer(scene::IMeshBuffer* mb);
void initvaostate(GLMesh &mesh, video::E_MATERIAL_TYPE type);
void initvaostate(GLMesh &mesh, video::E_MATERIAL_TYPE type, bool moving_texture);
void computeMVP(core::matrix4 &ModelViewProjectionMatrix);
void computeTIMV(core::matrix4 &TransposeInverseModelView);
@ -38,6 +38,7 @@ void drawGrassPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectio
// Pass 2 shader (ie shaders that outputs final color)
void drawDetailledObjectPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix);
void drawObjectPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix);
void drawMovingTexture(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix);
void drawUntexturedObject(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix);
void drawObjectRefPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix);
void drawSphereMap(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView);
@ -47,15 +48,15 @@ void drawObjectRimLimit(const GLMesh &mesh, const core::matrix4 &ModelViewProjec
void drawObjectUnlit(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix);
// Forward pass (for transparents meshes)
void drawTransparentObject(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix);
void drawTransparentFogObject(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix);
void drawTransparentObject(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix);
void drawTransparentFogObject(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix);
void drawBubble(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix);
class STKMesh : public irr::scene::CMeshSceneNode
{
protected:
std::vector<GLMesh> GLmeshes;
core::matrix4 ModelViewProjectionMatrix, TransposeInverseModelView;
core::matrix4 ModelViewProjectionMatrix, TransposeInverseModelView, TextureMatrix;
core::vector3df windDir;
void drawSolid(const GLMesh &mesh, video::E_MATERIAL_TYPE type);
void drawTransparent(const GLMesh &mesh, video::E_MATERIAL_TYPE type);
@ -73,6 +74,7 @@ public:
const irr::core::vector3df& scale = irr::core::vector3df(1.0f, 1.0f, 1.0f));
virtual void render();
virtual void setMesh(irr::scene::IMesh* mesh);
void MovingTexture(unsigned, unsigned);
~STKMesh();
};