9 |
|
*/ |
10 |
|
|
11 |
|
#include <stdio.h> |
12 |
+ |
#include <math.h> |
13 |
|
#include <string.h> |
14 |
|
#include "parser.h" |
15 |
|
#include "lookup.h" |
135 |
|
c_cmaterial = (C_MATERIAL *)lp->data; |
136 |
|
if (ac == 3) { /* use default template */ |
137 |
|
*c_cmaterial = c_dfmaterial; |
138 |
+ |
c_cmaterial->name = lp->key; |
139 |
|
return(MG_OK); |
140 |
|
} |
141 |
|
lp = lu_find(&mat_tab, av[3]); /* lookup template */ |
144 |
|
if (lp->data == NULL) |
145 |
|
return(MG_EUNDEF); |
146 |
|
*c_cmaterial = *(C_MATERIAL *)lp->data; |
147 |
+ |
c_cmaterial->name = lp->key; |
148 |
+ |
c_cmaterial->clock = 1; |
149 |
|
if (ac > 4) |
150 |
|
return(MG_EARGC); |
151 |
|
return(MG_OK); |
158 |
|
if (c_cmaterial->rd < 0. | c_cmaterial->rd > 1.) |
159 |
|
return(MG_EILL); |
160 |
|
c_cmaterial->rd_c = *c_ccolor; |
161 |
+ |
c_cmaterial->clock++; |
162 |
|
return(MG_OK); |
163 |
|
case MG_E_ED: /* set diffuse emittance */ |
164 |
|
if (ac != 2) |
169 |
|
if (c_cmaterial->ed < 0.) |
170 |
|
return(MG_EILL); |
171 |
|
c_cmaterial->ed_c = *c_ccolor; |
172 |
+ |
c_cmaterial->clock++; |
173 |
|
return(MG_OK); |
174 |
|
case MG_E_TD: /* set diffuse transmittance */ |
175 |
|
if (ac != 2) |
192 |
|
c_cmaterial->rs_a < 0.) |
193 |
|
return(MG_EILL); |
194 |
|
c_cmaterial->rs_c = *c_ccolor; |
195 |
+ |
c_cmaterial->clock++; |
196 |
|
return(MG_OK); |
197 |
|
case MG_E_TS: /* set specular transmittance */ |
198 |
|
if (ac != 3) |
205 |
|
c_cmaterial->ts_a < 0.) |
206 |
|
return(MG_EILL); |
207 |
|
c_cmaterial->ts_c = *c_ccolor; |
208 |
+ |
c_cmaterial->clock++; |
209 |
|
return(MG_OK); |
210 |
|
} |
211 |
|
return(MG_EUNK); |