本文整理汇总了C++中GLMatrix::GetBaseVec方法的典型用法代码示例。如果您正苦于以下问题:C++ GLMatrix::GetBaseVec方法的具体用法?C++ GLMatrix::GetBaseVec怎么用?C++ GLMatrix::GetBaseVec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLMatrix
的用法示例。
在下文中一共展示了GLMatrix::GetBaseVec方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RotCamBase
bool GLCamera::RotCamBase(double angle)
{
GLVertex3 org;
GLMatrix mx = fCamBase*fCamTrans;
GLVector3 fwd = mx.GetBaseVec(1);
fCamBase.Rotate(org, fwd, angle);
return (angle != 0);
}
示例2: Apply
void GLCamera::Apply(int pickx, int picky, int pickw, int pickh)
{
glViewport(vpX, vpY, vpW, vpH);
if(vpW == 0 || vpH == 0) {
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
return;
}
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(fieldOfView, vpW/vpH, 1.0, 1000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
GLMatrix mx = fCamBase*fCamTrans;
GLVector3 pos = mx.GetTranslation();
GLVector3 fwd = mx.GetBaseVec(1);
GLVector3 center = pos-fwd;
GLVector3 up = fCamBase.GetBaseVec(3);
gluLookAt(pos[0], pos[1], pos[2],
center[0], center[1], center[2],
up[0], up[1], up[2]);
UpdateCache();
GLPlane clipPlane(EyeDirection(), EyePoint());
for (int i = 0; i < 8; i++) {
double sx = (i&1) ? -1 : 1;
double sy = (i&2) ? -1 : 1;
double sz = (i&4) ? -1 : 1;
double cdist = clipPlane.DistanceTo(GLVertex3(sceneSize*sx,
sceneSize*sy,
sceneSize*sz));
if (i == 0) farClip = nearClip = cdist;
if (cdist < nearClip) nearClip = cdist;
if (cdist > farClip) farClip = cdist;
}
nearClip *= 0.49;
farClip *= 2.01;
if (farClip < 2.0) farClip = 2.0;
if (nearClip < farClip/1000.0) nearClip = farClip/1000.0;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (pickw > 0 && pickh > 0) {
int vport[4] = { vpX, vpY, vpW, vpH };
gluPickMatrix(pickx, vpH-picky, pickw, pickh, vport);
gluPerspective(fieldOfView, vpW/vpH, nearClip, farClip);
}
else
gluPerspective(fieldOfView, vpW/vpH, nearClip, farClip);
glMatrixMode(GL_MODELVIEW);
UpdateCache();
}