本文整理汇总了C++中GLFrame::RotateWorld方法的典型用法代码示例。如果您正苦于以下问题:C++ GLFrame::RotateWorld方法的具体用法?C++ GLFrame::RotateWorld怎么用?C++ GLFrame::RotateWorld使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLFrame
的用法示例。
在下文中一共展示了GLFrame::RotateWorld方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SpecialKeys
void SpecialKeys(int key, int x, int y)
{
float linear = 0.1f;
float angular = float(m3dDegToRad(5.0f));
if (key == GLUT_KEY_UP)
{
cameraFrame.MoveForward(linear);
}
if (key == GLUT_KEY_DOWN)
{
cameraFrame.MoveForward(-linear);
}
if (key == GLUT_KEY_LEFT)
{
cameraFrame.RotateWorld(angular, 0.0f, 1.0f, 0.0f);
}
if (key == GLUT_KEY_RIGHT)
{
cameraFrame.RotateWorld(-angular, 0.0f, 1.0f, 0.0f);
}
}
示例2: NonASCIIKeyboardPress
void NonASCIIKeyboardPress(int key, int mouseXPosition, int mouseYPosition)
{
switch (key) {
case UP_KEY:
cameraFrame.MoveForward(CAMERA_LINEAR_STEP);
break;
case DOWN_KEY:
cameraFrame.MoveForward(-CAMERA_LINEAR_STEP);
break;
case LEFT_KEY:
cameraFrame.RotateWorld(CAMERA_ANGULAR_STEP, 0.0f, 1.0f, 0.0f);
break;
case RIGHT_KEY:
cameraFrame.RotateWorld(-CAMERA_ANGULAR_STEP, 0.0f, 1.0f, 0.0f);
break;
case F1_KEY:
fullscreen = !fullscreen;
fullscreen ? glutFullScreen() : glutReshapeWindow(ORIG_WINDOW_SIZE[0], ORIG_WINDOW_SIZE[1]);
break;
default:
break;
}
}
示例3: mouseCameraFunc
void mouseCameraFunc(int x, int y)
{
if (mouseActive)
{
GLfloat angle = 0.005f;
if (x > W_WIDTH/2)
{
cameraFrame.RotateWorld(-angle*(x-W_WIDTH/2), 0, 0, 1);
glutWarpPointer(W_WIDTH/2, W_HEIGHT/2);
}
else if (x < W_WIDTH/2)
{
cameraFrame.RotateWorld(angle*(W_WIDTH/2-x), 0, 0, 1);
glutWarpPointer(W_WIDTH/2, W_HEIGHT/2);
}
if (y > W_HEIGHT/2 && pitch < 90)
{
cameraFrame.RotateLocalX(-angle*(W_HEIGHT/2-y));
glutWarpPointer(W_WIDTH/2, W_HEIGHT/2);
pitch = pitch + (-angle*(W_HEIGHT/2-y));
}
else if (y < W_HEIGHT/2 && pitch > -90)
{
cameraFrame.RotateLocalX(angle*(y-W_HEIGHT/2));
glutWarpPointer(W_WIDTH/2, W_HEIGHT/2);
pitch = pitch + (angle*(y-W_HEIGHT/2));
}
}
}
示例4: SpecialKeys
void SpecialKeys(int key, int x, int y)
{
if(key == GLUT_KEY_UP) objectFrame.RotateWorld(m3dDegToRad(-5.0f), 1.0f, 0.0f, 0.0f);
if(key == GLUT_KEY_DOWN) objectFrame.RotateWorld(m3dDegToRad(5.0f), 1.0f, 0.0f, 0.0f);
if(key == GLUT_KEY_LEFT) objectFrame.RotateWorld(m3dDegToRad(-5.0f), 0.0f, 1.0f, 0.0f);
if(key == GLUT_KEY_RIGHT) objectFrame.RotateWorld(m3dDegToRad(5.0f), 0.0f, 1.0f, 0.0f);
glutPostRedisplay();
}
示例5: SpecialKeys
// called on arrow keys
void SpecialKeys(int key, int x, int y){
float linear = 0.1f;
float angular = float(m3dDegToRad(5.0f));
// TODO - flatten movement to the XZ axis
if(key == GLUT_KEY_UP)
cameraFrame.MoveForward(linear);
if(key == GLUT_KEY_DOWN)
cameraFrame.MoveForward(-linear);
if(key == GLUT_KEY_LEFT)
cameraFrame.RotateWorld(angular, 0.0f, 1.0f, 0.0f);
if(key == GLUT_KEY_RIGHT)
cameraFrame.RotateWorld(-angular, 0.0f, 1.0f, 0.0f);
}
示例6: SpecialKeys
void SpecialKeys(int key, int x, int y)
{
if(key == GLUT_KEY_UP)
viewFrame.RotateWorld(m3dDegToRad(-5.0), 1.0f, 0.0f, 0.0f);
if(key == GLUT_KEY_DOWN)
viewFrame.RotateWorld(m3dDegToRad(5.0), 1.0f, 0.0f, 0.0f);
if(key == GLUT_KEY_LEFT)
viewFrame.RotateWorld(m3dDegToRad(-5.0), 0.0f, 1.0f, 0.0f);
if(key == GLUT_KEY_RIGHT)
viewFrame.RotateWorld(m3dDegToRad(5.0), 0.0f, 1.0f, 0.0f);
// Refresh the Window
glutPostRedisplay();
}
示例7: keyFunc
void keyFunc(int key, int x, int y)
{
static const float step = 0.1f;
static const float angle = m3dDegToRad(4);
switch (key)
{
case GLUT_KEY_UP:
objectFrame.RotateWorld(-angle, 1, 0, 0);
break;
case GLUT_KEY_DOWN:
objectFrame.RotateWorld(angle, 1, 0, 0);
break;
case GLUT_KEY_LEFT:
objectFrame.RotateWorld(-angle, 0, 1, 0);
break;
case GLUT_KEY_RIGHT:
objectFrame.RotateWorld(angle, 0, 1, 0);
break;
case GLUT_KEY_HOME:
cameraFrame.MoveForward(step);
break;
case GLUT_KEY_END:
cameraFrame.MoveForward(-step);
break;
// enable/disable anisotropy
case GLUT_KEY_F1:
if (isAnisotropySupported) {
isAnisotropy = !isAnisotropy;
if (isAnisotropy)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, largest);
else
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0f);
}
break;
default:
break;
}
glutPostRedisplay();
}
示例8: movingCylinder
void movingCylinder()
{
static CStopWatch cameraTimer;
float fTime = cameraTimer.GetElapsedSeconds();
cameraTimer.Reset();
float linear = fTime * 3.0f;
float angular = fTime * float(m3dDegToRad(15.0f));
if(isMoveForward == true) cameraFrame.MoveForward(linear);
if(isMoveBack == true) cameraFrame.MoveForward(-linear);
if(isRotateLeft == true) cameraFrame.RotateWorld(angular, 0.0f, 1.0f, 0.0f);
if(isRotateRight == true) cameraFrame.RotateWorld(-angular, 0.0f, 1.0f, 0.0f);
if(isRotateUp == true) cameraFrame.RotateWorld(angular, 1.0f, 0.0f, 0.0f);
if(isRotateDown == true) cameraFrame.RotateWorld(-angular, 1.0f, 0.0f, 0.0f);
}
示例9: SpecialKeys
///////////////////////////////////////////////////////////////////////////////
// Update the camera based on user input, toggle display modes
//
void SpecialKeys(int key, int x, int y)
{
static CStopWatch cameraTimer;
float fTime = cameraTimer.GetElapsedSeconds();
cameraTimer.Reset();
float linear = fTime * 0.60f;
float angular = fTime * float(m3dDegToRad(60.0f));
if(key == GLUT_KEY_UP)
cameraFrame.MoveForward(linear);
if(key == GLUT_KEY_DOWN)
cameraFrame.MoveForward(-linear);
if(key == GLUT_KEY_LEFT)
cameraFrame.RotateWorld(angular, 0.0f, 1.0f, 0.0f);
if(key == GLUT_KEY_RIGHT)
cameraFrame.RotateWorld(-angular, 0.0f, 1.0f, 0.0f);
}
示例10: RenderScene
// main rendering loop
void RenderScene(void){
static CStopWatch rotTimer;
float yRot = rotTimer.GetElapsedSeconds() * 60.0f;
GLfloat vBarColor[] = {1.0f, 0.0f, 0.0f, 1.0f};
currentFrame = getLatestBufferIndex();
if(mapper.getSimpleArg('c')){
vBarColor[0] = .7;
vBarColor[1] = .2 + sharedBuffer[currentFrame].averageAmp * 60;
vBarColor[2] = 1.0;
b = sharedBuffer[currentFrame].averageAmp;
g = 0;
r = 0;
glClearColor(r, g, b, 1.0f);
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
modelViewMatrix.PushMatrix();
M3DMatrix44f mCamera;
cameraFrame.GetCameraMatrix(mCamera);
modelViewMatrix.PushMatrix(mCamera);
if(mapper.getCompoundArg('r') == "auto"){
cameraFrame.RotateWorld(.01, 0.0, 0.0, 1.0);
cameraFrame.MoveForward(-.1 * sin(yRot * .05));
}
// set up light source
M3DVector4f vLightPos = { 0.0f, 10.0f, 5.0f, 1.0f };
M3DVector4f vLightEyePos;
m3dTransformVector4(vLightEyePos, vLightPos, mCamera);
for(int m = 0; m < NUM_MACROS; m++){
if(mapper.getSimpleArg('m')){
modelViewMatrix.PushMatrix();
macros[m].refFrame.RotateLocalY(.01 * macros[m].multiplier);
macros[m].refFrame.RotateLocalX(.5 * sharedBuffer[currentFrame].averageAmp);
modelViewMatrix.MultMatrix(macros[m].refFrame);
}
for(int i = 0; i < PACKET_SIZE; i++){
modelViewMatrix.PushMatrix();
GLfloat y = 5 * fabs(sharedBuffer[currentFrame].frames[i][0]);
modelViewMatrix.MultMatrix(bars[i]);
modelViewMatrix.Scale(barWidth, y, sharedBuffer[currentFrame].averageAmp * 4);
if(mapper.getSimpleArg('t')){
modelViewMatrix.Translate(0.0, sharedBuffer[currentFrame].averageAmp, 0.0);
}
shaderManager.UseStockShader(GLT_SHADER_POINT_LIGHT_DIFF,
transformPipeline.GetModelViewMatrix(),
transformPipeline.GetProjectionMatrix(),
vLightEyePos, vBarColor);
cubeBatch.Draw();
modelViewMatrix.PopMatrix();
}
if(mapper.getSimpleArg('m')){
modelViewMatrix.PopMatrix();
}
}
// draw prisms for amplitudes
modelViewMatrix.PopMatrix();
modelViewMatrix.PopMatrix();
modelViewMatrix.PopMatrix();
glutSwapBuffers();
glutPostRedisplay();
if(currentFrame != -1){
sharedBuffer[currentFrame].free = true;
}
}
示例11: SpecialKeys
///////////////////////////////////////////////////////////////////////////////
// Update the camera based on user input, toggle display modes
//
void SpecialKeys(int key, int x, int y)
{
static CStopWatch cameraTimer;
float fTime = cameraTimer.GetElapsedSeconds();
cameraTimer.Reset();
float linear = fTime * 3.0f;
float angular = fTime * float(m3dDegToRad(60.0f));
if(key == GLUT_KEY_UP)
cameraFrame.MoveForward(linear);
if(key == GLUT_KEY_DOWN)
cameraFrame.MoveForward(-linear);
if(key == GLUT_KEY_LEFT)
cameraFrame.RotateWorld(angular, 0.0f, 1.0f, 0.0f);
if(key == GLUT_KEY_RIGHT)
cameraFrame.RotateWorld(-angular, 0.0f, 1.0f, 0.0f);
static bool bF2IsDown = false;
if(key == GLUT_KEY_F2)
{
if(bF2IsDown == false)
{
bF2IsDown = true;
bUseFBO = !bUseFBO;
}
}
else
{
bF2IsDown = false;
}
#ifndef OPENGL_ES
if(key == GLUT_KEY_F3)
{
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_BUFFER_ARB, texBOTexture);
glTexBufferARB(GL_TEXTURE_BUFFER_ARB, GL_R32F, texBO[0]); // FIX THIS IN GLEE
glActiveTexture(GL_TEXTURE0);
}
else if(key == GLUT_KEY_F4)
{
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_BUFFER_ARB, texBOTexture);
glTexBufferARB(GL_TEXTURE_BUFFER_ARB, GL_R32F, texBO[1]); // FIX THIS IN GLEE
glActiveTexture(GL_TEXTURE0);
}
else if(key == GLUT_KEY_F5)
{
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_BUFFER_ARB, texBOTexture);
glTexBufferARB(GL_TEXTURE_BUFFER_ARB, GL_R32F, texBO[2]); // FIX THIS IN GLEE
glActiveTexture(GL_TEXTURE0);
}
#endif
// Refresh the Window
glutPostRedisplay();
}