Graphics Engine is now part of the whole engine instead, Project will
actually compile #9
This commit is contained in:
		
							
								
								
									
										19
									
								
								BarinkEngine/Include/Graphics/Buffer.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								BarinkEngine/Include/Graphics/Buffer.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
#include <glad/glad.h>
 | 
			
		||||
class Buffer {
 | 
			
		||||
private:
 | 
			
		||||
	unsigned int id;
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
	int getBufferID();
 | 
			
		||||
 | 
			
		||||
	void createBuffer();
 | 
			
		||||
 | 
			
		||||
	void setBufferData(void* data, size_t dataSize, bool elementBuffer );
 | 
			
		||||
 | 
			
		||||
	void Bind(bool elementBuffer);
 | 
			
		||||
	void Unbind(bool elementBuffer);
 | 
			
		||||
 | 
			
		||||
	void Delete();
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										22
									
								
								BarinkEngine/Include/Graphics/Camera.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								BarinkEngine/Include/Graphics/Camera.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,22 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
#include <glm/glm.hpp>
 | 
			
		||||
#include <glm/gtc/matrix_transform.hpp>
 | 
			
		||||
 | 
			
		||||
class Camera {
 | 
			
		||||
public:
 | 
			
		||||
	glm::vec3 Position;
 | 
			
		||||
	glm::vec3 Rotation;
 | 
			
		||||
	float Zoom;
 | 
			
		||||
 | 
			
		||||
	Camera(glm::vec3 position, glm::vec3 rotation, float zoom );
 | 
			
		||||
	~Camera();
 | 
			
		||||
 | 
			
		||||
	glm::mat4 GetViewMatrix();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	glm::vec3 Front;  
 | 
			
		||||
	glm::vec3 Right;
 | 
			
		||||
	glm::vec3 Up;
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										13
									
								
								BarinkEngine/Include/Graphics/Mesh.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								BarinkEngine/Include/Graphics/Mesh.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,13 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
#include <vector>
 | 
			
		||||
#include <glm/glm.hpp>
 | 
			
		||||
 | 
			
		||||
namespace BarinkEngine{
 | 
			
		||||
 | 
			
		||||
	class Mesh {
 | 
			
		||||
	public:
 | 
			
		||||
		std::vector<glm::vec3> vertices;
 | 
			
		||||
		std::vector<unsigned int > elements;
 | 
			
		||||
		std::vector<glm::vec2> uv;
 | 
			
		||||
	};
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										30
									
								
								BarinkEngine/Include/Graphics/Renderable.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								BarinkEngine/Include/Graphics/Renderable.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,30 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
#include <vector>
 | 
			
		||||
#include "Mesh.h"
 | 
			
		||||
#include "Transform.h"
 | 
			
		||||
#include "Buffer.h"
 | 
			
		||||
#include "VertexArray.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
#include <MyGraphicsEngine/AssetManager/ModelImporter.h>
 | 
			
		||||
#include <MyGraphicsEngine/MyGraphicsEngine/Buffer.h>
 | 
			
		||||
#include <MyGraphicsEngine/MyGraphicsEngine/VertexArray.h>
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
class Renderable {
 | 
			
		||||
private:
 | 
			
		||||
	std::vector<BarinkEngine::Mesh> meshes;
 | 
			
		||||
	Renderable();
 | 
			
		||||
	
 | 
			
		||||
public:
 | 
			
		||||
	Buffer vertexBuffer;
 | 
			
		||||
	Buffer elementBuffer;
 | 
			
		||||
	VertexArray VAO;
 | 
			
		||||
	Transform transform;
 | 
			
		||||
	~Renderable();
 | 
			
		||||
 | 
			
		||||
	static Renderable Load();
 | 
			
		||||
	void Draw();
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										26
									
								
								BarinkEngine/Include/Graphics/Shader.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								BarinkEngine/Include/Graphics/Shader.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,26 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <glad/glad.h>
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <iostream>
 | 
			
		||||
#include <fstream>
 | 
			
		||||
#include <glm/glm.hpp>
 | 
			
		||||
#include <glm/gtc/type_ptr.hpp>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Shader {
 | 
			
		||||
    private:
 | 
			
		||||
        int id;
 | 
			
		||||
        char* readFile (const char* filePath);
 | 
			
		||||
    public:
 | 
			
		||||
        Shader(const std::string vertexShaderPath, const std::string fragmentShaderPath);
 | 
			
		||||
        void Use();
 | 
			
		||||
        void setUniformMat4(std::string uniformName, glm::mat4 matrix4);
 | 
			
		||||
        void setUniformVec4(std::string uniformName, glm::vec4 vector4);
 | 
			
		||||
        void setUniformVec3(std::string uniformName, glm::vec3 vector3);
 | 
			
		||||
        void setUniformVec2(std::string uniformName, glm::vec2 vector2);
 | 
			
		||||
        void setUniformFloat(std::string uniformName, float value);
 | 
			
		||||
        void setUniformInt(std::string uniformName, int value);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										8
									
								
								BarinkEngine/Include/Graphics/Transform.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								BarinkEngine/Include/Graphics/Transform.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,8 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
#include <glm/glm.hpp>
 | 
			
		||||
 | 
			
		||||
struct Transform {
 | 
			
		||||
	glm::vec3 Position;
 | 
			
		||||
	glm::vec3 Rotation;
 | 
			
		||||
	glm::vec3 Scale;
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										18
									
								
								BarinkEngine/Include/Graphics/VertexArray.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								BarinkEngine/Include/Graphics/VertexArray.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,18 @@
 | 
			
		||||
#pragma once 
 | 
			
		||||
 | 
			
		||||
class VertexArray{
 | 
			
		||||
private:
 | 
			
		||||
unsigned int id;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
void Create();
 | 
			
		||||
void Bind();
 | 
			
		||||
void Unbind();
 | 
			
		||||
 | 
			
		||||
void Delete();
 | 
			
		||||
 | 
			
		||||
void AttachAttribute(unsigned int index, int size, int stride);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										33
									
								
								BarinkEngine/Include/Graphics/Window.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								BarinkEngine/Include/Graphics/Window.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,33 @@
 | 
			
		||||
#pragma once 
 | 
			
		||||
#define GLFW_STATIC
 | 
			
		||||
 | 
			
		||||
#include <glad/glad.h>
 | 
			
		||||
#include <GLFW/glfw3.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class BarinkWindow{
 | 
			
		||||
    private:
 | 
			
		||||
        GLFWwindow* window;
 | 
			
		||||
        bool FullScreen;
 | 
			
		||||
        bool VulkanSupported;
 | 
			
		||||
        int Width, Height;
 | 
			
		||||
 | 
			
		||||
        static bool InitGLFW();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public:
 | 
			
		||||
        BarinkWindow(const int width, const int height);
 | 
			
		||||
        ~BarinkWindow();
 | 
			
		||||
 | 
			
		||||
        GLFWwindow* windowptr();
 | 
			
		||||
 | 
			
		||||
        bool WindowShouldClose();
 | 
			
		||||
 | 
			
		||||
        void Poll();
 | 
			
		||||
        void SwapBuffers();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
		Reference in New Issue
	
	Block a user