begin raylib

This commit is contained in:
2026-01-04 17:19:13 +01:00
parent 0d84cc7470
commit 44851099d4
39 changed files with 291 additions and 743 deletions

View File

@@ -1,16 +1,18 @@
#pragma once
#include <td/render/shader/ShaderProgram.h>
#include <raylib.h>
#include <td/Maths.h>
namespace td {
namespace shader {
class CameraShaderProgram : public ShaderProgram {
class CameraShaderProgram {
private:
unsigned int m_LocationProjection = 0, m_LocationView = 0;
public:
CameraShaderProgram() {}
CameraShaderProgram() {
}
void SetProjectionMatrix(const Mat4f& proj) const;
void SetViewMatrix(const Mat4f& view) const;

View File

@@ -1,43 +0,0 @@
#pragma once
#include <string>
#include <td/Maths.h>
#include <td/render/OpenGL.h>
namespace td {
namespace shader {
class ShaderProgram {
public:
ShaderProgram();
virtual ~ShaderProgram();
void Start() const;
void Stop() const;
protected:
void LoadProgramFile(const std::string& vertexFile, const std::string& fragmentFile);
void LoadProgram(const std::string& vertexSource, const std::string& fragmentSource);
virtual void GetAllUniformLocation() = 0;
int GetUniformLocation(const std::string& uniformName) const;
void LoadFloat(unsigned int location, float value) const;
void LoadInt(unsigned int location, int value) const;
void LoadVector(unsigned int location, const Vec2f& vector) const;
void LoadVector(unsigned int location, const Vec3f& vector) const;
void LoadBoolean(unsigned int location, bool value) const;
void LoadMat4(unsigned int location, const Mat4f& mat) const;
void CleanUp() const;
private:
unsigned int m_ProgramID;
unsigned int m_VertexShaderID;
unsigned int m_FragmentShaderID;
unsigned int LoadShaderFromFile(const std::string& file, GLenum type);
unsigned int LoadShader(const std::string& source, GLenum type);
};
} // namespace shader
} // namespace td