fixes
This commit is contained in:
58
include/opengl/data/material_data.hpp
Normal file
58
include/opengl/data/material_data.hpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
|
||||
#include "assets/data/texture.hpp"
|
||||
#include "assets/data/surface_properties.hpp"
|
||||
#include "assets/components/material_components.hpp"
|
||||
|
||||
#include "opengl/handles/material_handle.hpp"
|
||||
#include "opengl/data/texture_data.hpp"
|
||||
|
||||
#include <system_error>
|
||||
|
||||
|
||||
namespace zgl
|
||||
{
|
||||
struct material_data
|
||||
{
|
||||
private:
|
||||
material_data(
|
||||
const std::optional<texture_handle>& texture_handle,
|
||||
const std::optional<surface_properties_handle>& surface_properties_handle,
|
||||
const std::optional<alpha_handle>& alpha_handle,
|
||||
std::optional<texture_data>&& texture_data,
|
||||
components::material::flags components
|
||||
);
|
||||
|
||||
public:
|
||||
material_data() = default;
|
||||
|
||||
[[nodiscard]] static std::error_code build_from(
|
||||
const std::optional<components::material::texture>& texture_opt,
|
||||
const std::optional<components::material::surface_properties>& surface_properties_opt,
|
||||
const std::optional<components::material::transparency>& transparency_opt,
|
||||
material_component::flags components,
|
||||
material_data& data
|
||||
);
|
||||
|
||||
material_data(const material_data& other) = delete;
|
||||
material_data& operator=(const material_data& other) = delete;
|
||||
|
||||
material_data(material_data&& other) noexcept;
|
||||
material_data& operator=(material_data&& other) noexcept;
|
||||
|
||||
[[nodiscard]] material_handle handle() const;
|
||||
|
||||
[[nodiscard]] material_component::flags components() const;
|
||||
|
||||
private:
|
||||
material_handle m_handle{};
|
||||
std::optional<texture_data> m_texture_data{ std::nullopt };
|
||||
material_component::flags m_component_types{
|
||||
material_component::flags::none
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
#define INCLUDE_MATERIAL_DATA_IMPLEMENTATION
|
||||
#include "opengl/data/material_data.ipp"
|
||||
#undef INCLUDE_MATERIAL_DATA_IMPLEMENTATION
|
||||
68
include/opengl/data/mesh_data.hpp
Executable file
68
include/opengl/data/mesh_data.hpp
Executable file
@@ -0,0 +1,68 @@
|
||||
#pragma once
|
||||
|
||||
#include "opengl/handles/mesh_handle.hpp"
|
||||
#include "util/uix.hpp"
|
||||
|
||||
#include <system_error>
|
||||
#include <span>
|
||||
|
||||
#include "assets/components/mesh_vertex_components.hpp"
|
||||
#include "GL/glew.h"
|
||||
|
||||
namespace zgl
|
||||
{
|
||||
struct mesh_data
|
||||
{
|
||||
private:
|
||||
mesh_data(
|
||||
GLuint vertex_vbo_id,
|
||||
GLuint index_vbo_id,
|
||||
GLuint vao_id,
|
||||
ztu::u32 material_id,
|
||||
components::mesh_vertex::flags components,
|
||||
GLsizei index_count
|
||||
);
|
||||
|
||||
public:
|
||||
mesh_data() = default;
|
||||
|
||||
[[nodiscard]] static std::error_code build_from(
|
||||
std::span<const std::uint8_t> vertex_buffer,
|
||||
std::span<const GLenum> component_types,
|
||||
std::span<const GLint> component_lengths,
|
||||
GLsizei stride,
|
||||
std::span<const ztu::u32> index_buffer,
|
||||
ztu::u32 material_id,
|
||||
components::mesh_vertex::flags components,
|
||||
mesh_data& data
|
||||
);
|
||||
|
||||
mesh_data(const mesh_data& other) = delete;
|
||||
mesh_data& operator=(const mesh_data& other) = delete;
|
||||
|
||||
mesh_data(mesh_data&& other) noexcept;
|
||||
mesh_data& operator=(mesh_data&& other) noexcept;
|
||||
|
||||
~mesh_data();
|
||||
|
||||
[[nodiscard]] mesh_handle handle() const;
|
||||
|
||||
[[nodiscard]] components::mesh_vertex::flags components() const;
|
||||
|
||||
[[nodiscard]] ztu::u32 material_id() const;
|
||||
|
||||
|
||||
private:
|
||||
mesh_handle m_handle{};
|
||||
GLuint m_vertex_vbo_id{ 0 };
|
||||
GLuint m_index_vbo_id{ 0 };
|
||||
ztu::u32 m_material_id{ 0 };
|
||||
components::mesh_vertex::flags m_component_types{
|
||||
components::mesh_vertex::flags::none
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
#define INCLUDE_MESH_DATA_IMPLEMENTATION
|
||||
#include "opengl/data/mesh_data.ipp"
|
||||
#undef INCLUDE_MESH_DATA_IMPLEMENTATION
|
||||
55
include/opengl/data/point_cloud_data.hpp
Normal file
55
include/opengl/data/point_cloud_data.hpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include "util/uix.hpp"
|
||||
|
||||
#include <span>
|
||||
#include <system_error>
|
||||
#include "GL/glew.h"
|
||||
#include "opengl/handles/point_cloud_handle.hpp"
|
||||
#include "assets/components/point_cloud_vertex_components.hpp"
|
||||
|
||||
|
||||
namespace zgl {
|
||||
struct point_cloud_data {
|
||||
private:
|
||||
point_cloud_data(
|
||||
GLuint vertex_buffer_id,
|
||||
GLuint vao_id,
|
||||
GLsizei point_count
|
||||
);
|
||||
|
||||
public:
|
||||
point_cloud_data() = default;
|
||||
|
||||
[[nodiscard]] static std::error_code build_from(
|
||||
std::span<const std::uint8_t> point_buffer,
|
||||
std::span<const GLenum> component_types,
|
||||
std::span<const GLint> component_lengths,
|
||||
GLsizei stride,
|
||||
point_cloud_data& data
|
||||
);
|
||||
|
||||
point_cloud_data(const point_cloud_data& other) = delete;
|
||||
point_cloud_data& operator=(const point_cloud_data& other) = delete;
|
||||
|
||||
point_cloud_data(point_cloud_data&& other) noexcept;
|
||||
point_cloud_data& operator=(point_cloud_data&& other) noexcept;
|
||||
|
||||
~point_cloud_data();
|
||||
|
||||
[[nodiscard]] point_cloud_handle handle() const;
|
||||
|
||||
[[nodiscard]] components::point_cloud_vertex::flags components() const;
|
||||
|
||||
private:
|
||||
point_cloud_handle m_handle{};
|
||||
GLuint m_vertex_vbo_id{ 0 };
|
||||
components::point_cloud_vertex::flags m_component_types{
|
||||
components::point_cloud_vertex::flags::none
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
#define INCLUDE_POINT_CLOUD_DATA_IMPLEMENTATION
|
||||
#include "opengl/data/point_cloud_data.ipp"
|
||||
#undef INCLUDE_POINT_CLOUD_DATA_IMPLEMENTATION
|
||||
43
include/opengl/data/shader_data.hpp
Normal file
43
include/opengl/data/shader_data.hpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
#include "GL/glew.h"
|
||||
#include "opengl/handles/shader_handle.hpp"
|
||||
|
||||
namespace zgl
|
||||
{
|
||||
class shader_data
|
||||
{
|
||||
private:
|
||||
explicit shader_data(GLuint shader_id, GLenum type);
|
||||
|
||||
public:
|
||||
|
||||
shader_data() = default;
|
||||
|
||||
[[nodiscard]] static std::error_code build_from(
|
||||
GLenum type,
|
||||
const std::string& source,
|
||||
shader_data& data
|
||||
);
|
||||
|
||||
shader_data(const shader_data& other) = delete;
|
||||
shader_data& operator=(const shader_data& other) = delete;
|
||||
|
||||
shader_data(shader_data&& other) noexcept;
|
||||
shader_data& operator=(shader_data&& other) noexcept;
|
||||
|
||||
[[nodiscard]] shader_handle handle() const;
|
||||
|
||||
~shader_data();
|
||||
|
||||
private:
|
||||
shader_handle m_handle{};
|
||||
GLenum m_type{ GL_INVALID_ENUM };
|
||||
};
|
||||
}
|
||||
|
||||
#define INCLUDE_SHADER_DATA_IMPLEMENTATION
|
||||
#include "opengl/data/shader_data.ipp"
|
||||
#undef INCLUDE_SHADER_DATA_IMPLEMENTATION
|
||||
45
include/opengl/data/texture_data.hpp
Normal file
45
include/opengl/data/texture_data.hpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#include "GL/glew.h"
|
||||
#include "opengl/handles/texture_handle.hpp"
|
||||
|
||||
#include <span>
|
||||
|
||||
namespace zgl
|
||||
{
|
||||
struct texture_data
|
||||
{
|
||||
private:
|
||||
explicit texture_data(GLuint texture_id);
|
||||
|
||||
public:
|
||||
texture_data() = default;
|
||||
|
||||
template<typename T>
|
||||
[[nodiscard]] static std::error_code build_from(
|
||||
std::span<const T> buffer,
|
||||
GLenum format,
|
||||
GLenum type,
|
||||
GLsizei width,
|
||||
GLsizei height,
|
||||
texture_data& data
|
||||
);
|
||||
|
||||
texture_data(const texture_data&) = delete;
|
||||
texture_data& operator=(const texture_data&) = delete;
|
||||
|
||||
texture_data(texture_data&&) noexcept;
|
||||
texture_data& operator=(texture_data&&) noexcept;
|
||||
|
||||
~texture_data();
|
||||
|
||||
[[nodiscard]] texture_handle handle() const;
|
||||
|
||||
private:
|
||||
texture_handle m_handle{};
|
||||
};
|
||||
}
|
||||
|
||||
#define INCLUDE_TEXTURE_DATA_IMPLEMENTATION
|
||||
#include "opengl/data/texture_data.ipp"
|
||||
#undef INCLUDE_TEXTURE_DATA_IMPLEMENTATION
|
||||
Reference in New Issue
Block a user