Colour Change

oackland

25-09-2012 16:40:57

Hello all,

In my project, I want to change the colour of an entity (the floor). Here is my code :

Public Sub CouleurCarrelage(ByVal NouvelleCouleur As Color)
Dim i As UShort = 0

Dim Mat As Material = mySceneManager.GetEntity("GroundEntity").GetSubEntity(i).GetMaterial
Mat.GetTechnique(i).GetPass(i).SetAmbient(1, 0, 0)
Mat.GetTechnique(i).GetPass(i).SetDiffuse(1, 0, 0, 1)
mySceneManager.GetEntity("GroundEntity").SetMaterialName(Mat.Name)
Mat.Dispose()
End Sub


I also tried to obtain the material directly :


Dim Mat As MaterialPtr = MaterialManager.Singleton.GetByName("Carrelage")


When I read again the Ambient and Diffuse properties are correctly changed but there is no effect visually speaking.

If you can help me,

thank you,

Oackland

oackland

26-09-2012 09:21:29

Hi,

I answer to myself.
In fact, I made a mistake :oops: . In my scene I have done a reflective floor with then a Rtt meaning that the first created floor was not visible.
All worked well, but the modified material was not visible !!!

All worked well now !