Change texture in realtime

caharim

30-04-2007 22:32:40

Just to make shure, that I got everything right:
Can I add a material like a brush after creating the whole world? I'm using SplattingShader, because the others don't work well.
Everywhere I can read that it's possible to modify the texturing, but haven't found an example ...

caharim

12-05-2007 17:58:16

I tried to change the texture as following. But this approach doen't seam to work. Has anybody an idea how to solve this?


String s;
mSceneMgr->getOption("TextureNameLayer1", &s);
String s2 = "splatting_snow.png";
mSceneMgr->setOption("TextureNameLayer1", &s2);

Ogre::MaterialManager::getSingleton().unload("TextureNameLayer1");
Ogre::MaterialManager::getSingleton().load("TextureNameLayer1","PLSM2");

Ogre::MaterialManager::getSingleton().reloadAll();

int x1 = 0;
mSceneMgr->getOption("CurrentCameraPageX", &x1);
int z1 = 0;
mSceneMgr->getOption("CurrentCameraPageZ", &z1);

mSceneMgr->setOption("PageUpdate", &Vector2(x1,z1));

Jon

12-05-2007 20:59:30

I'm not following what you are trying to do, but taking a guess based on "modifying the texturing"

Perhaps the following is what you are looking for:

void PagingLandScapeRenderable::setMaterial(const MaterialPtr &mat)


This can reassign the material for a renderable (ie tile) at runtime.

If that isn't what you were looking for, please give an example of the type of modification you are looking to do.

caharim

17-05-2007 14:03:31

In my terrain I use 4 different textures. Now I like to replace them in realtime. After an update of the current tile, the terrain looks completly different (for example to change the grass to snow).