📄 camera.cpp
字号:
// camera.cpp: implementation of the Camera class.
//
//////////////////////////////////////////////////////////////////////
#include "camera.h"
#include "global.h"
Camera cam;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Camera::Camera()
{
vvv=0.5;
x=0.0;
y=2.0;
z=0.0;
theta=0.0;
psi=0.0;
gama=0.0;
fovy=45.0;
aspect=640.0/480;
znear=1.1;
zfar=2200.0;
vx=0;
vy=0;
width=640.0;
height=480.0;
}
Camera::~Camera()
{
}
void Camera::Place(float x,float y,float z,float theta,float psi,float gama)
{
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef(-gama,0,0,1);
glRotatef(-theta,1,0,0);
glRotatef(-psi,0,1,0);
glTranslatef(-x,-y,-z);
}
void Camera::Setup(float fovy,float aspect,float znear,float zfar,
long vx,long vy,long width,long height)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(fovy,aspect,znear,zfar);
glViewport(vx,vy,width,height);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -