Dynamically loading lightmaps

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
qez111
Posts: 54
Joined: Mon Apr 28, 2008 9:44 pm

Dynamically loading lightmaps

Post by qez111 »

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?
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Light map is just texture like diffuse map. It is stored in material, probably as texture layer 1, but than depends on material you use. You can change it any time.
qez111
Posts: 54
Joined: Mon Apr 28, 2008 9:44 pm

Post by qez111 »

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:

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));
         }

}

}
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.
pelonzudo
Posts: 20
Joined: Wed May 07, 2008 11:14 am

Post by pelonzudo »

I don't know if I'm correct but...

Code: Select all

if(node->getMaterial(a).getTexture(1)=="LightmapDay0.bmp") 
you are comparing a ITexture* with a string... Try

Code: Select all

node->getMaterial(a).getTexture(1)->getName () 
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

you're trying to compare a texture (pointer) to a string, that won't work... ;)
try this:

Code: Select all

if(node->getMaterial(a).getTexture(1)->getName().equals_ignore_case("LightmapDay0.bmp") )
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply