Disable shininess

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
Locked
jingquan
Posts: 222
Joined: Sun Aug 20, 2006 4:10 am
Contact:

Disable shininess

Post by jingquan »

How can i disable shininess (specular highlight) of a material in .NET?

I tried

Code: Select all

mapnode.GetMaterial(0).Shininess = 0
but an error showed up:

Code: Select all

Expression is a value and therefore cannot be the target of an assignment.
Thanks in advance.
Riki
Posts: 30
Joined: Tue Feb 27, 2007 9:12 pm
Location: Croatia

Post by Riki »

Hi jingquan,

The expression mapnode.GetMaterial(0) creates a tem variable and by writting:
mapnode.GetMaterial(0).Shininess = ... you are trying to change the value of a temp variable -which of course is useless thats why the compiler cathces this situation!

Now back to your problem.
In order to change such stuff you must cache the variable first:
Material mat = mapnode.GetMaterial(0);
mat.whatever_u_have_to_change = some_other_value;
The last step would be to reassign the cached variable back:
mapnode.SetMaterial(0, mat);

Have a good day
jingquan
Posts: 222
Joined: Sun Aug 20, 2006 4:10 am
Contact:

Post by jingquan »

Thanks alot for your solution, I understand how it works now. However my mesh still looks washed out.

BTW, what does the 0 in the mapnode.GetMaterial(0) stands for?
Riki
Posts: 30
Joined: Tue Feb 27, 2007 9:12 pm
Location: Croatia

Post by Riki »

jingquan wrote:BTW, what does the 0 in the mapnode.GetMaterial(0) stands for?
It is the index of the assigned material. Since you can set more than one material (I think 4 but Im not 100% sure) to the SceneNode you have to tell which one you are changing.

Regards
Locked