nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
camera.h
Go to the documentation of this file.
1#ifndef NANOMMO_CLIENT_CAMERA_H_
2#define NANOMMO_CLIENT_CAMERA_H_
3
4#include <raylib.h>
5
6#include "terrain/terrain.h"
7
8namespace nanommo {
9
10/// Looking down at the middle of the board, from above and behind.
11Camera3D GameCamera();
12
13/// Follows your player around, from behind and above.
15 public:
16 static constexpr float kNearest = 4.0f;
17 static constexpr float kFarthest = 40.0f;
18
19 /// Turns and tilts by the angles, in radians, and zooms in by the share of
20 /// the distance, then looks at the player from there.
21 void Update(Vector3 player, float turn, float tilt, float zoom,
22 const Terrain& terrain);
23
24 /// Turns the keys' direction from the screen's to the world's, so that W
25 /// always walks away from the camera.
26 Vector3 Relative(Vector3 direction) const;
27
28 const Camera3D& camera() const { return camera_; }
29
30 private:
31 float yaw_ = 0.0f;
32 /// How far above the player it looks down from, in radians.
33 float pitch_ = 30.0f * DEG2RAD;
34 float distance_ = 15.0f;
35 Camera3D camera_ = GameCamera();
36};
37
38} // namespace nanommo
39
40#endif // NANOMMO_CLIENT_CAMERA_H_
Follows your player around, from behind and above.
Definition camera.h:14
const Camera3D & camera() const
Definition camera.h:28
void Update(Vector3 player, float turn, float tilt, float zoom, const Terrain &terrain)
Definition camera.cc:31
static constexpr float kNearest
Definition camera.h:16
Vector3 Relative(Vector3 direction) const
Definition camera.cc:48
static constexpr float kFarthest
Definition camera.h:17
Definition chat.cc:9
Camera3D GameCamera()
Looking down at the middle of the board, from above and behind.
Definition camera.cc:23