本文整理汇总了C++中STVector3::Transform方法的典型用法代码示例。如果您正苦于以下问题:C++ STVector3::Transform方法的具体用法?C++ STVector3::Transform怎么用?C++ STVector3::Transform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类STVector3
的用法示例。
在下文中一共展示了STVector3::Transform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawManipulator
void DrawManipulator(void)
{
// color
RGBR_f colorRed(1, 0, 0, 1);
RGBR_f colorGreen(0, 1, 0, 1);
RGBR_f colorBlue(0, 0, 1, 1);
RGBR_f colorWhite(1,1,1,1);
RGBR_f colorMagenta(1.0f,0.3f,1.0f, 1.0f);
RGBR_f colorGrey(0.2f,0.2f,0.2f, 1.0f);
// a, y and z axis
STVector3 xaxis = STVector3::eX;
STVector3 yaxis = STVector3::eY;
STVector3 zaxis = STVector3::eZ;
// camera basis
STVector3 up = pScene->GetCamera()->Up();
STVector3 right = pScene->GetCamera()->Right();
STVector3 dir = pScene->GetCamera()->LookAt();
STVector3 front;
front = front.Cross(right, xaxis);
front.Normalize();
// camera plane
float colx[4] = {1, 0, 0, 1};
float coly[4] = {0, 1, 0, 1};
float colz[4] = {0, 0, 1, 1};
float colall[4] = {1, 1, 1, 1};
float fct = 0.05f;
float fct2 = 0.83f;
STMatrix4 curModelMatrix;
curModelMatrix.EncodeI();
//------------------------------------------------------------------------------
// TO DO: Proj3_4 OpenGL
// Update the matrix transformation for the manipulator geometry
// Update curModelMatrix
//------------------------------------------------------------------------------
curModelMatrix.EncodeS(0.1, 0.1, 0.1);
//-------------------------------------------------------------------------------
// screen projection
ViewProjectionScreenSpace(curModelMatrix);
STVector3 origin(0,0,0);
curModelMatrix.GetT(&origin.x, &origin.y, &origin.z);
if(pScene->CurrentManipMode() == LOCAL) {
xaxis.Transform(curModelMatrix);
yaxis.Transform(curModelMatrix);
zaxis.Transform(curModelMatrix);
xaxis.Normalize();
yaxis.Normalize();
zaxis.Normalize();
}
// Rotations
if((pScene->CurrentManipGeometryState() == AXIS_ALL) ||
(pScene->CurrentManipGeometryState() == AXIS_ROTATIONALL)) {
STVector3 X_UP;
STVector3 X_RIGHT;
STVector3 X_FRONT;
STVector3 X_UP_sc;
STVector3 X_RIGHT_sc;
STVector3 X_FRONT_sc;
STVector3 planenorm(pScene->GetCamera()->Position() - origin);
planenorm.Normalize();
STVector4 camplane = vector4(planenorm,0);
// duplicate
X_RIGHT = right * ScreenFactor();
X_UP = up * ScreenFactor();
if(pScene->CurrentManipMotion() == ROTATE_DUPLICATE)
DrawCircle(origin, colorWhite, X_RIGHT, X_UP);
else
DrawCircle(origin, colorGrey, X_RIGHT, X_UP);
// screen rot
X_UP_sc = up * 1.2f * ScreenFactor();
X_RIGHT_sc = right * 1.2f * ScreenFactor();
if(pScene->CurrentManipMotion() == ROTATE_SCREEN)
DrawCircle(origin, colorWhite, X_UP_sc, X_RIGHT_sc);
else
DrawCircle(origin, colorMagenta, X_UP_sc, X_RIGHT_sc);
// x rot
right.Cross(dir, xaxis);
right.Normalize();
front.Cross(right, xaxis);
front.Normalize();
//.........这里部分代码省略.........