create hud.h & hud.cpp

This commit is contained in:
2024-01-15 20:39:25 -05:00
parent 1f8047c34f
commit a29455f482
4 changed files with 28 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
#pragma once
#include <types/moby.h>
#include <types/renderPlane.h>
#include <engine/engine.h>
#include <GL/glu.h>
#include <J3ML/Geometry.h>
@@ -11,7 +12,6 @@ enum class CameraMode: uint8_t {
};
const LinearAlgebra::Vector3 UP = {0, 1, 0};
class Camera : public Moby {
private:
void modeBinds();
@@ -19,9 +19,9 @@ private:
void freeCam();
protected:
public:
CameraMode cameraMode = CameraMode::FREECAM;
bool takingScreenshot = false;
RenderPlane headsUpDisplay;
LinearAlgebra::Matrix4x4 GetViewMatrix();
Geometry::Frustum getFrustum();
@@ -33,11 +33,9 @@ public:
void LookAt(LinearAlgebra::Vector3 pos, LinearAlgebra::Vector3 target, LinearAlgebra::Vector3 upaxis = UP) {}
void Rotate(float amt, LinearAlgebra::Vector3 axis) { }
void Translate(LinearAlgebra::Vector3 dir) { }
void update();
void pre_render() override;
void render() override;
void post_render() override;
void hMove(LinearAlgebra::Vector3 a, float vel) override;
};

View File

@@ -31,7 +31,7 @@ public:
virtual void pre_render() {}
virtual void post_render() {}
virtual void render() {}
virtual void update(float elapsed) {}
virtual void update() {}
virtual void ticc(int tics)
{
ticksAlive++;

View File

@@ -0,0 +1,11 @@
#pragma once
#include <types/entity.h>
class RenderPlane : public Entity {
private:
VertexArray geometry;
public:
[[nodiscard]] VertexArray getGeometry() const;
void update() override;
};

14
src/types/renderPlane.cpp Normal file
View File

@@ -0,0 +1,14 @@
#include <types/renderPlane.h>
VertexArray RenderPlane::getGeometry() const{
return geometry;
}
void RenderPlane::update() {
//TODO:
//Teleport this engine->nearPlane + float min in front of the camera.
//Calculate the size of the near plane.
//Allow image rendering to the plane using UV's. (The resolution and fovY will probably need to be taken into account).
//It's also probably possible to render to this using OpenGL and glOrtho.
}