Elevate Engine 1
Loading...
Searching...
No Matches
Cubemap.h
Go to the documentation of this file.
1#pragma once
2#include <string>
3#include <memory>
4#include <filesystem>
5
10
11namespace Elevate
12{
13 class Shader;
14
15 class Cubemap
16 {
17 public:
18 Cubemap(std::string paths[6], std::string skyboxFilePath = "");
19
20 static Cubemap* CreateFromFile(const std::string& filePath);
21
22 void Draw(std::shared_ptr<Shader> shader = nullptr);
23
24 void SetProjectionMatrix(glm::mat4 data);
25 void SetViewMatrix(glm::mat4 data);
26
27 std::string GetFilePath();
28
29 private:
30 RenderState m_renderState;
31 std::shared_ptr<Shader> m_cubemapShader;
32
33 std::shared_ptr<VertexArray> m_VertexArray;
34 std::shared_ptr<VertexBuffer> m_VertexBuffer;
35 std::shared_ptr<IndexBuffer> m_IndexBuffer;
36
37 uint32_t m_textureID; // todo maybe move to the opengl texture class if not needed in other APIs
38
39 std::string m_filePath;
40
41 float s_skyboxVertices[3 * 8] = {
42 // Positions
43 -1.0f, -1.0f, -1.0f,
44 1.0f, -1.0f, -1.0f,
45 1.0f, 1.0f, -1.0f,
46 -1.0f, 1.0f, -1.0f,
47 -1.0f, -1.0f, 1.0f,
48 1.0f, -1.0f, 1.0f,
49 1.0f, 1.0f, 1.0f,
50 -1.0f, 1.0f, 1.0f
51 };
52
53 unsigned int s_skyboxIndices[6 * 2 *3] = {
54 // Front
55 0, 1, 2,
56 2, 3, 0,
57 // Back
58 4, 5, 6,
59 6, 7, 4,
60 // Left
61 0, 3, 7,
62 7, 4, 0,
63 // Right
64 1, 2, 6,
65 6, 5, 1,
66 // Top
67 3, 2, 6,
68 6, 7, 3,
69 // Bottom
70 0, 1, 5,
71 5, 4, 0
72 };
73 };
74}
void Draw(std::shared_ptr< Shader > shader=nullptr)
Definition Cubemap.cpp:101
static Cubemap * CreateFromFile(const std::string &filePath)
Definition Cubemap.cpp:70
void SetViewMatrix(glm::mat4 data)
Definition Cubemap.cpp:118
std::string GetFilePath()
Definition Cubemap.cpp:124
void SetProjectionMatrix(glm::mat4 data)
Definition Cubemap.cpp:112