|
|
| |||||||
|
|
| |||||||
|
| ||||||||
| |||||||||
#include <vgutil.h> #include <vg.h>
void setObjectScale( vgObject *obj, float* xyzScale ){ // ------------------------------------------------------- // // Public Function // // Set the Scale of the vgObject using the XYZ scale // values passed in thru xyzScale[3] // // ------------------------------------------------------- vgMat scaleMat; double x,y,z,h,p,r;
// // Sanity check we need an object and scale // if( obj == NULL || xyzScale == NULL){ return; }
// // We need a Matrix stack so create one // vgMatStack *scaleStack = vgNewMatStack();
// // We need to grab the Real coordinate position // of the object // vgPosition *objPos = vgNewPos(); vgGetWCSPos ( obj, objPos ); vgGetPosVecD( objPos, &x, &y, &z, &h, &p, &r);
// // Set up the Matrix stack for the operation // required to set a scale matric on the object // vgPushMatStack( scaleStack);
vgTransMat( scaleStack, x, y, z);
vgRotMat( scaleStack, h, 'z' );
vgRotMat( scaleStack, p, 'x' );
vgRotMat( scaleStack, r, 'y' );
vgScaleMat( scaleStack, sxyz[0], sxyz[1], sxyz[2]);
// // Grab the accumlate matrix from the stack // vgGetMat( scaleStack, scaleMat );
// // Clear the stack // vgPopMatStack( scaleStack );
// // Apply the Matrix to the vgPos and then to the vgObject // vgPosMat( objPos, scaleMat ); vgPos( obj, objPos );
// // Now Free the dynamically create variables // vgDelMatStack( scaleStack ); vgDelPos( objPos );
} // setObjectScale
| ||
© Copyright 2004 Gordon Tomlinson All Rights Reserved. All logos, trademarks and copyrights in this site are property of their respective owner. |