static void SetObject(OBJECT *obj, void *data) { MATRIX m; UNDO_TRANSFORM_OBJECT *cur; if(obj) { cur = ((TRANS_DATA*)data)->root; m.SetOMatrix(&obj->orient_x, &obj->orient_y, &obj->orient_z); while(cur) { if(obj == cur->object) { obj->SetActiveObject(((TRANS_DATA*)data)->display, &((TRANS_DATA*)data)->stack, TRUE); obj->SetObject(((TRANS_DATA*)data)->display, &((TRANS_DATA*)data)->display->pos, &((TRANS_DATA*)data)->display->orient_x, &((TRANS_DATA*)data)->display->orient_y, &((TRANS_DATA*)data)->display->orient_z, &((TRANS_DATA*)data)->display->size); break; } cur = (UNDO_TRANSFORM_OBJECT*)cur->GetNext(); } ((TRANS_DATA*)data)->stack.Push(&m); } else { ((TRANS_DATA*)data)->stack.Pop(); } }
/************* * DESCRIPTION: sets the new object specs * INPUT: disp pointer to display structure * pos translate factor * ox,oy,oz rotate factor * size scale factor * OUTPUT: none *************/ void CAMERA::SetObject(DISPLAY *disp, VECTOR *pos, VECTOR *ox, VECTOR *oy, VECTOR *oz, VECTOR *size) { MATRIX m; if(disp) { if(disp->view->viewmode == VIEW_CAMERA) { VecAdd(pos,&this->pos,&disp->view->pos); if(!track) { InvOrient(ox, oy, oz, &disp->view->axis_x, &disp->view->axis_y, &disp->view->axis_z); m.SetOMatrix(&orient_x,&orient_y,&orient_z); m.MultVectMat(&disp->view->axis_x); m.MultVectMat(&disp->view->axis_y); m.MultVectMat(&disp->view->axis_z); } else { UpdateTracking(&disp->view->pos); InvOrient(&orient_x, &orient_y, &orient_z, &disp->view->axis_x, &disp->view->axis_y, &disp->view->axis_z); } } } SetVector(&bboxmin, -this->size.z*.5f, -this->size.z*.5f, -this->size.z); SetVector(&bboxmax, this->size.z*.5f, this->size.z*1.3f, this->size.z*1.5f); }
/************* * DESCRIPTION: convert rscn version 100 brushes and textures * INPUT: root surface root object * OUTPUT: - *************/ void SURFACE::ConvertV100(OBJECT *root) { BRUSH_OBJECT *brush; TEXTURE_OBJECT *texture; VECTOR ox,oy,oz; MATRIX m; InvOrient(&root->orient_x, &root->orient_y, &root->orient_z, &ox, &oy, &oz); m.SetOMatrix(&ox,&oy,&oz); brush = root->brush; while(brush) { VecSub(&brush->pos, &root->pos, &brush->pos); m.MultVectMat(&brush->orient_x); m.MultVectMat(&brush->orient_y); m.MultVectMat(&brush->orient_z); brush = (BRUSH_OBJECT*)brush->GetNext(); } texture = root->texture; while(texture) { VecSub(&texture->pos, &root->pos, &texture->pos); m.MultVectMat(&texture->orient_x); m.MultVectMat(&texture->orient_y); m.MultVectMat(&texture->orient_z); texture = (TEXTURE_OBJECT*)texture->GetNext(); } }