initial commit

This commit is contained in:
ZY4N
2024-12-10 13:50:21 +01:00
parent 20bbd06a89
commit 275d47b7c6
33 changed files with 1066 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
#pragma once
namespace zgl
{
using alpha_handle = float;
} // namespace zgl

View File

@@ -0,0 +1,16 @@
#pragma once
#include <optional>
#include "opengl/handles/texture_handle.hpp"
#include "opengl/handles/surface_properties_handle.hpp"
#include "opengl/handles/alpha_handle.hpp"
namespace zgl
{
struct material_handle
{
std::optional<texture_handle> texture{ std::nullopt };
std::optional<surface_properties_handle> surface_properties{ std::nullopt };
std::optional<alpha_handle> alpha{ std::nullopt };
};
}

View File

@@ -0,0 +1,12 @@
#pragma once
#include "glm/glm.hpp"
namespace zgl
{
using model_matrix_handle = glm::mat4x4;
using view_matrix_handle = glm::mat4x4;
using projection_matrix_handle = glm::mat4x4;
}

View File

@@ -0,0 +1,20 @@
#pragma once
#include "GL/glew.h"
#include "util/uix.hpp"
namespace zgl
{
struct mesh_handle
{
inline void bind() const;
inline static void unbind();
GLuint vao_id{ 0 };
GLsizei index_count{ 0 };
};
}
#define INCLUDE_MESH_INSTANCE_IMPLEMENTATION
#include "opengl/handles/mesh_handle.ipp"
#undef INCLUDE_MESH_INSTANCE_IMPLEMENTATION

View File

@@ -0,0 +1,20 @@
#pragma once
#include "GL/glew.h"
#include "util/uix.hpp"
namespace zgl
{
struct point_cloud_handle
{
inline void bind() const;
inline static void unbind();
GLuint vao_id{ 0 };
GLsizei point_count{ 0 };
};
}
#define INCLUDE_POINT_CLOUD_INSTANCE_IMPLEMENTATION
#include "opengl/handles/point_cloud_handle.ipp"
#undef INCLUDE_POINT_CLOUD_INSTANCE_IMPLEMENTATION

View File

@@ -0,0 +1,33 @@
#pragma once
#include "GL/glew.h"
#include "opengl/shader_program_variable.hpp"
#include "opengl/shader_program_variable.hpp"
#include "util/uix.hpp"
#include <span>
namespace zgl
{
struct shader_program_handle
{
using attribute_support_type = ztu::u32;
using uniform_support_type = ztu::u32;
inline void bind() const;
static void unbind();
template<shader_program_variable::info_type VariableInfo, typename T>
void set_uniform(const T& value) const;
[[nodiscard]] attribute_support_type check_attribute_support(std::span<const shader_program_variable> attributes) const;
[[nodiscard]] uniform_support_type check_uniform_support(std::span<const shader_program_variable> uniforms) const;
GLuint program_id{ 0 };
};
}
#define INCLUDE_GL_SHADER_PROGRAM_INSTANCE_IMPLEMENTATION
#include "opengl/handles/shader_program_handle.ipp"
#undef INCLUDE_GL_SHADER_PROGRAM_INSTANCE_IMPLEMENTATION

View File

@@ -0,0 +1,16 @@
#pragma once
#include "glm/glm.hpp"
namespace zgl
{
struct surface_properties_handle
{
glm::mat3 filters{
0.1986f, 0.0000f, 0.0000f,
0.5922f, 0.0166f, 0.0000f,
0.5974f, 0.2084f, 0.2084f
};
float shininess{ 100.2237f };
};
}

View File

@@ -0,0 +1,17 @@
#pragma once
#include "GL/glew.h"
namespace zgl {
struct texture_handle
{
inline void bind() const;
inline static void unbind();
GLuint texture_id{ 0 };
};
}
#define INCLUDE_TEXTURE_INSTANCE_IMPLEMENTATION
#include "opengl/handles/texture_handle.ipp"
#undef INCLUDE_TEXTURE_INSTANCE_IMPLEMENTATION