phr00t
25-08-2009 01:27:47
Hey all,
I am working on a game using Mogre 1.4.8 and I am getting stuck![Sad :(]({SMILIES_PATH}/icon_sad.gif)
I want a material to have a texture (loaded from a PNG), tinted to a certain color (texture with a red tint), and then accept lighting (texture with a red tint, dark in a low-lit area). I can't seem to get all 3 to work... this is my current code:
This gives me a tinted texture material, but it ignores lighting -- it stays fully illuminated. SetColourOperationEx does the tint, but this seems to break lighting. How do I do this?
Thank you all in advance! Mogre has been pretty sweet so far, I hope it doesn't die!
I am working on a game using Mogre 1.4.8 and I am getting stuck
![Sad :(]({SMILIES_PATH}/icon_sad.gif)
I want a material to have a texture (loaded from a PNG), tinted to a certain color (texture with a red tint), and then accept lighting (texture with a red tint, dark in a low-lit area). I can't seem to get all 3 to work... this is my current code:
Dim moMaterial As Mogre.MaterialPtr = Mogre.MaterialManager.Singleton.Create(name, "General")
moMaterial.SetLightingEnabled(True)
If txture.Length > 0 Then
Dim txt As Mogre.TextureUnitState = moMaterial.GetTechnique(CType(0, UShort)).GetPass(CType(0, UShort)).CreateTextureUnitState(txture)
txt.SetTextureScale(1, 0.395)
txt.SetTextureScroll(0, -0.21)
txt.SetTextureFiltering(Mogre.FilterOptions.FO_ANISOTROPIC, Mogre.FilterOptions.FO_ANISOTROPIC, Mogre.FilterOptions.FO_ANISOTROPIC)
txt.SetColourOperationEx(Mogre.LayerBlendOperationEx.LBX_BLEND_MANUAL, Mogre.LayerBlendSource.LBS_MANUAL, Mogre.LayerBlendSource.LBS_TEXTURE, New Mogre.ColourValue(r, g, b, a))
Else
moMaterial.GetTechnique(CType(0, UShort)).GetPass(CType(0, UShort)).SetDiffuse(r, g, b, a)
End If
This gives me a tinted texture material, but it ignores lighting -- it stays fully illuminated. SetColourOperationEx does the tint, but this seems to break lighting. How do I do this?
Thank you all in advance! Mogre has been pretty sweet so far, I hope it doesn't die!