Start decoupling tree based draw sequence.
This commit is contained in:
@@ -421,8 +421,27 @@ void IrrDriver::renderSolidFirstPass()
|
||||
glDisable(GL_BLEND);
|
||||
glEnable(GL_CULL_FACE);
|
||||
irr_driver->setPhase(SOLID_NORMAL_AND_DEPTH_PASS);
|
||||
GroupedFPSM<FPSM_DEFAULT>::reset();
|
||||
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::reset();
|
||||
GroupedFPSM<FPSM_NORMAL_MAP>::reset();
|
||||
|
||||
m_scene_manager->drawAll(scene::ESNRP_SOLID);
|
||||
|
||||
glUseProgram(MeshShader::ObjectPass1Shader::Program);
|
||||
for (unsigned i = 0; i < GroupedFPSM<FPSM_DEFAULT>::MeshSet.size(); ++i)
|
||||
{
|
||||
drawObjectPass1(*GroupedFPSM<FPSM_DEFAULT>::MeshSet[i], GroupedFPSM<FPSM_DEFAULT>::MVPSet[i], GroupedFPSM<FPSM_DEFAULT>::TIMVSet[i]);
|
||||
}
|
||||
glUseProgram(MeshShader::ObjectRefPass1Shader::Program);
|
||||
for (unsigned i = 0; i < GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MeshSet.size(); ++i)
|
||||
{
|
||||
drawObjectRefPass1(*GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MeshSet[i], GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MVPSet[i], GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::TIMVSet[i], GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MeshSet[i]->TextureMatrix);
|
||||
}
|
||||
glUseProgram(MeshShader::NormalMapShader::Program);
|
||||
for (unsigned i = 0; i < GroupedFPSM<FPSM_NORMAL_MAP>::MeshSet.size(); ++i)
|
||||
{
|
||||
drawNormalPass(*GroupedFPSM<FPSM_NORMAL_MAP>::MeshSet[i], GroupedFPSM<FPSM_NORMAL_MAP>::MVPSet[i], GroupedFPSM<FPSM_NORMAL_MAP>::TIMVSet[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void IrrDriver::renderSolidSecondPass()
|
||||
@@ -437,10 +456,46 @@ void IrrDriver::renderSolidSecondPass()
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
glDisable(GL_BLEND);
|
||||
GroupedSM<SM_DEFAULT>::reset();
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::reset();
|
||||
GroupedSM<SM_RIMLIT>::reset();
|
||||
GroupedSM<SM_SPHEREMAP>::reset();
|
||||
GroupedSM<SM_SPLATTING>::reset();
|
||||
GroupedSM<SM_UNLIT>::reset();
|
||||
GroupedSM<SM_DETAILS>::reset();
|
||||
setTexture(0, m_rtts->getRenderTarget(RTT_TMP1), GL_NEAREST, GL_NEAREST);
|
||||
setTexture(1, m_rtts->getRenderTarget(RTT_TMP2), GL_NEAREST, GL_NEAREST);
|
||||
setTexture(2, m_rtts->getRenderTarget(RTT_SSAO), GL_NEAREST, GL_NEAREST);
|
||||
m_scene_manager->drawAll(scene::ESNRP_SOLID);
|
||||
|
||||
glUseProgram(MeshShader::ObjectPass2Shader::Program);
|
||||
for (unsigned i = 0; i < GroupedSM<SM_DEFAULT>::MeshSet.size(); i++)
|
||||
drawObjectPass2(*GroupedSM<SM_DEFAULT>::MeshSet[i], GroupedSM<SM_DEFAULT>::MVPSet[i], GroupedSM<SM_DEFAULT>::MeshSet[i]->TextureMatrix);
|
||||
|
||||
glUseProgram(MeshShader::ObjectRefPass2Shader::Program);
|
||||
for (unsigned i = 0; i < GroupedSM<SM_ALPHA_REF_TEXTURE>::MeshSet.size(); i++)
|
||||
drawObjectRefPass2(*GroupedSM<SM_ALPHA_REF_TEXTURE>::MeshSet[i], GroupedSM<SM_ALPHA_REF_TEXTURE>::MVPSet[i], GroupedSM<SM_ALPHA_REF_TEXTURE>::MeshSet[i]->TextureMatrix);
|
||||
|
||||
glUseProgram(MeshShader::ObjectRimLimitShader::Program);
|
||||
for (unsigned i = 0; i < GroupedSM<SM_RIMLIT>::MeshSet.size(); i++)
|
||||
drawObjectRimLimit(*GroupedSM<SM_RIMLIT>::MeshSet[i], GroupedSM<SM_RIMLIT>::MVPSet[i], GroupedSM<SM_RIMLIT>::TIMVSet[i], GroupedSM<SM_RIMLIT>::MeshSet[i]->TextureMatrix);
|
||||
|
||||
glUseProgram(MeshShader::SphereMapShader::Program);
|
||||
for (unsigned i = 0; i < GroupedSM<SM_SPHEREMAP>::MeshSet.size(); i++)
|
||||
drawSphereMap(*GroupedSM<SM_SPHEREMAP>::MeshSet[i], GroupedSM<SM_SPHEREMAP>::MVPSet[i], GroupedSM<SM_SPHEREMAP>::TIMVSet[i]);
|
||||
|
||||
glUseProgram(MeshShader::SplattingShader::Program);
|
||||
for (unsigned i = 0; i < GroupedSM<SM_SPLATTING>::MeshSet.size(); i++)
|
||||
drawSplatting(*GroupedSM<SM_SPLATTING>::MeshSet[i], GroupedSM<SM_SPLATTING>::MVPSet[i]);
|
||||
|
||||
glUseProgram(MeshShader::ObjectUnlitShader::Program);
|
||||
for (unsigned i = 0; i < GroupedSM<SM_UNLIT>::MeshSet.size(); i++)
|
||||
drawObjectUnlit(*GroupedSM<SM_UNLIT>::MeshSet[i], GroupedSM<SM_UNLIT>::MVPSet[i]);
|
||||
|
||||
glUseProgram(MeshShader::DetailledObjectPass2Shader::Program);
|
||||
for (unsigned i = 0; i < GroupedSM<SM_DETAILS>::MeshSet.size(); i++)
|
||||
drawDetailledObjectPass2(*GroupedSM<SM_DETAILS>::MeshSet[i], GroupedSM<SM_DETAILS>::MVPSet[i]);
|
||||
|
||||
}
|
||||
|
||||
void IrrDriver::renderTransparent()
|
||||
|
||||
@@ -54,47 +54,6 @@ void STKAnimatedMesh::setMesh(scene::IAnimatedMesh* mesh)
|
||||
CAnimatedMeshSceneNode::setMesh(mesh);
|
||||
}
|
||||
|
||||
void STKAnimatedMesh::drawSolidPass1(const GLMesh &mesh, GeometricMaterial type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case FPSM_ALPHA_REF_TEXTURE:
|
||||
drawObjectRefPass1(mesh, ModelViewProjectionMatrix, TransposeInverseModelView, mesh.TextureMatrix);
|
||||
break;
|
||||
case FPSM_DEFAULT:
|
||||
drawObjectPass1(mesh, ModelViewProjectionMatrix, TransposeInverseModelView);
|
||||
break;
|
||||
default:
|
||||
assert(0 && "Wrong geometric material");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void STKAnimatedMesh::drawSolidPass2(const GLMesh &mesh, ShadedMaterial type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SM_ALPHA_REF_TEXTURE:
|
||||
drawObjectRefPass2(mesh, ModelViewProjectionMatrix, mesh.TextureMatrix);
|
||||
break;
|
||||
case SM_RIMLIT:
|
||||
drawObjectRimLimit(mesh, ModelViewProjectionMatrix, TransposeInverseModelView, mesh.TextureMatrix);
|
||||
break;
|
||||
case SM_UNLIT:
|
||||
drawObjectUnlit(mesh, ModelViewProjectionMatrix);
|
||||
break;
|
||||
case SM_DETAILS:
|
||||
drawDetailledObjectPass2(mesh, ModelViewProjectionMatrix);
|
||||
break;
|
||||
case SM_DEFAULT:
|
||||
drawObjectPass2(mesh, ModelViewProjectionMatrix, mesh.TextureMatrix);
|
||||
break;
|
||||
default:
|
||||
assert(0 && "Wrong shaded material");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void STKAnimatedMesh::render()
|
||||
{
|
||||
video::IVideoDriver* driver = SceneManager->getVideoDriver();
|
||||
@@ -187,45 +146,59 @@ void STKAnimatedMesh::render()
|
||||
ModelViewProjectionMatrix = computeMVP(AbsoluteTransformation);
|
||||
TransposeInverseModelView = computeTIMV(AbsoluteTransformation);
|
||||
|
||||
if (!GeometricMesh[FPSM_DEFAULT].empty())
|
||||
glUseProgram(MeshShader::ObjectPass1Shader::Program);
|
||||
for (unsigned i = 0; i < GeometricMesh[FPSM_DEFAULT].size(); i++)
|
||||
drawSolidPass1(*GeometricMesh[FPSM_DEFAULT][i], FPSM_DEFAULT);
|
||||
{
|
||||
GroupedFPSM<FPSM_DEFAULT>::MeshSet.push_back(GeometricMesh[FPSM_DEFAULT][i]);
|
||||
GroupedFPSM<FPSM_DEFAULT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedFPSM<FPSM_DEFAULT>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
}
|
||||
|
||||
if (!GeometricMesh[FPSM_ALPHA_REF_TEXTURE].empty())
|
||||
glUseProgram(MeshShader::ObjectRefPass1Shader::Program);
|
||||
for (unsigned i = 0; i < GeometricMesh[FPSM_ALPHA_REF_TEXTURE].size(); i++)
|
||||
drawSolidPass1(*GeometricMesh[FPSM_ALPHA_REF_TEXTURE][i], FPSM_ALPHA_REF_TEXTURE);
|
||||
{
|
||||
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MeshSet.push_back(GeometricMesh[FPSM_ALPHA_REF_TEXTURE][i]);
|
||||
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (irr_driver->getPhase() == SOLID_LIT_PASS)
|
||||
{
|
||||
if (!ShadedMesh[SM_DEFAULT].empty())
|
||||
glUseProgram(MeshShader::ObjectPass2Shader::Program);
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_DEFAULT].size(); i++)
|
||||
drawSolidPass2(*ShadedMesh[SM_DEFAULT][i], SM_DEFAULT);
|
||||
{
|
||||
GroupedSM<SM_DEFAULT>::MeshSet.push_back(ShadedMesh[SM_DEFAULT][i]);
|
||||
GroupedSM<SM_DEFAULT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_DEFAULT>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
}
|
||||
|
||||
if (!ShadedMesh[SM_ALPHA_REF_TEXTURE].empty())
|
||||
glUseProgram(MeshShader::ObjectRefPass2Shader::Program);
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_ALPHA_REF_TEXTURE].size(); i++)
|
||||
drawSolidPass2(*ShadedMesh[SM_ALPHA_REF_TEXTURE][i], SM_ALPHA_REF_TEXTURE);
|
||||
{
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::MeshSet.push_back(ShadedMesh[SM_ALPHA_REF_TEXTURE][i]);
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
}
|
||||
|
||||
if (!ShadedMesh[SM_RIMLIT].empty())
|
||||
glUseProgram(MeshShader::ObjectRimLimitShader::Program);
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_RIMLIT].size(); i++)
|
||||
drawSolidPass2(*ShadedMesh[SM_RIMLIT][i], SM_RIMLIT);
|
||||
{
|
||||
GroupedSM<SM_RIMLIT>::MeshSet.push_back(ShadedMesh[SM_RIMLIT][i]);
|
||||
GroupedSM<SM_RIMLIT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_RIMLIT>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
}
|
||||
|
||||
if (!ShadedMesh[SM_UNLIT].empty())
|
||||
glUseProgram(MeshShader::ObjectUnlitShader::Program);
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_UNLIT].size(); i++)
|
||||
drawSolidPass2(*ShadedMesh[SM_UNLIT][i], SM_UNLIT);
|
||||
for (GLMesh *mesh : ShadedMesh[SM_UNLIT])
|
||||
{
|
||||
GroupedSM<SM_UNLIT>::MeshSet.push_back(mesh);
|
||||
GroupedSM<SM_UNLIT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_UNLIT>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
}
|
||||
|
||||
if (!ShadedMesh[SM_DETAILS].empty())
|
||||
glUseProgram(MeshShader::DetailledObjectPass2Shader::Program);
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_DETAILS].size(); i++)
|
||||
drawSolidPass2(*ShadedMesh[SM_DETAILS][i], SM_DETAILS);
|
||||
for (GLMesh *mesh : ShadedMesh[SM_DETAILS])
|
||||
{
|
||||
GroupedSM<SM_DETAILS>::MeshSet.push_back(mesh);
|
||||
GroupedSM<SM_DETAILS>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_DETAILS>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@ protected:
|
||||
std::vector<GLMesh *> TransparentMesh[TM_COUNT];
|
||||
std::vector<GLMesh> GLmeshes;
|
||||
core::matrix4 ModelViewProjectionMatrix, TransposeInverseModelView;
|
||||
void drawSolidPass1(const GLMesh &mesh, GeometricMaterial type);
|
||||
void drawSolidPass2(const GLMesh &mesh, ShadedMaterial type);
|
||||
void cleanGLMeshes();
|
||||
public:
|
||||
STKAnimatedMesh(irr::scene::IAnimatedMesh* mesh, irr::scene::ISceneNode* parent,
|
||||
|
||||
@@ -219,6 +219,8 @@ core::vector3df getWind()
|
||||
return m_speed * vector3df(1., 0., 0.) * cos(time);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void drawObjectPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView)
|
||||
{
|
||||
irr_driver->IncreaseObjectCount();
|
||||
|
||||
@@ -67,12 +67,56 @@ bool isObject(video::E_MATERIAL_TYPE type);
|
||||
core::vector3df getWind();
|
||||
|
||||
// Pass 1 shader (ie shaders that outputs normals and depth)
|
||||
template<enum GeometricMaterial T>
|
||||
class GroupedFPSM
|
||||
{
|
||||
public:
|
||||
static std::vector<GLMesh *> MeshSet;
|
||||
static std::vector<core::matrix4> MVPSet, TIMVSet;
|
||||
|
||||
static void reset()
|
||||
{
|
||||
MeshSet.clear();
|
||||
MVPSet.clear();
|
||||
TIMVSet.clear();
|
||||
}
|
||||
};
|
||||
|
||||
template<enum GeometricMaterial T>
|
||||
std::vector<GLMesh *> GroupedFPSM<T>::MeshSet;
|
||||
template<enum GeometricMaterial T>
|
||||
std::vector<core::matrix4> GroupedFPSM<T>::MVPSet;
|
||||
template<enum GeometricMaterial T>
|
||||
std::vector<core::matrix4> GroupedFPSM<T>::TIMVSet;
|
||||
|
||||
void drawObjectPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView);
|
||||
void drawNormalPass(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView);
|
||||
void drawObjectRefPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, const core::matrix4 &TextureMatrix);
|
||||
void drawGrassPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, core::vector3df windDir);
|
||||
|
||||
// Pass 2 shader (ie shaders that outputs final color)
|
||||
template<enum ShadedMaterial T>
|
||||
class GroupedSM
|
||||
{
|
||||
public:
|
||||
static std::vector<GLMesh *> MeshSet;
|
||||
static std::vector<core::matrix4> MVPSet, TIMVSet;
|
||||
|
||||
static void reset()
|
||||
{
|
||||
MeshSet.clear();
|
||||
MVPSet.clear();
|
||||
TIMVSet.clear();
|
||||
}
|
||||
};
|
||||
|
||||
template<enum ShadedMaterial T>
|
||||
std::vector<GLMesh *> GroupedSM<T>::MeshSet;
|
||||
template<enum ShadedMaterial T>
|
||||
std::vector<core::matrix4> GroupedSM<T>::MVPSet;
|
||||
template<enum ShadedMaterial T>
|
||||
std::vector<core::matrix4> GroupedSM<T>::TIMVSet;
|
||||
|
||||
void drawDetailledObjectPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix);
|
||||
void drawObjectPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix);
|
||||
void drawUntexturedObject(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix);
|
||||
|
||||
@@ -336,21 +336,27 @@ void STKMeshSceneNode::render()
|
||||
glDisable(GL_CULL_FACE);
|
||||
ModelViewProjectionMatrix = computeMVP(AbsoluteTransformation);
|
||||
TransposeInverseModelView = computeTIMV(AbsoluteTransformation);
|
||||
|
||||
if (!GeometricMesh[FPSM_DEFAULT].empty())
|
||||
glUseProgram(MeshShader::ObjectPass1Shader::Program);
|
||||
for (unsigned i = 0; i < GeometricMesh[FPSM_DEFAULT].size(); i++)
|
||||
drawSolidPass1(*GeometricMesh[FPSM_DEFAULT][i], FPSM_DEFAULT);
|
||||
{
|
||||
|
||||
GroupedFPSM<FPSM_DEFAULT>::MeshSet.push_back(GeometricMesh[FPSM_DEFAULT][i]);
|
||||
GroupedFPSM<FPSM_DEFAULT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedFPSM<FPSM_DEFAULT>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
}
|
||||
|
||||
if (!GeometricMesh[FPSM_ALPHA_REF_TEXTURE].empty())
|
||||
glUseProgram(MeshShader::ObjectRefPass1Shader::Program);
|
||||
for (unsigned i = 0; i < GeometricMesh[FPSM_ALPHA_REF_TEXTURE].size(); i++)
|
||||
drawSolidPass1(*GeometricMesh[FPSM_ALPHA_REF_TEXTURE][i], FPSM_ALPHA_REF_TEXTURE);
|
||||
{
|
||||
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MeshSet.push_back(GeometricMesh[FPSM_ALPHA_REF_TEXTURE][i]);
|
||||
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
}
|
||||
|
||||
if (!GeometricMesh[FPSM_NORMAL_MAP].empty())
|
||||
glUseProgram(MeshShader::NormalMapShader::Program);
|
||||
for (unsigned i = 0; i < GeometricMesh[FPSM_NORMAL_MAP].size(); i++)
|
||||
drawSolidPass1(*GeometricMesh[FPSM_NORMAL_MAP][i], FPSM_NORMAL_MAP);
|
||||
{
|
||||
GroupedFPSM<FPSM_NORMAL_MAP>::MeshSet.push_back(GeometricMesh[FPSM_NORMAL_MAP][i]);
|
||||
GroupedFPSM<FPSM_NORMAL_MAP>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedFPSM<FPSM_NORMAL_MAP>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
}
|
||||
|
||||
if (!GeometricMesh[FPSM_GRASS].empty())
|
||||
glUseProgram(MeshShader::GrassPass1Shader::Program);
|
||||
@@ -367,51 +373,66 @@ void STKMeshSceneNode::render()
|
||||
if (reload_each_frame)
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
if (!ShadedMesh[SM_DEFAULT].empty())
|
||||
glUseProgram(MeshShader::ObjectPass2Shader::Program);
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_DEFAULT].size(); i++)
|
||||
drawSolidPass2(*ShadedMesh[SM_DEFAULT][i], SM_DEFAULT);
|
||||
{
|
||||
GroupedSM<SM_DEFAULT>::MeshSet.push_back(ShadedMesh[SM_DEFAULT][i]);
|
||||
GroupedSM<SM_DEFAULT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_DEFAULT>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
}
|
||||
|
||||
if (!ShadedMesh[SM_ALPHA_REF_TEXTURE].empty())
|
||||
glUseProgram(MeshShader::ObjectRefPass2Shader::Program);
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_ALPHA_REF_TEXTURE].size(); i++)
|
||||
drawSolidPass2(*ShadedMesh[SM_ALPHA_REF_TEXTURE][i], SM_ALPHA_REF_TEXTURE);
|
||||
{
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::MeshSet.push_back(ShadedMesh[SM_ALPHA_REF_TEXTURE][i]);
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
}
|
||||
|
||||
if (!ShadedMesh[SM_RIMLIT].empty())
|
||||
glUseProgram(MeshShader::ObjectRimLimitShader::Program);
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_RIMLIT].size(); i++)
|
||||
drawSolidPass2(*ShadedMesh[SM_RIMLIT][i], SM_RIMLIT);
|
||||
{
|
||||
GroupedSM<SM_RIMLIT>::MeshSet.push_back(ShadedMesh[SM_RIMLIT][i]);
|
||||
GroupedSM<SM_RIMLIT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_RIMLIT>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
}
|
||||
|
||||
|
||||
if (!ShadedMesh[SM_SPHEREMAP].empty())
|
||||
glUseProgram(MeshShader::SphereMapShader::Program);
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_SPHEREMAP].size(); i++)
|
||||
drawSolidPass2(*ShadedMesh[SM_SPHEREMAP][i], SM_SPHEREMAP);
|
||||
{
|
||||
GroupedSM<SM_SPHEREMAP>::MeshSet.push_back(ShadedMesh[SM_SPHEREMAP][i]);
|
||||
GroupedSM<SM_SPHEREMAP>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_SPHEREMAP>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
}
|
||||
|
||||
if (!ShadedMesh[SM_SPLATTING].empty())
|
||||
glUseProgram(MeshShader::SplattingShader::Program);
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_SPLATTING].size(); i++)
|
||||
drawSolidPass2(*ShadedMesh[SM_SPLATTING][i], SM_SPLATTING);
|
||||
for (GLMesh *mesh : ShadedMesh[SM_SPLATTING])
|
||||
{
|
||||
GroupedSM<SM_SPLATTING>::MeshSet.push_back(mesh);
|
||||
GroupedSM<SM_SPLATTING>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_SPLATTING>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
}
|
||||
|
||||
for (GLMesh *mesh : ShadedMesh[SM_UNLIT])
|
||||
{
|
||||
GroupedSM<SM_UNLIT>::MeshSet.push_back(mesh);
|
||||
GroupedSM<SM_UNLIT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_UNLIT>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
}
|
||||
|
||||
for (GLMesh *mesh : ShadedMesh[SM_DETAILS])
|
||||
{
|
||||
GroupedSM<SM_DETAILS>::MeshSet.push_back(mesh);
|
||||
GroupedSM<SM_DETAILS>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_DETAILS>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
}
|
||||
|
||||
if (!ShadedMesh[SM_GRASS].empty())
|
||||
glUseProgram(MeshShader::GrassPass2Shader::Program);
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_GRASS].size(); i++)
|
||||
drawSolidPass2(*ShadedMesh[SM_GRASS][i], SM_GRASS);
|
||||
|
||||
if (!ShadedMesh[SM_UNLIT].empty())
|
||||
glUseProgram(MeshShader::ObjectUnlitShader::Program);
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_UNLIT].size(); i++)
|
||||
drawSolidPass2(*ShadedMesh[SM_UNLIT][i], SM_UNLIT);
|
||||
|
||||
if (!ShadedMesh[SM_CAUSTICS].empty())
|
||||
glUseProgram(MeshShader::CausticsShader::Program);
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_CAUSTICS].size(); i++)
|
||||
drawSolidPass2(*ShadedMesh[SM_CAUSTICS][i], SM_CAUSTICS);
|
||||
|
||||
if (!ShadedMesh[SM_DETAILS].empty())
|
||||
glUseProgram(MeshShader::DetailledObjectPass2Shader::Program);
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_DETAILS].size(); i++)
|
||||
drawSolidPass2(*ShadedMesh[SM_DETAILS][i], SM_DETAILS);
|
||||
|
||||
if (!ShadedMesh[SM_UNTEXTURED].empty())
|
||||
glUseProgram(MeshShader::UntexturedObjectShader::Program);
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_UNTEXTURED].size(); i++)
|
||||
|
||||
Reference in New Issue
Block a user