| 105 |
|
c_ccname = NULL; |
| 106 |
|
return(MG_OK); |
| 107 |
|
} |
| 108 |
+ |
if (!isname(av[1])) |
| 109 |
+ |
return(MG_EILL); |
| 110 |
|
lp = lu_find(&clr_tab, av[1]); /* lookup context */ |
| 111 |
|
if (lp == NULL) |
| 112 |
|
return(MG_EMEM); |
| 223 |
|
c_cmname = NULL; |
| 224 |
|
return(MG_OK); |
| 225 |
|
} |
| 226 |
+ |
if (!isname(av[1])) |
| 227 |
+ |
return(MG_EILL); |
| 228 |
|
lp = lu_find(&mat_tab, av[1]); /* lookup context */ |
| 229 |
|
if (lp == NULL) |
| 230 |
|
return(MG_EMEM); |
| 263 |
|
*c_cmaterial = *(C_MATERIAL *)lp->data; |
| 264 |
|
c_cmaterial->clock = i + 1; |
| 265 |
|
return(MG_OK); |
| 266 |
+ |
case MG_E_IR: /* set index of refraction */ |
| 267 |
+ |
if (ac != 3) |
| 268 |
+ |
return(MG_EARGC); |
| 269 |
+ |
if (!isflt(av[1]) | !isflt(av[2])) |
| 270 |
+ |
return(MG_ETYPE); |
| 271 |
+ |
c_cmaterial->nr = atof(av[1]); |
| 272 |
+ |
c_cmaterial->ni = atof(av[2]); |
| 273 |
+ |
if (c_cmaterial->nr <= FTINY) |
| 274 |
+ |
return(MG_EILL); |
| 275 |
+ |
c_cmaterial->clock++; |
| 276 |
+ |
return(MG_OK); |
| 277 |
|
case MG_E_RD: /* set diffuse reflectance */ |
| 278 |
|
if (ac != 2) |
| 279 |
|
return(MG_EARGC); |
| 370 |
|
c_cvname = NULL; |
| 371 |
|
return(MG_OK); |
| 372 |
|
} |
| 373 |
+ |
if (!isname(av[1])) |
| 374 |
+ |
return(MG_EILL); |
| 375 |
|
lp = lu_find(&vtx_tab, av[1]); /* lookup context */ |
| 376 |
|
if (lp == NULL) |
| 377 |
|
return(MG_EMEM); |
| 606 |
|
} |
| 607 |
|
if (n > 1) |
| 608 |
|
va[i] /= (double)n; |
| 592 |
– |
if (va[i] < 0.) |
| 593 |
– |
return(MG_EILL); |
| 609 |
|
if (va[i] > scale) |
| 610 |
|
scale = va[i]; |
| 611 |
+ |
else if (va[i] < -scale) |
| 612 |
+ |
scale = -va[i]; |
| 613 |
|
} |
| 614 |
|
if (scale <= FTINY) |
| 615 |
|
return(MG_EILL); |