void setup_transforms_bbox(LLBBox bbox) { // translate to center LLVector3 center = bbox.getCenterAgent(); gGL.translatef(center.mV[VX], center.mV[VY], center.mV[VZ]); // rotate LLQuaternion rotation = bbox.getRotation(); F32 angle_radians, x, y, z; rotation.getAngleAxis(&angle_radians, &x, &y, &z); gGL.flush(); gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z); // scale LLVector3 scale = bbox.getMaxLocal() - bbox.getMinLocal(); gGL.scalef(scale.mV[VX], scale.mV[VY], scale.mV[VZ]); }
void setup_transforms_bbox(LLBBox bbox) { // translate to center LLVector3 center = bbox.getCenterAgent(); gGL.translatef(center.mV[VX], center.mV[VY], center.mV[VZ]); // rotate LLQuaternion rotation = bbox.getRotation(); F32 angle_radians, x, y, z; rotation.getAngleAxis(&angle_radians, &x, &y, &z); // gGL has no rotate method (despite having translate and scale) presumably because // its authors smoke crack. so we hack. gGL.flush(); glRotatef(angle_radians * RAD_TO_DEG, x, y, z); // scale LLVector3 scale = bbox.getMaxLocal() - bbox.getMinLocal(); gGL.scalef(scale.mV[VX], scale.mV[VY], scale.mV[VZ]); }