123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #ifndef GAME_H
- #define GAME_H
- #include "client/input/Control.h"
- #include "client/utils/Clock.h"
- #include "client/rendering/RenderSettings.h"
- #include "client/rendering/Renderer.h"
- #include "client/rendering/Mesh.h"
- #include "client/rendering/FileTexture.h"
- #include "client/rendering/FontRenderer.h"
- #include "common/world/World.h"
- #include "common/block/BlockRegistry.h"
- #include "rendering/renderer/WorldRenderer.h"
- class Game final {
- public:
- Game(const Control& control, const Clock& fps, const Clock& tps, RenderSettings& renderSettings);
- void tick();
- void renderWorld(float lag, Renderer& renderer) const;
- void renderTextOverlay(float lag, Renderer& renderer, FontRenderer& fr) const;
- bool isRunning() const;
- private:
- Vector3 splineTangent(const Vector3& prev, const Vector3& current, const Vector3& next) const;
- Vector3 interpolate(const Vector3& a, const Vector3& b, const Vector3& tanA, const Vector3& tanB, float t) const;
- float distance(uint index, uint splits) const;
- Vector3 pointUntilDistance(float leftDistance, uint index, uint splits) const;
- void getPointsAndTangents(uint index, Vector3& a, Vector3& b, Vector3& tanA, Vector3& tanB) const;
- void updateDistances();
-
- const Control& control;
- const Clock& fps;
- const Clock& tps;
- RenderSettings& renderSettings;
- Vector3 lastPos;
- mutable Vector3 pos;
- Quaternion lastRotation;
- Quaternion rotation;
- BlockRegistry blockRegistry;
- World world;
- WorldRenderer worldRenderer;
- struct Point {
- Vector3 pos;
- Quaternion q;
- float distance;
- };
- List<Point, 25> cameraPoints;
- uint pointIndex;
- float moveSpeed;
- float movedLength;
- enum Mode {
- AUTO, PLAYER
- };
-
- Mode mode;
- };
- #endif
|