Go Back   AC3D Forums > Technical > AC3D Bugs and Problems
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 24th September 2013, 09:23 AM   #1
Geoffm
Junior Member
Member
 
Geoffm's Avatar
 
Join Date: Aug 2013
Location: London UK
Posts: 22
Exclamation PLugin writing

I am adding new materials to a model via the ac_plugin.h interface. I create a new material with the desired ambient colour; however it is supplied with a shininess of 128. There is no option to change the shininess of a material (or its transparency, specular colour etc) which is highly desirable.

I tried using Material template like this:
ACMaterialTemplate matt;
matt.shininess = 1.0;
matt.ambient.r = (float)rgb[0]/(npts);
matt.ambient.g = (float)rgb[1]/(npts);
matt.ambient.b = (float)rgb[2]/(npts);
icol = ac_palette_get_new_material_index(&matt);

but this creates new materials that are ambient = black. rgb is in the range 0,256 so I tried scaling all colours by dividing by 256, or by multiplying by 256 with no useful results. Except that sometimes the material editor would not allow the colour to be edited.

Is this a known bug, and can we have routines to access the shininess, transparency, and other colour properties please.

GWM
Geoffm is offline   Reply With Quote
Old 26th September 2013, 07:52 AM   #2
Geoffm
Junior Member
Member
 
Geoffm's Avatar
 
Join Date: Aug 2013
Location: London UK
Posts: 22
Default Re: PLugin writing

Aha I answer my own question.

ACrgb blck;
blck.r= blck.g=blck.b=0;
ACMaterial *num = ac_new_material_rgb(thergb); // material diffuse colour
ac_entity_set_float_value((ACEntity *)num, "shininess", 2.0);
ac_entity_set_rgb_value((ACEntity *)num, "specular", &blck);

changes the new material to have shininess of 2 and no specular colour component.
Geoffm is offline   Reply With Quote
Reply

Tags
bug, material, plugin

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 10:24 AM.


AC3D Forum
(C) Inivis Limited 2020