aboutsummaryrefslogtreecommitdiff
path: root/source/Renderer.hpp
blob: 18a1e6edaec9c7386380d0b2781cb5483885fd60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once

#include "Material.hpp"
#include "Mesh.hpp"
#include "RcPtr.hpp"

#include <glad/glad.h>
#include <glm/glm.hpp>

class RenderObject {
public:
	glm::mat4 worldMatrix;

private:
	RcPtr<Material> mMaterial;
	RcPtr<GpuMesh> mMesh;
	GLuint mVao;

public:
	RenderObject(GpuMesh* mesh, Material* material);
	~RenderObject();

	GLuint GetGLVao() const { return mVao; }
	Material* GetMaterial() const { return mMaterial.Get(); }
	GpuMesh* GetMesh() const { return mMesh.Get(); }
};

class Camera {
public:
	glm::mat4 viewMatrix;
	glm::mat4 projectionMatrix;

public:
	void Move(glm::vec3 pos);
	void LookAt(glm::vec3 pos);
};

class Renderer {
private:
	Camera* mCam;

public:
	void BeginFrame();
	void EndFrame();
	void Draw(RenderObject& object);
};