-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2
56 lines (54 loc) · 1.9 KB
/
2
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
47
48
49
50
51
52
53
54
55
56
#pragma once
#include "IndexBuffer.h"
#include "InstanceBuffer.h"
#include "InstanceBufferLayout.h"
#include "Shader.h"
#include "Universe.h"
#include "VertexArray.h"
#include "VertexBuffer.h"
#include "VertexBufferLayout.h"
#include "glm.hpp"
#include <functional>
#include <memory>
class UniverseLayerInstance {
public:
UniverseLayerInstance(float vertexWidth, float vertexHeight,
unsigned int width, unsigned int height,
std::function<glm::mat4()> viewProjectionCallback);
inline float &GetVertexWidth() { return m_VertexWidth; }
inline float &GetVertexHeight() { return m_VertexHeight; }
inline float &GetUniverseHeight() { return UniverseHeight; }
inline unsigned int &GetWidth() { return m_Width; }
inline unsigned int &GetHeight() { return m_Height; }
inline glm::vec2 &GetTranslation() { return m_Translation; }
inline glm::mat4 &GetMVP() { return u_MVP; }
inline glm::mat4 &GetModel() { return m_MatModel; }
inline std::shared_ptr<Universe> &GetUniverse() { return m_Universe; }
inline float &GetGenerationTime() { return m_GenerationTime; }
inline float &GetLastTimeUniverse() { return m_LastTimeUniverse; }
void Unbind();
void Bind();
void Draw();
private:
float m_LastTimeUniverse;
float m_GenerationTime;
float m_VertexWidth;
float m_VertexHeight;
float UniverseHeight;
unsigned int m_Width;
unsigned int m_Height;
glm::vec2 m_Offset;
glm::vec2 m_Translation;
glm::mat4 u_MVP;
glm::mat4 m_ViewProjection;
glm::mat4 m_MatModel;
std::shared_ptr<Universe> m_Universe;
std::shared_ptr<Shader> m_Shader;
std::shared_ptr<VertexArray> m_Va;
std::shared_ptr<VertexBuffer> m_Vb;
std::shared_ptr<VertexBufferLayout> m_Layout;
std::shared_ptr<IndexBuffer> m_Ib;
std::shared_ptr<InstanceBuffer> m_InstanceBuffer;
std::shared_ptr<InstanceBufferLayout> m_InstanceLayout;
std::function<glm::mat4()> m_ViewProjectionCallback;
};