Changing the depth_check of a particle system at run-time

Problems building or running the engine, queries about how to use features etc.
User avatar
suny2000
Halfling
Posts: 89
Joined: Sun Sep 06, 2009 12:36 pm
x 18

Changing the depth_check of a particle system at run-time

Post by suny2000 »

Ogre Version: :?: 14.2

Hi,

I would like to enable or disable the depth_check on of a particle emitter material at run-time, but I can't find a way to do it:
I can access the material name of an emitter but not the material itself.
Is there a way to do this?

http://bulostudio.com: website and devlog of a small indie studio working on SHMUP CREATOR
https://twitter.com/bulostudio : follow me on twitter!
rpgplayerrobin
Orc Shaman
Posts: 715
Joined: Wed Mar 18, 2009 3:03 am
x 396

Re: Changing the depth_check of a particle system at run-time

Post by rpgplayerrobin »

If you can get the material name, simply get the material like this:

Code: Select all

MaterialPtr tmpMaterial = MaterialManager::getSingletonPtr()->getByName(materialName);

But if you need to call it like 10000 times per frame (if you do it through an affector or something), I would make sure to cache it somehow.

User avatar
suny2000
Halfling
Posts: 89
Joined: Sun Sep 06, 2009 12:36 pm
x 18

Re: Changing the depth_check of a particle system at run-time

Post by suny2000 »

This is what I tried before, but I didn't do it at the right place in my code.
It's working now.
Thanks!
S.

http://bulostudio.com: website and devlog of a small indie studio working on SHMUP CREATOR
https://twitter.com/bulostudio : follow me on twitter!