本文整理汇总了C++中GLFrame::SetUpVector方法的典型用法代码示例。如果您正苦于以下问题:C++ GLFrame::SetUpVector方法的具体用法?C++ GLFrame::SetUpVector怎么用?C++ GLFrame::SetUpVector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLFrame
的用法示例。
在下文中一共展示了GLFrame::SetUpVector方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetUpFrame
void SetUpFrame(GLFrame &frame,const M3DVector3f origin, const M3DVector3f forward, const M3DVector3f up) {
frame.SetOrigin(origin);
frame.SetForwardVector(forward);
M3DVector3f side,oUp;
m3dCrossProduct3(side,forward,up);
m3dCrossProduct3(oUp,side,forward);
frame.SetUpVector(oUp);
frame.Normalize();
}
示例2: SetUpFrame
void SetUpFrame(GLFrame &cameraFrame,const M3DVector3f origin,
const M3DVector3f forward,
const M3DVector3f cameraUpDirection) {
cameraFrame.SetOrigin(origin);
cameraFrame.SetForwardVector(forward);
M3DVector3f side,oUp;
m3dCrossProduct3(side,forward,cameraUpDirection);
m3dCrossProduct3(oUp,side,forward);
cameraFrame.SetUpVector(oUp);
cameraFrame.Normalize();
};
示例3: renderScene
void renderScene()
{
//Colours:
static GLfloat vDarkRed[] = {0.0f, 0.396f, 0.702f, 1.0f};
static GLfloat vDarkGrey[] = {0.2f, 0.2f, 0.2f, 1.0f};
static CStopWatch inputTimer;
//Clear buffers
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
//Beginning push:
modelViewStack.PushMatrix();
//Camera matrix:
M3DMatrix44f mCamera;
cameraFrame.GetCameraMatrix(mCamera);
modelViewStack.PushMatrix(mCamera);
modelViewStack.Rotate(-15.0f, 1.0f, 0.0f, 0.0f);
if (screenshot)
{
cameraFrame.SetForwardVector(0, 0, -1);
cameraFrame.SetUpVector(0, 1, 0);
cameraFrame.GetCameraMatrix(mCamera);
modelViewStack.PushMatrix(mCamera);
}
//Light source:
static M3DVector4f vAmbient = {0.1f, 0.1f, 0.1f, 1.0f};
static M3DVector4f vLightPos = {4.0f, -6.5f, 10.0f, 1.0f};
static M3DVector4f vLightEyePos;
m3dTransformVector4(vLightEyePos, vLightPos, mCamera);
//Draw floor and grid:
glEnable(GL_MULTISAMPLE);
cRoom.draw(shaderManager, tPipeline, modelViewStack);
// Highlight grid
hlGrid.draw(shaderManager, tPipeline, modelViewStack);
//Draw desks:
stuDesks.drawAll(shaderManager, tPipeline, vLightEyePos, modelViewStack, vAmbient); //Draw polygon version of desks
glDisable(GL_MULTISAMPLE); //Disable multisampling (to use AA)
glEnable(GL_BLEND); //Enable blending
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPolygonOffset(-1.0f, -1.0f);
glEnable(GL_POLYGON_OFFSET_LINE); //Render wireframe in front of polygon
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); //Wireframe mode
glEnable(GL_LINE_SMOOTH); //Enable AA
stuDesks.drawAll(shaderManager, tPipeline, vLightEyePos, modelViewStack, vAmbient, vDarkGrey); //Draw wireframe version of desks
//Reset stuff as they were before:
glDisable(GL_LINE_SMOOTH);
glDisable(GL_POLYGON_OFFSET_LINE);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glDisable(GL_BLEND);
//End cam push:
modelViewStack.PopMatrix();
//End pop:
modelViewStack.PopMatrix();
if (!screenshot)
{
newDeskButton.draw(W_WIDTH, W_HEIGHT);
removeDeskButton.draw(W_WIDTH, W_HEIGHT);
exportButton.draw(W_WIDTH, W_HEIGHT);
}
glutSwapBuffers();
if (screenshot)
{
char name[38];
sprintf(name, "Exports/screenshot%d.tga", expCounter);
gltWriteTGA(name);
counterSaver();
modelViewStack.PopMatrix();
screenshot = false;
}
glutPostRedisplay();
handleInput(inputTimer);
}