void ParticleSystemProxy::setEmitter(scene::IParticleEmitter* emitter) { CParticleSystemSceneNode::setEmitter(emitter); if (!emitter || !isGPUParticleType(emitter->getType())) return; has_height_map = false; flip = false; count = emitter->getMaxParticlesPerSecond() * emitter->getMaxLifeTime() / 1000; switch (emitter->getType()) { case scene::EPET_POINT: generateParticlesFromPointEmitter(emitter); break; case scene::EPET_BOX: generateParticlesFromBoxEmitter(static_cast<scene::IParticleBoxEmitter *>(emitter)); break; case scene::EPET_SPHERE: generateParticlesFromSphereEmitter(static_cast<scene::IParticleSphereEmitter *>(emitter)); break; default: assert(0 && "Wrong particle type"); } glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); video::ITexture *tex = getMaterial(0).getTexture(0); compressTexture(tex, true, true); texture = getTextureGLuint(getMaterial(0).getTexture(0)); }
void ParticleSystemProxy::render() { if (!getEmitter() || !isGPUParticleType(getEmitter()->getType())) { CParticleSystemSceneNode::render(); return; } if (!current_rendering_vao || !non_current_rendering_vao || !current_simulation_vao || !non_current_simulation_vao) generateVAOs(); simulate(); draw(); }
void ParticleSystemProxy::render() { if (!getEmitter() || !isGPUParticleType(getEmitter()->getType())) { CParticleSystemSceneNode::render(); return; } simulate(); draw(); // We need to force irrlicht to update its internal states irr::video::IVideoDriver * const drv = irr_driver->getVideoDriver(); drv->setMaterial(fakemat); static_cast<irr::video::COpenGLDriver*>(drv)->setRenderStates3DMode(); }
void ParticleSystemProxy::setEmitter(scene::IParticleEmitter* emitter) { CParticleSystemSceneNode::setEmitter(emitter); if (!emitter || !isGPUParticleType(emitter->getType())) return; has_height_map = false; flip = false; // Pass a fake material type to force irrlicht to update its internal states on rendering setMaterialType(irr_driver->getShader(ES_RAIN)); setAutomaticCulling(0); count = emitter->getMaxParticlesPerSecond() * emitter->getMaxLifeTime() / 1000; switch (emitter->getType()) { case scene::EPET_POINT: generateParticlesFromPointEmitter(emitter); break; case scene::EPET_BOX: generateParticlesFromBoxEmitter(static_cast<scene::IParticleBoxEmitter *>(emitter)); break; case scene::EPET_SPHERE: generateParticlesFromSphereEmitter(static_cast<scene::IParticleSphereEmitter *>(emitter)); break; default: assert(0 && "Wrong particle type"); } glBindBuffer(GL_ARRAY_BUFFER, 0); texture = getTextureGLuint(getMaterial(0).getTexture(0)); normal_and_depth = getTextureGLuint(irr_driver->getRTT(RTT_NORMAL_AND_DEPTH)); if (SimpleSimulationShader::Program && SimpleParticleRender::Program && FlipParticleRender::Program && HeightmapSimulationShader::Program) return; SimpleSimulationShader::init(); HeightmapSimulationShader::init(); SimpleParticleRender::init(); FlipParticleRender::init(); }