| 92 |
|
|
| 93 |
|
if (wdb == NULL) /* no geometry section? */ |
| 94 |
|
return SDEnone; |
| 95 |
+ |
if ((geom = ezxml_child(wdb, "Name")) != NULL) { |
| 96 |
+ |
strncpy(sd->matn, ezxml_txt(geom), SDnameLn); |
| 97 |
+ |
if (sd->matn[SDnameLn-1]) |
| 98 |
+ |
strcpy(sd->matn+(SDnameLn-4), "..."); |
| 99 |
+ |
} |
| 100 |
+ |
if ((geom = ezxml_child(wdb, "Manufacturer")) != NULL) { |
| 101 |
+ |
strncpy(sd->makr, ezxml_txt(geom), SDnameLn); |
| 102 |
+ |
if (sd->makr[SDnameLn-1]) |
| 103 |
+ |
strcpy(sd->makr+(SDnameLn-4), "..."); |
| 104 |
+ |
} |
| 105 |
|
sd->dim[0] = sd->dim[1] = sd->dim[2] = .0; |
| 106 |
+ |
SDerrorDetail[0] = '\0'; |
| 107 |
|
if ((geom = ezxml_child(wdb, "Width")) != NULL) |
| 108 |
|
sd->dim[0] = atof(ezxml_txt(geom)) * |
| 109 |
|
to_meters(ezxml_attr(geom, "unit")); |
| 114 |
|
sd->dim[2] = atof(ezxml_txt(geom)) * |
| 115 |
|
to_meters(ezxml_attr(geom, "unit")); |
| 116 |
|
if ((sd->dim[0] < 0) | (sd->dim[1] < 0) | (sd->dim[2] < 0)) { |
| 117 |
< |
sprintf(SDerrorDetail, "Negative size in \"%s\"", sd->name); |
| 117 |
> |
if (!SDerrorDetail[0]) |
| 118 |
> |
sprintf(SDerrorDetail, "Negative dimension in \"%s\"", |
| 119 |
> |
sd->name); |
| 120 |
|
return SDEdata; |
| 121 |
|
} |
| 122 |
|
if ((geom = ezxml_child(wdb, "Geometry")) == NULL || |
| 134 |
|
return SDEsupport; |
| 135 |
|
} |
| 136 |
|
cfact = to_meters(ezxml_attr(geom, "unit")); |
| 137 |
+ |
if (cfact <= 0) |
| 138 |
+ |
return SDEformat; |
| 139 |
|
sd->mgf = (char *)malloc(strlen(mgfstr)+32); |
| 140 |
|
if (sd->mgf == NULL) { |
| 141 |
|
strcpy(SDerrorDetail, "Out of memory in SDloadGeometry"); |
| 179 |
|
} |
| 180 |
|
wtl = ezxml_child(ezxml_child(fl, "Optical"), "Layer"); |
| 181 |
|
if (wtl == NULL) { |
| 182 |
< |
sprintf(SDerrorDetail, "BSDF \"%s\": no optical layer'", |
| 182 |
> |
sprintf(SDerrorDetail, "BSDF \"%s\": no optical layers'", |
| 183 |
|
sd->name); |
| 184 |
|
ezxml_free(fl); |
| 185 |
|
return SDEformat; |