Page 1 of 1

Disable shininess

Posted: Sun Mar 11, 2007 4:57 am
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.

Posted: Sun Mar 11, 2007 9:54 am
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

Posted: Mon Mar 12, 2007 8:22 am
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?

Posted: Tue Mar 13, 2007 7:00 am
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