Dynamically loading lightmaps
Dynamically loading lightmaps
To simulate a day-to-evening transition, I plan to render a lightmap for every 2 hours or so. But I am wondering how I could load the lightmaps dynamically. Do I have to re-load the scene node again (which would require some loading time while the application is running). or is there any other method to simply load another set of map, which would have already been loaded when the node was created?
Yes, but i want to know how to compare what kind of material is loaded in a particular texture slot.
Basically my scene has upto 4 lightmaps, and each material has a particular lightmap applied.
Lets say I have X materials,
And I have LightmapDay0.bmp LightmapDay1.bmp LightmapDay2.bmp LightmapDay3.bmp (and similarly, LightmapNoon0.bmp,LightmapEvening etc.)
The scene is initially loaded with LightmapDay maps.
Now to load LightmapNoon, I am trying run a "for" loop and find and replace LightmapDay0.bmp with LightmapNoon0.bmp, LightmapDay3.bmp with lightmapNoon3.bmp and so on.
code:
But I get a compiler error on the "if" comparison line. What is the method to compare whether a particular texture is loaded in the material?
Thanks.
Basically my scene has upto 4 lightmaps, and each material has a particular lightmap applied.
Lets say I have X materials,
And I have LightmapDay0.bmp LightmapDay1.bmp LightmapDay2.bmp LightmapDay3.bmp (and similarly, LightmapNoon0.bmp,LightmapEvening etc.)
The scene is initially loaded with LightmapDay maps.
Now to load LightmapNoon, I am trying run a "for" loop and find and replace LightmapDay0.bmp with LightmapNoon0.bmp, LightmapDay3.bmp with lightmapNoon3.bmp and so on.
code:
Code: Select all
if (receiver.IsKeyDown(KEY_KEY_C))
{
for(int a=0;a<=(node->getMaterialCount()-1);a++)
{
SMaterial noonLM0;
noonLM0.setTexture(1,driver->getTexture("LightmapNoon0.bmp"));
if(node->getMaterial(a).getTexture(1)=="LightmapDay0.bmp")
{
//Lightmap found
node->getMaterial(a).setTexture(1,noonLM0.getTexture(1));
}
}
}Thanks.
I don't know if I'm correct but...
you are comparing a ITexture* with a string... Try
Code: Select all
if(node->getMaterial(a).getTexture(1)=="LightmapDay0.bmp")
Code: Select all
node->getMaterial(a).getTexture(1)->getName ()
you're trying to compare a texture (pointer) to a string, that won't work... 
try this:
try this:
Code: Select all
if(node->getMaterial(a).getTexture(1)->getName().equals_ignore_case("LightmapDay0.bmp") )while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:

http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java