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.

Disable shininess

Postby jingquan » Sun Mar 11, 2007 4:57 am

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.
jingquan
 
Posts: 222
Joined: Sun Aug 20, 2006 4:10 am

Postby Riki » Sun Mar 11, 2007 9:54 am

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
Riki
 
Posts: 30
Joined: Tue Feb 27, 2007 9:12 pm
Location: Croatia

Postby jingquan » Mon Mar 12, 2007 8:22 am

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?
jingquan
 
Posts: 222
Joined: Sun Aug 20, 2006 4:10 am

Postby Riki » Tue Mar 13, 2007 7:00 am

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
Riki
 
Posts: 30
Joined: Tue Feb 27, 2007 9:12 pm
Location: Croatia


Return to Irrlicht.NET

Who is online

Users browsing this forum: No registered users and 0 guests