+ if(is_csgop) {
+ c = node->child_list;
+ while(c) {
+ if((sub = load_object(c))) {
+ if(olist) {
+ otail->ob.next = sub;
+ otail = sub;
+ } else {
+ olist = otail = sub;
+ }
+ ++num_subobj;
+ }
+ c = c->next;
+ }
+
+ if(num_subobj != 2) {
+ goto err;
+ }
+ o->un.a = olist;
+ o->un.b = olist->ob.next;
+ olist->ob.next = 0;
+ }
+
+ if((avec = ts_get_attr_vec(node, "position", 0))) {
+ csg_translate(o, avec[0], avec[1], avec[2]);
+ }
+ if((avec = ts_get_attr_vec(node, "rotaxis", 0))) {
+ csg_rotate(o, ts_get_attr_num(node, "rotangle", 0.0f), avec[0], avec[1], avec[2]);
+ }
+ if((avec = ts_get_attr_vec(node, "scaling", 0))) {
+ csg_scale(o, avec[0], avec[1], avec[2]);
+ }
+ if((avec = ts_get_attr_vec(node, "target", 0))) {
+ /* don't move this before position */
+ float def_up[] = {0, 1, 0};
+ float *up = ts_get_attr_vec(node, "up", def_up);
+ float x = o->ob.xform[12];
+ float y = o->ob.xform[13];
+ float z = o->ob.xform[14];
+ csg_lookat(o, x, y, z, avec[0], avec[1], avec[2], up[0], up[1], up[2]);
+ }
+
+ if((avec = ts_get_attr_vec(node, "color", 0))) {
+ csg_color(o, avec[0], avec[1], avec[2]);
+ }
+ if((avec = ts_get_attr_vec(node, "emission", 0))) {
+ csg_emission(o, avec[0], avec[1], avec[2]);
+ }
+
+ csg_roughness(o, ts_get_attr_num(node, "roughness", o->ob.roughness));
+ csg_opacity(o, ts_get_attr_num(node, "opacity", o->ob.opacity));
+ csg_metallic(o, ts_get_attr_int(node, "metallic", o->ob.metallic));
+
+ return o;
+