diff --git a/src/DivaGL/DivaGL.vcxproj b/src/DivaGL/DivaGL.vcxproj
index f09aa4c..5a33078 100644
--- a/src/DivaGL/DivaGL.vcxproj
+++ b/src/DivaGL/DivaGL.vcxproj
@@ -134,12 +134,10 @@ del "$(SolutionDir)bin\$(TargetName).lib"
-
-
-
-
-
-
+
+
+
+
@@ -161,6 +159,26 @@ del "$(SolutionDir)bin\$(TargetName).lib"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -169,30 +187,16 @@ del "$(SolutionDir)bin\$(TargetName).lib"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -210,13 +214,31 @@ del "$(SolutionDir)bin\$(TargetName).lib"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
@@ -224,37 +246,19 @@ del "$(SolutionDir)bin\$(TargetName).lib"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/DivaGL/gl_array_buffer.hpp b/src/DivaGL/GL/array_buffer.cpp
similarity index 74%
rename from src/DivaGL/gl_array_buffer.hpp
rename to src/DivaGL/GL/array_buffer.cpp
index dc22386..49f6d5c 100644
--- a/src/DivaGL/gl_array_buffer.hpp
+++ b/src/DivaGL/GL/array_buffer.cpp
@@ -3,33 +3,15 @@
GitHub/GitLab: korenkonder
*/
-#pragma once
+#include "array_buffer.hpp"
+#include "../gl_state.hpp"
-#include "wrap.hpp"
-#include "gl_state.hpp"
-
-struct GLArrayBuffer {
-private:
- GLuint buffer;
-
-public:
- inline GLArrayBuffer() : buffer() {
-
- }
-
- inline GLArrayBuffer(GLuint buffer) : buffer(buffer) {
-
- }
-
- inline ~GLArrayBuffer() {
-
- }
-
- inline void Bind(bool force = false) {
+namespace GL {
+ void ArrayBuffer::Bind(bool force) {
gl_state_bind_array_buffer(buffer, force);
}
- inline void Create(size_t size) {
+ void ArrayBuffer::Create(size_t size) {
if (buffer)
return;
@@ -48,7 +30,7 @@ public:
}
}
- inline void Create(size_t size, const void* data, bool dynamic = false) {
+ void ArrayBuffer::Create(size_t size, const void* data, bool dynamic) {
if (buffer)
return;
@@ -69,18 +51,14 @@ public:
}
}
- inline void Destroy() {
+ void ArrayBuffer::Destroy() {
if (buffer) {
glDeleteBuffers(1, &buffer);
buffer = 0;
}
}
- inline bool IsNull() {
- return !buffer;
- }
-
- inline void* MapMemory() {
+ void* ArrayBuffer::MapMemory() {
if (!buffer)
return 0;
@@ -104,7 +82,7 @@ public:
return 0;
}
- inline void* MapMemory(size_t offset, size_t length) {
+ void* ArrayBuffer::MapMemory(size_t offset, size_t length) {
if (!buffer)
return 0;
@@ -128,11 +106,7 @@ public:
return 0;
}
- inline bool NotNull() {
- return !!buffer;
- }
-
- inline void UnmapMemory() {
+ void ArrayBuffer::UnmapMemory() {
if (!buffer)
return;
@@ -144,7 +118,7 @@ public:
}
}
- inline void WriteMemory(size_t offset, size_t size, const void* data) {
+ void ArrayBuffer::WriteMemory(size_t offset, size_t size, const void* data) {
if (!buffer)
return;
@@ -155,17 +129,4 @@ public:
glBufferSubData(GL_ARRAY_BUFFER, (GLsizeiptr)offset, (GLsizeiptr)size, data);
}
}
-
- template
- inline void WriteMemory(T& data) {
- if (!buffer)
- return;
-
- if (GL_VERSION_4_5)
- glNamedBufferSubData(buffer, 0, sizeof(T), &data);
- else {
- gl_state_bind_array_buffer(buffer);
- glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(T), &data);
- }
- }
-};
+}
diff --git a/src/DivaGL/GL/array_buffer.hpp b/src/DivaGL/GL/array_buffer.hpp
new file mode 100644
index 0000000..86f547f
--- /dev/null
+++ b/src/DivaGL/GL/array_buffer.hpp
@@ -0,0 +1,55 @@
+/*
+ by korenkonder
+ GitHub/GitLab: korenkonder
+*/
+
+#pragma once
+
+#include "../../KKdLib/default.hpp"
+#include "../wrap.hpp"
+
+namespace GL {
+ struct ArrayBuffer {
+ private:
+ GLuint buffer;
+
+ public:
+ inline ArrayBuffer() : buffer() {
+
+ }
+
+ inline ArrayBuffer(GLuint buffer) : buffer(buffer) {
+
+ }
+
+ inline ~ArrayBuffer() {
+
+ }
+
+ void Bind(bool force = false);
+ void Create(size_t size);
+ void Create(size_t size, const void* data, bool dynamic = false);
+ void Destroy();
+ void* MapMemory();
+ void* MapMemory(size_t offset, size_t length);
+ void UnmapMemory();
+ void WriteMemory(size_t offset, size_t size, const void* data);
+
+ inline bool IsNull() {
+ return !buffer;
+ }
+
+ inline bool NotNull() {
+ return !!buffer;
+ }
+
+ template
+ inline void WriteMemory(T& data) {
+ WriteMemory(0, sizeof(T), &data);
+ }
+
+ inline operator GLuint() const {
+ return buffer;
+ }
+ };
+}
diff --git a/src/DivaGL/gl_element_array_buffer.hpp b/src/DivaGL/GL/element_array_buffer.cpp
similarity index 75%
rename from src/DivaGL/gl_element_array_buffer.hpp
rename to src/DivaGL/GL/element_array_buffer.cpp
index c5b7326..0a8345c 100644
--- a/src/DivaGL/gl_element_array_buffer.hpp
+++ b/src/DivaGL/GL/element_array_buffer.cpp
@@ -3,29 +3,15 @@
GitHub/GitLab: korenkonder
*/
-#pragma once
+#include "element_array_buffer.hpp"
+#include "../gl_state.hpp"
-#include "wrap.hpp"
-#include "gl_state.hpp"
-
-struct GLElementArrayBuffer {
-private:
- GLuint buffer;
-
-public:
- inline GLElementArrayBuffer() : buffer() {
-
- }
-
- inline ~GLElementArrayBuffer() {
-
- }
-
- inline void Bind(bool force = false) {
+namespace GL {
+ void ElementArrayBuffer::Bind(bool force) {
gl_state_bind_element_array_buffer(buffer, force);
}
- inline void Create(size_t size) {
+ void ElementArrayBuffer::Create(size_t size) {
if (buffer)
return;
@@ -44,7 +30,7 @@ public:
}
}
- inline void Create(size_t size, const void* data, bool dynamic = false) {
+ void ElementArrayBuffer::Create(size_t size, const void* data, bool dynamic) {
if (buffer)
return;
@@ -65,18 +51,14 @@ public:
}
}
- inline void Destroy() {
+ void ElementArrayBuffer::Destroy() {
if (buffer) {
glDeleteBuffers(1, &buffer);
buffer = 0;
}
}
- inline bool IsNull() {
- return !buffer;
- }
-
- inline void* MapMemory() {
+ void* ElementArrayBuffer::MapMemory() {
if (!buffer)
return 0;
@@ -100,7 +82,7 @@ public:
return 0;
}
- inline void* MapMemory(size_t offset, size_t length) {
+ void* ElementArrayBuffer::MapMemory(size_t offset, size_t length) {
if (!buffer)
return 0;
@@ -124,11 +106,7 @@ public:
return 0;
}
- inline bool NotNull() {
- return !!buffer;
- }
-
- inline void UnmapMemory() {
+ void ElementArrayBuffer::UnmapMemory() {
if (!buffer)
return;
@@ -140,7 +118,7 @@ public:
}
}
- inline void WriteMemory(size_t offset, size_t size, const void* data) {
+ void ElementArrayBuffer::WriteMemory(size_t offset, size_t size, const void* data) {
if (!buffer)
return;
@@ -151,17 +129,4 @@ public:
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)offset, (GLsizeiptr)size, data);
}
}
-
- template
- inline void WriteMemory(T& data) {
- if (!buffer)
- return;
-
- if (GL_VERSION_4_5)
- glNamedBufferSubData(buffer, 0, sizeof(T), &data);
- else {
- gl_state_bind_element_array_buffer(buffer);
- glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, sizeof(T), &data);
- }
- }
-};
+}
diff --git a/src/DivaGL/GL/element_array_buffer.hpp b/src/DivaGL/GL/element_array_buffer.hpp
new file mode 100644
index 0000000..6dd0ea4
--- /dev/null
+++ b/src/DivaGL/GL/element_array_buffer.hpp
@@ -0,0 +1,51 @@
+/*
+ by korenkonder
+ GitHub/GitLab: korenkonder
+*/
+
+#pragma once
+
+#include "../../KKdLib/default.hpp"
+#include "../wrap.hpp"
+
+namespace GL {
+ struct ElementArrayBuffer {
+ private:
+ GLuint buffer;
+
+ public:
+ inline ElementArrayBuffer() : buffer() {
+
+ }
+
+ inline ~ElementArrayBuffer() {
+
+ }
+
+ void Bind(bool force = false);
+ void Create(size_t size);
+ void Create(size_t size, const void* data, bool dynamic = false);
+ void Destroy();
+ void* MapMemory();
+ void* MapMemory(size_t offset, size_t length);
+ void UnmapMemory();
+ void WriteMemory(size_t offset, size_t size, const void* data);
+
+ inline bool IsNull() {
+ return !buffer;
+ }
+
+ inline bool NotNull() {
+ return !!buffer;
+ }
+
+ template
+ inline void WriteMemory(T& data) {
+ WriteMemory(0, sizeof(T), &data);
+ }
+
+ inline operator GLuint() const {
+ return buffer;
+ }
+ };
+}
diff --git a/src/DivaGL/gl_shader_storage_buffer.hpp b/src/DivaGL/GL/shader_storage_buffer.cpp
similarity index 75%
rename from src/DivaGL/gl_shader_storage_buffer.hpp
rename to src/DivaGL/GL/shader_storage_buffer.cpp
index 4842d91..b15979d 100644
--- a/src/DivaGL/gl_shader_storage_buffer.hpp
+++ b/src/DivaGL/GL/shader_storage_buffer.cpp
@@ -3,29 +3,15 @@
GitHub/GitLab: korenkonder
*/
-#pragma once
+#include "shader_storage_buffer.hpp"
+#include "../gl_state.hpp"
-#include "wrap.hpp"
-#include "gl_state.hpp"
-
-struct GLShaderStorageBuffer {
-private:
- GLuint buffer;
-
-public:
- inline GLShaderStorageBuffer() : buffer() {
-
- }
-
- inline ~GLShaderStorageBuffer() {
-
- }
-
- inline void Bind(int32_t index, bool force = false) {
+namespace GL {
+ void ShaderStorageBuffer::Bind(int32_t index, bool force) {
gl_state_bind_shader_storage_buffer_base(index, buffer, force);
}
- inline void Create(size_t size) {
+ void ShaderStorageBuffer::Create(size_t size) {
if (buffer)
return;
@@ -44,7 +30,7 @@ public:
}
}
- inline void Create(size_t size, const void* data, bool dynamic = false) {
+ void ShaderStorageBuffer::Create(size_t size, const void* data, bool dynamic) {
if (buffer)
return;
@@ -65,18 +51,14 @@ public:
}
}
- inline void Destroy() {
+ void ShaderStorageBuffer::Destroy() {
if (buffer) {
glDeleteBuffers(1, &buffer);
buffer = 0;
}
}
- inline bool IsNull() {
- return !buffer;
- }
-
- inline void* MapMemory() {
+ void* ShaderStorageBuffer::MapMemory() {
if (!buffer)
return 0;
@@ -100,7 +82,7 @@ public:
return 0;
}
- inline void* MapMemory(size_t offset, size_t length) {
+ void* ShaderStorageBuffer::MapMemory(size_t offset, size_t length) {
if (!buffer)
return 0;
@@ -124,11 +106,7 @@ public:
return 0;
}
- inline bool NotNull() {
- return !!buffer;
- }
-
- inline void UnmapMemory() {
+ void ShaderStorageBuffer::UnmapMemory() {
if (!buffer)
return;
@@ -140,7 +118,7 @@ public:
}
}
- inline void WriteMemory(size_t offset, size_t size, const void* data) {
+ void ShaderStorageBuffer::WriteMemory(size_t offset, size_t size, const void* data) {
if (!buffer)
return;
@@ -151,17 +129,4 @@ public:
glBufferSubData(GL_SHADER_STORAGE_BUFFER, (GLsizeiptr)offset, (GLsizeiptr)size, data);
}
}
-
- template
- inline void WriteMemory(T& data) {
- if (!buffer)
- return;
-
- if (GL_VERSION_4_5)
- glNamedBufferSubData(buffer, 0, sizeof(T), &data);
- else {
- gl_state_bind_shader_storage_buffer(buffer);
- glBufferSubData(GL_SHADER_STORAGE_BUFFER, 0, sizeof(T), &data);
- }
- }
-};
+}
diff --git a/src/DivaGL/GL/shader_storage_buffer.hpp b/src/DivaGL/GL/shader_storage_buffer.hpp
new file mode 100644
index 0000000..efc666d
--- /dev/null
+++ b/src/DivaGL/GL/shader_storage_buffer.hpp
@@ -0,0 +1,51 @@
+/*
+ by korenkonder
+ GitHub/GitLab: korenkonder
+*/
+
+#pragma once
+
+#include "../../KKdLib/default.hpp"
+#include "../wrap.hpp"
+
+namespace GL {
+ struct ShaderStorageBuffer {
+ private:
+ GLuint buffer;
+
+ public:
+ inline ShaderStorageBuffer() : buffer() {
+
+ }
+
+ inline ~ShaderStorageBuffer() {
+
+ }
+
+ void Bind(int32_t index, bool force = false);
+ void Create(size_t size);
+ void Create(size_t size, const void* data, bool dynamic = false);
+ void Destroy();
+ void* MapMemory();
+ void* MapMemory(size_t offset, size_t length);
+ void UnmapMemory();
+ void WriteMemory(size_t offset, size_t size, const void* data);
+
+ inline bool IsNull() {
+ return !buffer;
+ }
+
+ inline bool NotNull() {
+ return !!buffer;
+ }
+
+ template
+ inline void WriteMemory(T& data) {
+ WriteMemory(0, sizeof(T), &data);
+ }
+
+ inline operator GLuint() const {
+ return buffer;
+ }
+ };
+}
diff --git a/src/DivaGL/gl_uniform_buffer.hpp b/src/DivaGL/GL/uniform_buffer.cpp
similarity index 75%
rename from src/DivaGL/gl_uniform_buffer.hpp
rename to src/DivaGL/GL/uniform_buffer.cpp
index e1ca820..00c631d 100644
--- a/src/DivaGL/gl_uniform_buffer.hpp
+++ b/src/DivaGL/GL/uniform_buffer.cpp
@@ -3,29 +3,15 @@
GitHub/GitLab: korenkonder
*/
-#pragma once
+#include "uniform_buffer.hpp"
+#include "../gl_state.hpp"
-#include "wrap.hpp"
-#include "gl_state.hpp"
-
-struct GLUniformBuffer {
-private:
- GLuint buffer;
-
-public:
- inline GLUniformBuffer() : buffer() {
-
- }
-
- inline ~GLUniformBuffer() {
-
- }
-
- inline void Bind(int32_t index, bool force = false) {
+namespace GL {
+ void UniformBuffer::Bind(int32_t index, bool force) {
gl_state_bind_uniform_buffer_base(index, buffer, force);
}
- inline void Create(size_t size) {
+ void UniformBuffer::Create(size_t size) {
if (buffer)
return;
@@ -44,7 +30,7 @@ public:
}
}
- inline void Create(size_t size, const void* data, bool dynamic = false) {
+ void UniformBuffer::Create(size_t size, const void* data, bool dynamic) {
if (buffer)
return;
@@ -65,18 +51,14 @@ public:
}
}
- inline void Destroy() {
+ void UniformBuffer::Destroy() {
if (buffer) {
glDeleteBuffers(1, &buffer);
buffer = 0;
}
}
- inline bool IsNull() {
- return !buffer;
- }
-
- inline void* MapMemory() {
+ void* UniformBuffer::MapMemory() {
if (!buffer)
return 0;
@@ -100,7 +82,7 @@ public:
return 0;
}
- inline void* MapMemory(size_t offset, size_t length) {
+ void* UniformBuffer::MapMemory(size_t offset, size_t length) {
if (!buffer)
return 0;
@@ -124,11 +106,7 @@ public:
return 0;
}
- inline bool NotNull() {
- return !!buffer;
- }
-
- inline void UnmapMemory() {
+ void UniformBuffer::UnmapMemory() {
if (!buffer)
return;
@@ -140,7 +118,7 @@ public:
}
}
- inline void WriteMemory(size_t offset, size_t size, const void* data) {
+ void UniformBuffer::WriteMemory(size_t offset, size_t size, const void* data) {
if (!buffer)
return;
@@ -151,17 +129,4 @@ public:
glBufferSubData(GL_UNIFORM_BUFFER, (GLsizeiptr)offset, (GLsizeiptr)size, data);
}
}
-
- template
- inline void WriteMemory(T& data) {
- if (!buffer)
- return;
-
- if (GL_VERSION_4_5)
- glNamedBufferSubData(buffer, 0, sizeof(T), &data);
- else {
- gl_state_bind_uniform_buffer(buffer);
- glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(T), &data);
- }
- }
};
diff --git a/src/DivaGL/GL/uniform_buffer.hpp b/src/DivaGL/GL/uniform_buffer.hpp
new file mode 100644
index 0000000..24ac5b5
--- /dev/null
+++ b/src/DivaGL/GL/uniform_buffer.hpp
@@ -0,0 +1,51 @@
+/*
+ by korenkonder
+ GitHub/GitLab: korenkonder
+*/
+
+#pragma once
+
+#include "../../KKdLib/default.hpp"
+#include "../wrap.hpp"
+
+namespace GL {
+ struct UniformBuffer {
+ private:
+ GLuint buffer;
+
+ public:
+ inline UniformBuffer() : buffer() {
+
+ }
+
+ inline ~UniformBuffer() {
+
+ }
+
+ void Bind(int32_t index, bool force = false);
+ void Create(size_t size);
+ void Create(size_t size, const void* data, bool dynamic = false);
+ void Destroy();
+ void* MapMemory();
+ void* MapMemory(size_t offset, size_t length);
+ void UnmapMemory();
+ void WriteMemory(size_t offset, size_t size, const void* data);
+
+ inline bool IsNull() {
+ return !buffer;
+ }
+
+ inline bool NotNull() {
+ return !!buffer;
+ }
+
+ template
+ inline void WriteMemory(T& data) {
+ WriteMemory(0, sizeof(T), &data);
+ }
+
+ inline operator GLuint() const {
+ return buffer;
+ }
+ };
+}
diff --git a/src/DivaGL/Glitter/glitter.cpp b/src/DivaGL/Glitter/glitter.cpp
index 8db7dac..12c02e1 100644
--- a/src/DivaGL/Glitter/glitter.cpp
+++ b/src/DivaGL/Glitter/glitter.cpp
@@ -28,7 +28,7 @@ namespace Glitter {
*angle = (float_t)M_PI - *angle;
}
- void CreateBuffer(int32_t max_count, bool is_quad, GLuint& vao, GLArrayBuffer& vbo, GLElementArrayBuffer& ebo) {
+ void CreateBuffer(int32_t max_count, bool is_quad, GLuint& vao, GL::ArrayBuffer& vbo, GL::ElementArrayBuffer& ebo) {
glGenVertexArrays(1, &vao);
gl_state_bind_vertex_array(vao, true);
@@ -73,7 +73,7 @@ namespace Glitter {
gl_state_bind_element_array_buffer(0);
}
- void DeleteBuffer(GLuint& vao, GLArrayBuffer& vbo, GLElementArrayBuffer& ebo) {
+ void DeleteBuffer(GLuint& vao, GL::ArrayBuffer& vbo, GL::ElementArrayBuffer& ebo) {
ebo.Destroy();
vbo.Destroy();
diff --git a/src/DivaGL/Glitter/glitter.hpp b/src/DivaGL/Glitter/glitter.hpp
index c51ae23..67c9e8a 100644
--- a/src/DivaGL/Glitter/glitter.hpp
+++ b/src/DivaGL/Glitter/glitter.hpp
@@ -9,12 +9,12 @@
#include "../../KKdLib/hash.hpp"
#include "../../KKdLib/mat.hpp"
#include "../../KKdLib/vec.hpp"
+#include "../GL/array_buffer.hpp"
+#include "../GL/element_array_buffer.hpp"
#include "../color.hpp"
#include "../file_handler.hpp"
#include "../frame_rate_control.hpp"
#include "../gl.hpp"
-#include "../gl_array_buffer.hpp"
-#include "../gl_element_array_buffer.hpp"
#include "../object.hpp"
#include "../task.hpp"
#include "../types.hpp"
@@ -981,12 +981,12 @@ namespace Glitter {
struct Sub {
Glitter::Particle::Data data;
Glitter::Buffer* buffer;
- GLArrayBuffer vbo;
+ GL::ArrayBuffer vbo;
int32_t max_count;
bool field_168;
int32_t dword16C;
GLuint vao;
- GLElementArrayBuffer ebo;
+ GL::ElementArrayBuffer ebo;
DrawListData* draw_list;
};
@@ -1147,12 +1147,12 @@ namespace Glitter {
ParticleInst* particle_inst;
DispType disp_type;
FogType fog_type;
- GLArrayBuffer vbo;
+ GL::ArrayBuffer vbo;
float_t emission;
bool use_own_buffer;
int32_t dword12C;
GLuint vao;
- GLElementArrayBuffer ebo;
+ GL::ElementArrayBuffer ebo;
size_t disp;
mat4 mat_draw;
DrawListData* draw_list;
@@ -1192,8 +1192,8 @@ namespace Glitter {
DispType disp_type;
FogType fog_type;
GLuint vao;
- GLArrayBuffer vbo;
- GLElementArrayBuffer ebo;
+ GL::ArrayBuffer vbo;
+ GL::ElementArrayBuffer ebo;
float_t emission;
DrawListData draw_list;
@@ -1462,8 +1462,8 @@ namespace Glitter {
extern void axis_angle_from_vectors(vec3* axis, float_t* angle, const vec3* vec0, const vec3* vec1);
extern void CreateBuffer(int32_t max_count, bool is_quad,
- GLuint& vao, GLArrayBuffer& vbo, GLElementArrayBuffer& ebo);
- extern void DeleteBuffer(GLuint& vao, GLArrayBuffer& vbo, GLElementArrayBuffer& ebo);
+ GLuint& vao, GL::ArrayBuffer& vbo, GL::ElementArrayBuffer& ebo);
+ extern void DeleteBuffer(GLuint& vao, GL::ArrayBuffer& vbo, GL::ElementArrayBuffer& ebo);
extern void Patch();
}
diff --git a/src/DivaGL/Glitter/render_group.cpp b/src/DivaGL/Glitter/render_group.cpp
index ab4508a..7104179 100644
--- a/src/DivaGL/Glitter/render_group.cpp
+++ b/src/DivaGL/Glitter/render_group.cpp
@@ -69,7 +69,7 @@ namespace Glitter {
else {
size_t particle = *(size_t*)((size_t)rend_group->particle_inst + 0x98 + 0x178);
rend_group->vao = *((GLuint*)(particle + 0x40 + 0x170));
- rend_group->ebo = *((GLElementArrayBuffer*)(particle + 0x40 + 0x174));
+ rend_group->ebo = *((GL::ElementArrayBuffer*)(particle + 0x40 + 0x174));
rend_group->draw_list = *(DrawListData**)(particle
+ 0x40 + 0x170 + sizeof(GLuint) * 2);
}
diff --git a/src/DivaGL/effect.cpp b/src/DivaGL/effect.cpp
index ba8e819..ce2cfb4 100644
--- a/src/DivaGL/effect.cpp
+++ b/src/DivaGL/effect.cpp
@@ -7,14 +7,19 @@
#include "../KKdLib/prj/algorithm.hpp"
#include "../KKdLib/prj/vector_pair.hpp"
#include "../KKdLib/hash.hpp"
+#include "GL/element_array_buffer.hpp"
+#include "GL/shader_storage_buffer.hpp"
+#include "GL/uniform_buffer.hpp"
+#include "rob/rob.hpp"
#include "auth_3d.hpp"
#include "file_handler.hpp"
#include "frame_rate_control.hpp"
#include "gl_state.hpp"
-#include "gl_element_array_buffer.hpp"
#include "render_context.hpp"
#include "render_manager.hpp"
+#include "render_texture.hpp"
#include "shader_ft.hpp"
+#include "stage.hpp"
#include "stage_param.hpp"
#include "texture.hpp"
#include
@@ -228,8 +233,8 @@ struct particle_vertex_data {
};
struct star_catalog_milky_way {
- GLArrayBuffer vbo;
- GLElementArrayBuffer ebo;
+ GL::ArrayBuffer vbo;
+ GL::ElementArrayBuffer ebo;
GLuint vao;
uint16_t restart_index;
int32_t idx_count;
@@ -247,7 +252,7 @@ struct star_catalog_milky_way {
float_t longitude_offset_degs_10, float_t latitude_offset_degs_10);
void create_default_sphere();
void delete_buffers();
- void draw(const mat4& vp, const mat4& model, texture* tex, GLUniformBuffer& scene_ubo);
+ void draw(const mat4& vp, const mat4& model, texture* tex, GL::UniformBuffer& scene_ubo);
};
static_assert(sizeof(star_catalog_milky_way) == 0x34, "\"star_catalog_milky_way\" struct should have a size of 0x34");
@@ -414,48 +419,48 @@ struct water_particle_scene_shader_data {
vec4 g_state_point_attenuation;
};
-static prj::vector_pair fog_ring_ssbo;
+static prj::vector_pair fog_ring_ssbo;
static GLuint leaf_ptcl_vao;
-static GLArrayBuffer leaf_ptcl_vbo;
-static GLElementArrayBuffer leaf_ptcl_ebo;
-static GLUniformBuffer leaf_particle_scene_ubo;
+static GL::ArrayBuffer leaf_ptcl_vbo;
+static GL::ElementArrayBuffer leaf_ptcl_ebo;
+static GL::UniformBuffer leaf_particle_scene_ubo;
static const size_t leaf_ptcl_count = 0x800;
static GLuint ptcl_vao;
-static GLArrayBuffer ptcl_vbo;
-static GLUniformBuffer particle_scene_ubo;
+static GL::ArrayBuffer ptcl_vbo;
+static GL::UniformBuffer particle_scene_ubo;
static const size_t ptcl_count = 0x400;
-static GLShaderStorageBuffer rain_ssbo;
-static GLUniformBuffer rain_particle_scene_ubo;
-static GLUniformBuffer rain_particle_batch_ubo;
+static GL::ShaderStorageBuffer rain_ssbo;
+static GL::UniformBuffer rain_particle_scene_ubo;
+static GL::UniformBuffer rain_particle_batch_ubo;
static const size_t rain_ptcl_count = 0x8000;
-static GLUniformBuffer ripple_batch_ubo;
-static GLUniformBuffer ripple_scene_ubo;
+static GL::UniformBuffer ripple_batch_ubo;
+static GL::UniformBuffer ripple_scene_ubo;
-static GLShaderStorageBuffer ripple_emit_ssbo;
-static GLUniformBuffer ripple_emit_scene_ubo;
+static GL::ShaderStorageBuffer ripple_emit_ssbo;
+static GL::UniformBuffer ripple_emit_scene_ubo;
static const size_t ripple_emit_count = 5000;
-static GLShaderStorageBuffer snow_ssbo;
-static GLShaderStorageBuffer snow_gpu_ssbo;
-static GLShaderStorageBuffer snow_fallen_ssbo;
-static GLUniformBuffer snow_particle_scene_ubo;
-static GLUniformBuffer snow_particle_batch_ubo;
+static GL::ShaderStorageBuffer snow_ssbo;
+static GL::ShaderStorageBuffer snow_gpu_ssbo;
+static GL::ShaderStorageBuffer snow_fallen_ssbo;
+static GL::UniformBuffer snow_particle_scene_ubo;
+static GL::UniformBuffer snow_particle_batch_ubo;
static const size_t snow_ptcl_count = 0x8000;
static const size_t snow_ptcl_fallen_count = 0x2000;
-static GLShaderStorageBuffer stars_ssbo;
-static GLUniformBuffer stars_scene_ubo;
-static GLUniformBuffer stars_batch_ubo;
+static GL::ShaderStorageBuffer stars_ssbo;
+static GL::UniformBuffer stars_scene_ubo;
+static GL::UniformBuffer stars_batch_ubo;
static int32_t star_count;
static int32_t star_b_count;
static GLuint star_sampler;
-static prj::vector_pair water_particle_ssbo;
-static GLUniformBuffer water_particle_scene_ubo;
+static prj::vector_pair water_particle_ssbo;
+static GL::UniformBuffer water_particle_scene_ubo;
static float_t& snow_particle_delta_frame = *(float_t*)0x0000000140C9A4E0;
@@ -814,7 +819,7 @@ HOOK(void, FASTCALL, EffectFogRing__calc_vert, 0x000000001403495B0, EffectFogRin
if (elem == fog_ring_ssbo.end())
return;
- GLShaderStorageBuffer& ssbo = elem->second;
+ GL::ShaderStorageBuffer& ssbo = elem->second;
float_t density = fog_ring->density;
fog_ring_data* ptcl_data = fog_ring->ptcl_data;
@@ -1674,7 +1679,7 @@ void star_catalog_milky_way::delete_buffers() {
}
}
-void star_catalog_milky_way::draw(const mat4& vp, const mat4& mat, texture* tex, GLUniformBuffer& scene_ubo) {
+void star_catalog_milky_way::draw(const mat4& vp, const mat4& mat, texture* tex, GL::UniformBuffer& scene_ubo) {
if (!vao)
return;
@@ -1920,7 +1925,7 @@ void water_particle::draw(mat4* mat) {
if (elem == water_particle_ssbo.end())
return;
- GLShaderStorageBuffer& ssbo = elem->second;
+ GL::ShaderStorageBuffer& ssbo = elem->second;
water_particle_vertex_data* vtx_data = (water_particle_vertex_data*)ssbo.MapMemory();
if (!vtx_data)
@@ -1978,7 +1983,7 @@ static void draw_fog_particle(EffectFogRing* data, mat4* mat) {
if (elem == fog_ring_ssbo.end())
return;
- GLShaderStorageBuffer& ssbo = elem->second;
+ GL::ShaderStorageBuffer& ssbo = elem->second;
shaders_ft.set(SHADER_FT_FOGPTCL);
gl_state_enable_blend();
diff --git a/src/DivaGL/effect.hpp b/src/DivaGL/effect.hpp
index a0139ba..25377b2 100644
--- a/src/DivaGL/effect.hpp
+++ b/src/DivaGL/effect.hpp
@@ -6,15 +6,8 @@
#pragma once
#include "../KKdLib/default.hpp"
-#include "../KKdLib/vec.hpp"
#include "../KKdLib/mat.hpp"
#include "../KKdLib/vec.hpp"
-#include "gl_shader_storage_buffer.hpp"
-#include "gl_uniform_buffer.hpp"
-#include "rob/rob.hpp"
-#include "render_texture.hpp"
-#include "stage.hpp"
-#include "stage_param.hpp"
enum EffectType {
EFFECT_INVALID = -1,
diff --git a/src/DivaGL/gl.hpp b/src/DivaGL/gl.hpp
index 28be4ee..40bb3cc 100644
--- a/src/DivaGL/gl.hpp
+++ b/src/DivaGL/gl.hpp
@@ -464,7 +464,7 @@ typedef enum SpecialNumbers {
WGL_FONT_POLYGONS = 1,
} SpecialNumbers;
-typedef enum GL {
+typedef enum _GL {
GL_POINTS = 0x0000,
GL_LINES = 0x0001,
GL_LINE_LOOP = 0x0002,
@@ -5938,7 +5938,7 @@ typedef enum GL {
WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB = 0x8256,
WGL_NO_RESET_NOTIFICATION_ARB = 0x8261,
WGL_CONTEXT_PROFILE_MASK_ARB = 0x9126,
-} GL;
+} _GL;
typedef enum RegisterCombinerPname {
GL_COMBINE = 0x8570,
diff --git a/src/DivaGL/mdl/disp_manager.hpp b/src/DivaGL/mdl/disp_manager.hpp
index 8e9c1e5..a6aa757 100644
--- a/src/DivaGL/mdl/disp_manager.hpp
+++ b/src/DivaGL/mdl/disp_manager.hpp
@@ -8,8 +8,8 @@
#include "../../KKdLib/default.hpp"
#include "../../KKdLib/mat.hpp"
#include "../../KKdLib/vec.hpp"
-#include "../gl_array_buffer.hpp"
-#include "../gl_element_array_buffer.hpp"
+#include "../GL/array_buffer.hpp"
+#include "../GL/element_array_buffer.hpp"
#include "../color.hpp"
#include "../object.hpp"
#include "../shadow.hpp"
@@ -397,8 +397,8 @@ namespace mdl {
};
struct etc_vertex_array {
- GLArrayBuffer vertex_buffer;
- GLElementArrayBuffer index_buffer;
+ GL::ArrayBuffer vertex_buffer;
+ GL::ElementArrayBuffer index_buffer;
int32_t alive_time;
GLuint vertex_array;
EtcObj::Data data;
diff --git a/src/DivaGL/render.hpp b/src/DivaGL/render.hpp
index d6ff429..459ae39 100644
--- a/src/DivaGL/render.hpp
+++ b/src/DivaGL/render.hpp
@@ -10,7 +10,7 @@
#include "renderer/dof.hpp"
#include "renderer/transparency.hpp"
#include "camera.hpp"
-#include "gl_uniform_buffer.hpp"
+#include "GL/uniform_buffer.hpp"
enum tone_map_method {
TONE_MAP_YCC_EXPONENT = 0,
diff --git a/src/DivaGL/render_context.cpp b/src/DivaGL/render_context.cpp
index 212987a..4de2608 100644
--- a/src/DivaGL/render_context.cpp
+++ b/src/DivaGL/render_context.cpp
@@ -614,12 +614,3 @@ void render_context::init() {
sss_data* sss_data_get() {
return &_sss_data;
}
-
-void fbo_blit(GLuint src_fbo, GLuint dst_fbo,
- GLint src_x, GLint src_y, GLint src_width, GLint src_height,
- GLint dst_x, GLint dst_y, GLint dst_width, GLint dst_height, GLbitfield mask, GLenum filter) {
- gl_state_bind_read_framebuffer(src_fbo);
- gl_state_bind_draw_framebuffer(dst_fbo);
- glBlitFramebuffer(src_x, src_y, src_x + src_width, src_y + src_height,
- dst_x, dst_y, dst_x + dst_width, dst_y + dst_height, mask, filter);
-}
diff --git a/src/DivaGL/render_context.hpp b/src/DivaGL/render_context.hpp
index 7a7b694..f199bb0 100644
--- a/src/DivaGL/render_context.hpp
+++ b/src/DivaGL/render_context.hpp
@@ -8,13 +8,12 @@
#include "../KKdLib/default.hpp"
#include "../KKdLib/mat.hpp"
#include "../KKdLib/vec.hpp"
+#include "GL/array_buffer.hpp"
+#include "GL/uniform_buffer.hpp"
#include "light_param/fog.hpp"
#include "light_param/light.hpp"
#include "mdl/disp_manager.hpp"
#include "camera.hpp"
-#include "gl_array_buffer.hpp"
-#include "gl_element_array_buffer.hpp"
-#include "gl_uniform_buffer.hpp"
#include "render.hpp"
#include "render_manager.hpp"
#include "render_texture.hpp"
@@ -374,10 +373,10 @@ struct render_context {
vec4 g_near_far;
GLuint box_vao;
- GLArrayBuffer box_vbo;
+ GL::ArrayBuffer box_vbo;
GLuint lens_ghost_vao;
- GLArrayBuffer lens_ghost_vbo;
+ GL::ArrayBuffer lens_ghost_vbo;
GLuint common_vao;
@@ -386,31 +385,31 @@ struct render_context {
RenderTexture screen_buffer;
RenderTexture shadow_buffer;
- GLUniformBuffer camera_blur_ubo;
- GLUniformBuffer contour_coef_ubo;
- GLUniformBuffer contour_params_ubo;
- GLUniformBuffer filter_scene_ubo;
- GLUniformBuffer esm_filter_batch_ubo;
- GLUniformBuffer imgfilter_batch_ubo;
- GLUniformBuffer exposure_measure_ubo;
- GLUniformBuffer gaussian_coef_ubo;
- GLUniformBuffer glass_eye_batch_ubo;
- GLUniformBuffer glitter_batch_ubo;
- GLUniformBuffer quad_ubo;
- GLUniformBuffer sprite_scene_ubo;
- GLUniformBuffer sss_filter_gaussian_coef_ubo;
- GLUniformBuffer sun_quad_ubo;
- GLUniformBuffer transparency_batch_ubo;
- GLUniformBuffer tone_map_ubo;
+ GL::UniformBuffer camera_blur_ubo;
+ GL::UniformBuffer contour_coef_ubo;
+ GL::UniformBuffer contour_params_ubo;
+ GL::UniformBuffer filter_scene_ubo;
+ GL::UniformBuffer esm_filter_batch_ubo;
+ GL::UniformBuffer imgfilter_batch_ubo;
+ GL::UniformBuffer exposure_measure_ubo;
+ GL::UniformBuffer gaussian_coef_ubo;
+ GL::UniformBuffer glass_eye_batch_ubo;
+ GL::UniformBuffer glitter_batch_ubo;
+ GL::UniformBuffer quad_ubo;
+ GL::UniformBuffer sprite_scene_ubo;
+ GL::UniformBuffer sss_filter_gaussian_coef_ubo;
+ GL::UniformBuffer sun_quad_ubo;
+ GL::UniformBuffer transparency_batch_ubo;
+ GL::UniformBuffer tone_map_ubo;
obj_shader_shader_data obj_shader;
obj_scene_shader_data obj_scene;
obj_batch_shader_data obj_batch;
obj_skinning_shader_data obj_skinning;
- GLUniformBuffer obj_shader_ubo;
- GLUniformBuffer obj_scene_ubo;
- GLUniformBuffer obj_batch_ubo;
- GLUniformBuffer obj_skinning_ubo;
+ GL::UniformBuffer obj_shader_ubo;
+ GL::UniformBuffer obj_scene_ubo;
+ GL::UniformBuffer obj_batch_ubo;
+ GL::UniformBuffer obj_skinning_ubo;
GLuint empty_texture_2d;
GLuint empty_texture_cube_map;
@@ -437,7 +436,3 @@ extern draw_state_struct& draw_state;
extern render_context* rctx;
extern sss_data* sss_data_get();
-
-void fbo_blit(GLuint src_fbo, GLuint dst_fbo,
- GLint src_x, GLint src_y, GLint src_width, GLint src_height,
- GLint dst_x, GLint dst_y, GLint dst_width, GLint dst_height, GLbitfield mask, GLenum filter);
diff --git a/src/DivaGL/renderer/dof.hpp b/src/DivaGL/renderer/dof.hpp
index dfabcf5..0a43fde 100644
--- a/src/DivaGL/renderer/dof.hpp
+++ b/src/DivaGL/renderer/dof.hpp
@@ -6,7 +6,7 @@
#pragma once
#include "../../KKdLib/default.hpp"
-#include "../gl_uniform_buffer.hpp"
+#include "../GL/uniform_buffer.hpp"
#include "../render_texture.hpp"
#include "fbo.hpp"
#include "gl_program.hpp"
@@ -53,8 +53,8 @@ namespace renderer {
GLuint samplers[2];
GLuint vao;
GLProgram program[9];
- GLUniformBuffer common_ubo;
- GLUniformBuffer texcoords_ubo;
+ GL::UniformBuffer common_ubo;
+ GL::UniformBuffer texcoords_ubo;
DOF3(int32_t width, int32_t height);
~DOF3();
diff --git a/src/DivaGL/rob/rob.cpp b/src/DivaGL/rob/rob.cpp
index 7c1aa40..9692b29 100644
--- a/src/DivaGL/rob/rob.cpp
+++ b/src/DivaGL/rob/rob.cpp
@@ -325,7 +325,7 @@ HOOK(void, FASTCALL, RobCloth__UpdateVertexBuffer, 0x000000014021CF00, obj_mesh*
return;
vertex_buffer->cycle_index();
- GLArrayBuffer buffer = vertex_buffer->get_buffer();
+ GL::ArrayBuffer buffer = vertex_buffer->get_buffer();
size_t data = (size_t)buffer.MapMemory();
if (!data)
return;
@@ -920,7 +920,7 @@ void rob_chara_age_age_object::disp(size_t chara_index,
obj_vert_buf.cycle_index();
- GLArrayBuffer buffer = obj_vert_buf.get_buffer();
+ GL::ArrayBuffer buffer = obj_vert_buf.get_buffer();
size_t vtx_data = (size_t)buffer.MapMemory();
if (!vtx_data)
return;
diff --git a/src/DivaGL/shared.cpp b/src/DivaGL/shared.cpp
index 030c087..0009e04 100644
--- a/src/DivaGL/shared.cpp
+++ b/src/DivaGL/shared.cpp
@@ -4,3 +4,13 @@
*/
#include "shared.hpp"
+#include "gl_state.hpp"
+
+void fbo_blit(GLuint src_fbo, GLuint dst_fbo,
+ GLint src_x, GLint src_y, GLint src_width, GLint src_height,
+ GLint dst_x, GLint dst_y, GLint dst_width, GLint dst_height, GLbitfield mask, GLenum filter) {
+ gl_state_bind_read_framebuffer(src_fbo);
+ gl_state_bind_draw_framebuffer(dst_fbo);
+ glBlitFramebuffer(src_x, src_y, src_x + src_width, src_y + src_height,
+ dst_x, dst_y, dst_x + dst_width, dst_y + dst_height, mask, filter);
+}
diff --git a/src/DivaGL/shared.hpp b/src/DivaGL/shared.hpp
index 67a3f23..13fe2ac 100644
--- a/src/DivaGL/shared.hpp
+++ b/src/DivaGL/shared.hpp
@@ -17,3 +17,7 @@ enum blur_filter_mode {
BLUR_FILTER_32,
BLUR_FILTER_MAX,
};
+
+extern void fbo_blit(GLuint src_fbo, GLuint dst_fbo,
+ GLint src_x, GLint src_y, GLint src_width, GLint src_height,
+ GLint dst_x, GLint dst_y, GLint dst_width, GLint dst_height, GLbitfield mask, GLenum filter);
diff --git a/src/DivaGL/sprite.cpp b/src/DivaGL/sprite.cpp
index 5414d5a..c1d135f 100644
--- a/src/DivaGL/sprite.cpp
+++ b/src/DivaGL/sprite.cpp
@@ -69,9 +69,9 @@ namespace spr {
std::vector vertex_buffer;
std::vector index_buffer;
GLuint vao;
- GLArrayBuffer vbo;
+ GL::ArrayBuffer vbo;
size_t vbo_vertex_count;
- GLElementArrayBuffer ebo;
+ GL::ElementArrayBuffer ebo;
size_t ebo_index_count;
RenderData();