GameObjects

Began to add GameObjects, starting with the player.
This commit is contained in:
onTheZero
2025-08-13 00:59:03 -04:00
parent 237272c17b
commit 4bf6b02255
37 changed files with 2640 additions and 222 deletions

56
MeshRenderer.h Normal file
View File

@@ -0,0 +1,56 @@
#pragma once
#include <vector>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include "Shader.h"
class MeshRenderer
{
public:
MeshRenderer();
~MeshRenderer();
void Setup
(
std::vector<float> vertices,
std::vector<float> normals,
std::vector<float> colors,
std::vector<unsigned int> indices,
Shader* lit_shader
);
void Render(Shader &shader);
void Render(glm::mat4 projection, glm::mat4 view, glm::vec3 light_position, glm::vec3 light_color, glm::vec3 view_position);
void Render(glm::mat4 projection, glm::mat4 view, glm::vec3 light_position, glm::vec3 light_color, glm::vec3 view_position, glm::vec3 position, glm::vec3 scale, glm::vec3 rotation);
private:
std::vector<float> vertices;
std::vector<float> normals;
std::vector<float> colors;
std::vector<unsigned int> indices;
unsigned int VAO;
unsigned int depth_map;
unsigned int depth_map_FBO;
unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;
int SCR_WIDTH = 1600;
int SCR_HEIGHT = 900;
Shader *shader;
Shader *lit_shader;
Shader *shadow_shader;
void SetupBuffers();
void SetupLighting();
void RenderObject(glm::mat4 projection, glm::mat4 view, glm::mat4 model, glm::vec3 light_position, glm::vec3 light_color, glm::vec3 view_position);
void RenderShadows(glm::mat4 projection, glm::mat4 view, glm::mat4 model, glm::vec3 light_position);
};