CCamera.h
上传用户:arsena_zhu
上传日期:2022-07-12
资源大小:399k
文件大小:2k
- /*
- Class Name:
- CCamera.
- Created by:
- Allen Sherrod (Programming Ace of www.UltimateGameProgramming.com).
- Description:
- This class represents a camera in a 3D scene.
- */
- #ifndef CCAMERA_H
- #define CCAMERA_H
- #include<math.h> // Math header that allows us to use cos() and sin().
- #define SPD 0.1f
- class CCamera
- {
- public:
- CCamera();
- void UpDown(float m)
- { yPos += m; yView += m; }
- void SetCamera(float x, float y, float z,
- float xv, float yv, float zv,
- float xu, float yu, float zu);
- void MoveCamera(float direction);
- void UpdateCamera(float xDir, float yDir,
- float zDir, float dir);
- void StrafeCam(float direction);
- void CalculateStrafe();
- void RotateCamera(float AngleDir, float xSpeed,
- float ySpeed, float zSpeed);
- void RotateByMouse(int mousePosX, int mousePosY,
- int midX, int midY);
- float xPos, yPos, zPos; // Camera position.
- float xView, yView, zView; // Look at position.
- float xUp, yUp, zUp; // Up direction.
- float xStrafe, yStrafe, zStrafe; // Strafe direction.
- float currentRotationAngle; // Keeps us from going too far up or down.
- };
- #endif
- // Copyright October 2004
- // All Rights Reserved!
- // Allen Sherrod
- // ProgrammingAce@UltimateGameProgramming.com
- // www.UltimateGameProgramming.com