GPUParticles: Use a better fake material that modelize well which states we touch.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14883 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
vincentlj 2014-01-02 01:06:21 +00:00
parent 2a1a28c459
commit c25e1c2472
2 changed files with 7 additions and 2 deletions

View File

@ -240,6 +240,11 @@ ParticleSystemProxy::ParticleSystemProxy(bool createDefaultEmitter,
const core::vector3df& rotation,
const core::vector3df& scale) : CParticleSystemSceneNode(createDefaultEmitter, parent, mgr, id, position, rotation, scale), m_alpha_additive(false) {
initGL();
fakemat.Lighting = false;
fakemat.ZWriteEnable = false;
fakemat.MaterialType = irr_driver->getShader(ES_RAIN);
fakemat.Thickness = 200;
fakemat.setTexture(0, getMaterial(0).getTexture(0));
glGenBuffers(1, &initial_values_buffer);
glGenBuffers(2, tfb_buffers);
if (quad_vertex_buffer)
@ -650,7 +655,6 @@ void ParticleSystemProxy::draw()
glDisableVertexAttribArray(attrib_sz);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glActiveTexture(GL_TEXTURE0);
glDepthMask(GL_TRUE);
glEnable(GL_CULL_FACE);
}
@ -664,7 +668,7 @@ void ParticleSystemProxy::render() {
draw();
// We need to force irrlicht to update its internal states
irr::video::IVideoDriver * const drv = irr_driver->getVideoDriver();
drv->setMaterial(getMaterial(0));
drv->setMaterial(fakemat);
static_cast<irr::video::COpenGLDriver*>(drv)->setRenderStates3DMode();
}

View File

@ -29,6 +29,7 @@ public:
class ParticleSystemProxy : public scene::CParticleSystemSceneNode {
protected:
video::SMaterial fakemat;
GLuint tfb_buffers[2], initial_values_buffer;
bool m_alpha_additive;