📄 camera.h
字号:
#ifndef _CAMERA_H_
#define _CAMERA_H_
#include "scene.h"
#if defined(WIN32) | defined(i386) | defined(LITTLE_ENDIAN)
#define BMP_BIG_ENDIAN 0
#else
#define BMP_BIG_ENDIAN 1
#endif
/* May need to change the following line under Linux */
#ifdef _WIN32
#pragma pack(push, 2)
#else
#pragma pack(2)
#endif
#ifndef M_PI
#define M_PI 3.1415926
#endif
#define uint16 unsigned short
#define uint32 unsigned int
#define BI_RGB 0
#define BMP_FALSE 0
#define BMP_TRUE 1
#ifdef _WIN32
#pragma pack(pop)
#else
#pragma pack(0)
#endif
class Camera{
private:
Point3 eye;
Vector3 u,v,n;
double viewAngle, aspect, nearDist, farDist; // view volume shape
int nRows, nCols;
void setModelViewMatrix(); // tell OpenGL where the camera is
float H, W;
public:
Camera() {} // default constructor
void set(Point3 eye, Point3 look, Vector3 up, bool tellOpenGL = false); // like gluLookAt()
void roll(float angle); // roll it
void pitch(float angle); // increase pitch
void yaw(float angle); // yaw it
void slide(float du, float dv, float dn); // slide it
void setShape(float vAng, float asp, float nearD, float farD, bool tellOpenGL = false);
void setResolution(int r, int c) { nRows = r; nCols = c; }
void rotAxes(Vector3& a, Vector3& b, float angle);
void setProjectionMatrix();
void status(ostream &myOut, long currentRay, int percent, Scene scn);
void setDisplay(int numRows, int numCols);
void drawOpenGL(Scene& scn); //draw whole scene using OpenGL tools
void set(float ex, float ey, float ez, float lx, float ly, float lz, float upx, float upy, float upz);
unsigned char* raytrace(Scene& scn, int blockSize, bool useOpenGL);
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -