Moving to a single renderer instance system
This commit is contained in:
		@ -12,6 +12,7 @@
 | 
			
		||||
#include <string>
 | 
			
		||||
#include "Scene/SceneNodeTypes.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ProcessVertices(aiMesh* mesh, std::vector<BarinkEngine::Vertex>& out_vertices);
 | 
			
		||||
void ProcessIndices(aiMesh* mesh, std::vector<unsigned int>& out_indices);
 | 
			
		||||
 | 
			
		||||
@ -20,7 +21,7 @@ namespace BarinkEngine {
 | 
			
		||||
 | 
			
		||||
	public:
 | 
			
		||||
 | 
			
		||||
		SceneObject* Import(const std::string path);
 | 
			
		||||
		BarinkEngine::SceneObject* Import(const std::string path);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	private:
 | 
			
		||||
 | 
			
		||||
@ -5,6 +5,7 @@
 | 
			
		||||
#include "graphics/Texture.h"
 | 
			
		||||
#include "graphics/Camera.h"
 | 
			
		||||
#include "graphics/Renderable.h"
 | 
			
		||||
#include "Graphics/Renderer.h"
 | 
			
		||||
#include "Graphics/Material.h"
 | 
			
		||||
 | 
			
		||||
#include "spdlog/spdlog.h"
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
#pragma once 
 | 
			
		||||
#include <string> 
 | 
			
		||||
#include <string>
 | 
			
		||||
 | 
			
		||||
struct Event
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										30
									
								
								BarinkEngine/Include/Graphics/GPUBucket.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								BarinkEngine/Include/Graphics/GPUBucket.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,30 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
#include "VertexArray.h"
 | 
			
		||||
#include "Buffer.h"
 | 
			
		||||
#include "Mesh.h"
 | 
			
		||||
#include "Material.h"
 | 
			
		||||
 | 
			
		||||
namespace BarinkEngine {
 | 
			
		||||
 | 
			
		||||
	class GPU_Bucket {
 | 
			
		||||
	public:
 | 
			
		||||
 | 
			
		||||
		GPU_Bucket();
 | 
			
		||||
		~GPU_Bucket();
 | 
			
		||||
 | 
			
		||||
		void Upload(const Mesh& renderable);
 | 
			
		||||
		
 | 
			
		||||
		GpuBuffer vertexBuffer;
 | 
			
		||||
		GpuBuffer elementBuffer;
 | 
			
		||||
		VertexArray vertexarray;
 | 
			
		||||
 | 
			
		||||
		const Mesh* mesh;
 | 
			
		||||
		const Material* material;
 | 
			
		||||
 | 
			
		||||
	private : 
 | 
			
		||||
		unsigned int uv_id;
 | 
			
		||||
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,7 @@ class Material {
 | 
			
		||||
public:
 | 
			
		||||
	Material(const Shader& shader);
 | 
			
		||||
	
 | 
			
		||||
	void Apply();
 | 
			
		||||
	void Apply()const;
 | 
			
		||||
	
 | 
			
		||||
	glm::vec3 Color;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,26 +1,12 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
#include <vector>
 | 
			
		||||
#include <glm/glm.hpp>
 | 
			
		||||
#include "VertexArray.h"
 | 
			
		||||
#include "Buffer.h"
 | 
			
		||||
#include "Vertex.h"
 | 
			
		||||
 | 
			
		||||
namespace BarinkEngine{
 | 
			
		||||
 | 
			
		||||
	struct Vertex {
 | 
			
		||||
		glm::vec3 vertices;
 | 
			
		||||
		glm::vec2 uv;
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	class Mesh {
 | 
			
		||||
	public:
 | 
			
		||||
namespace BarinkEngine {
 | 
			
		||||
	struct Mesh {
 | 
			
		||||
		std::vector<Vertex> vertices;
 | 
			
		||||
		std::vector<unsigned int> elements;
 | 
			
		||||
	
 | 
			
		||||
	private:
 | 
			
		||||
		GpuBuffer vertexBuffer;
 | 
			
		||||
		GpuBuffer elementBuffer;
 | 
			
		||||
		VertexArray VAO;
 | 
			
		||||
		unsigned int UV_id;
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,23 +1,14 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
#include <vector>
 | 
			
		||||
#include "Mesh.h"
 | 
			
		||||
 | 
			
		||||
#include "Material.h"
 | 
			
		||||
#include "Texture.h"
 | 
			
		||||
 | 
			
		||||
#include "Scene.h"
 | 
			
		||||
 | 
			
		||||
namespace BarinkEngine {
 | 
			
		||||
 | 
			
		||||
	class Renderable {
 | 
			
		||||
	public:
 | 
			
		||||
		Mesh mesh;
 | 
			
		||||
	struct  Renderable {
 | 
			
		||||
		BarinkEngine::Mesh* mesh;
 | 
			
		||||
		Material* material;
 | 
			
		||||
		Texture* texture;
 | 
			
		||||
 | 
			
		||||
		Shader* shader;
 | 
			
		||||
 | 
			
		||||
		Renderable();
 | 
			
		||||
		~Renderable();
 | 
			
		||||
	};
 | 
			
		||||
}
 | 
			
		||||
@ -1,8 +1,16 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
#include "Graphics/Renderable.h"
 | 
			
		||||
 | 
			
		||||
#include <vector>
 | 
			
		||||
 | 
			
		||||
#include <glm/gtc/matrix_transform.hpp>
 | 
			
		||||
#include "glad/glad.h"
 | 
			
		||||
#include "GLFW/glfw3.h"
 | 
			
		||||
 | 
			
		||||
#include "PerfCounter.h"
 | 
			
		||||
 | 
			
		||||
#include "Graphics/Camera.h"
 | 
			
		||||
#include "Graphics/Renderable.h"
 | 
			
		||||
#include "Graphics/GPUBucket.h"
 | 
			
		||||
 | 
			
		||||
namespace BarinkEngine {
 | 
			
		||||
 | 
			
		||||
	class Renderer {
 | 
			
		||||
@ -15,7 +23,7 @@ namespace BarinkEngine {
 | 
			
		||||
		void Submit(Renderable* model);
 | 
			
		||||
 | 
			
		||||
	private:
 | 
			
		||||
		std::vector<Renderable*> models;
 | 
			
		||||
		std::vector<GPU_Bucket*> models;
 | 
			
		||||
 | 
			
		||||
	};
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -14,7 +14,7 @@ class Shader {
 | 
			
		||||
        char* readFile (const char* filePath);
 | 
			
		||||
    public:
 | 
			
		||||
        Shader(const std::string vertexShaderPath, const std::string fragmentShaderPath);
 | 
			
		||||
        void Use();
 | 
			
		||||
        void Use() const;
 | 
			
		||||
        void setUniformMat4(std::string uniformName, glm::mat4 matrix4)const;
 | 
			
		||||
        void setUniformVec4(std::string uniformName, glm::vec4 vector4)const;
 | 
			
		||||
        void setUniformVec3(std::string uniformName, glm::vec3 vector3)const;
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										9
									
								
								BarinkEngine/Include/Graphics/Vertex.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								BarinkEngine/Include/Graphics/Vertex.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
#include <glm/glm.hpp>
 | 
			
		||||
 | 
			
		||||
namespace BarinkEngine {
 | 
			
		||||
	struct Vertex {
 | 
			
		||||
		glm::vec3 vertices;
 | 
			
		||||
		glm::vec2 uv;
 | 
			
		||||
	};
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user