I'm make a space strategy game and when loading the models i'm trying to get it to automatically search though all textures and then search for any textures with the same name but have an extra L.bmp at the end.
Example is the BlitzMax code that i've done so far, but currently i only seem to be able to get the layer 0 texture to work as a lightmap as well as the color map, can't seem to color with layer 0 and light with layer 1 texture?
Code: Select all
Local MC:Int
For Mc = 0 To ISceneNode.GetMaterialCount() - 1
Local Mat:SMaterial = ISceneNode.GetMaterial(Mc)
Local Tes:ITexture = Mat.getTexture(0)
' Find the texture name and look for any light maps for it
Local LightMap:ITexture = MyDriver.getTexture(Left(Tes.getName(), Len(Tes.getName()) - 4) + "L.bmp")
If LightMap <> Null
Local NMat:SMaterial = ISceneNode.GetMaterial(Mc)
'
' Local MBuffer:IMeshBuffer = CMesh.getMesh(0).getMeshBuffer(0)
'NMat = MBuffer.getMaterial()
NMat.setTexture(0, Tes)
NMat.setTexture(1, LightMap)
NMat.setMaterialType(EMT_LIGHTMAP_ADD)
'NMat.setMaterialTypeParam(2)
End If
NextAny help would be very appreciated,
thanks