fixes
This commit is contained in:
48
include/assets/dynamic_read_buffers/dynamic_material_buffer.hpp
Executable file
48
include/assets/dynamic_read_buffers/dynamic_material_buffer.hpp
Executable file
@@ -0,0 +1,48 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "assets/components/material_components.hpp"
|
||||
#include "assets/dynamic_data_stores/dynamic_texture_store.hpp"
|
||||
|
||||
struct dynamic_material_buffer {
|
||||
|
||||
dynamic_material_buffer() = default;
|
||||
|
||||
components::material::surface_properties& initialized_surface_properties();
|
||||
|
||||
[[nodiscard]] std::optional<components::material::surface_properties>& surface_properties();
|
||||
[[nodiscard]] std::optional<components::material::transparency>& transparency();
|
||||
[[nodiscard]] std::optional<dynamic_texture_store::id_type>& ambient_color_texture_id();
|
||||
[[nodiscard]] std::optional<dynamic_texture_store::id_type>& diffuse_color_texture_id();
|
||||
[[nodiscard]] std::optional<dynamic_texture_store::id_type>& specular_color_texture_id();
|
||||
[[nodiscard]] std::optional<dynamic_texture_store::id_type>& shininess_texture_id();
|
||||
[[nodiscard]] std::optional<dynamic_texture_store::id_type>& alpha_texture_id();
|
||||
[[nodiscard]] std::optional<dynamic_texture_store::id_type>& bump_texture_id();
|
||||
|
||||
[[nodiscard]] const std::optional<components::material::surface_properties>& surface_properties() const;
|
||||
[[nodiscard]] const std::optional<components::material::transparency>& transparency() const;
|
||||
[[nodiscard]] const std::optional<dynamic_texture_store::id_type>& ambient_color_texture_id() const;
|
||||
[[nodiscard]] const std::optional<dynamic_texture_store::id_type>& diffuse_color_texture_id() const;
|
||||
[[nodiscard]] const std::optional<dynamic_texture_store::id_type>& specular_color_texture_id() const;
|
||||
[[nodiscard]] const std::optional<dynamic_texture_store::id_type>& shininess_texture_id() const;
|
||||
[[nodiscard]] const std::optional<dynamic_texture_store::id_type>& alpha_texture_id() const;
|
||||
[[nodiscard]] const std::optional<dynamic_texture_store::id_type>& bump_texture_id() const;
|
||||
|
||||
std::tuple<
|
||||
std::optional<components::material::surface_properties>,
|
||||
std::optional<components::material::transparency>,
|
||||
std::optional<dynamic_texture_store::id_type>,
|
||||
std::optional<dynamic_texture_store::id_type>,
|
||||
std::optional<dynamic_texture_store::id_type>,
|
||||
std::optional<dynamic_texture_store::id_type>,
|
||||
std::optional<dynamic_texture_store::id_type>,
|
||||
std::optional<dynamic_texture_store::id_type>
|
||||
> data{
|
||||
std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt
|
||||
};
|
||||
};
|
||||
|
||||
#define INCLUDE_DYNAMIC_MATERIAL_DATA_IMPLEMENTATION
|
||||
#include "assets/dynamic_read_buffers/dynamic_material_buffer.ipp"
|
||||
#undef INCLUDE_DYNAMIC_MATERIAL_DATA_IMPLEMENTATION
|
||||
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "util/string_lookup.hpp"
|
||||
#include "assets/dynamic_data_stores/dynamic_material_store.hpp"
|
||||
|
||||
using dynamic_material_library_buffer = ztu::string_lookup<dynamic_material_store::id_type>;
|
||||
46
include/assets/dynamic_read_buffers/dynamic_mesh_buffer.hpp
Normal file
46
include/assets/dynamic_read_buffers/dynamic_mesh_buffer.hpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
#include "util/uix.hpp"
|
||||
#include "assets/components/mesh_vertex_components.hpp"
|
||||
#include "assets/dynamic_read_buffers/dynamic_vertex_buffer.hpp"
|
||||
#include "assets/dynamic_data_stores/dynamic_material_store.hpp"
|
||||
|
||||
class dynamic_mesh_buffer : public dynamic_vertex_buffer<
|
||||
components::mesh_vertex::flags,
|
||||
components::mesh_vertex::position,
|
||||
components::mesh_vertex::normal,
|
||||
components::mesh_vertex::tex_coord,
|
||||
components::mesh_vertex::color,
|
||||
components::mesh_vertex::reflectance
|
||||
> {
|
||||
public:
|
||||
using index_type = ztu::u32;
|
||||
using triangle_type = std::array<index_type, 3>;
|
||||
|
||||
[[nodiscard]] std::vector<components::mesh_vertex::position>& positions();
|
||||
[[nodiscard]] std::vector<components::mesh_vertex::normal>& normals();
|
||||
[[nodiscard]] std::vector<components::mesh_vertex::tex_coord>& tex_coords();
|
||||
[[nodiscard]] std::vector<components::mesh_vertex::color>& colors();
|
||||
[[nodiscard]] std::vector<components::mesh_vertex::reflectance>& reflectances();
|
||||
[[nodiscard]] std::vector<triangle_type>& triangles();
|
||||
[[nodiscard]] auto& material_id();
|
||||
|
||||
[[nodiscard]] const std::vector<components::mesh_vertex::position>& positions() const;
|
||||
[[nodiscard]] const std::vector<components::mesh_vertex::normal>& normals() const;
|
||||
[[nodiscard]] const std::vector<components::mesh_vertex::tex_coord>& tex_coords() const;
|
||||
[[nodiscard]] const std::vector<components::mesh_vertex::color>& colors() const;
|
||||
[[nodiscard]] const std::vector<components::mesh_vertex::reflectance>& reflectances() const;
|
||||
[[nodiscard]] const std::vector<triangle_type>& triangles() const;
|
||||
[[nodiscard]] const auto& material_id() const;
|
||||
|
||||
private:
|
||||
std::vector<triangle_type> m_triangles{};
|
||||
dynamic_material_store::id_type m_material_id{};
|
||||
};
|
||||
|
||||
#define INCLUDE_DYNAMIC_MESH_DATA_IMPLEMENTATION
|
||||
#include "assets/dynamic_read_buffers/dynamic_mesh_buffer.ipp"
|
||||
#undef INCLUDE_DYNAMIC_MESH_DATA_IMPLEMENTATION
|
||||
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include "assets/components/point_cloud_vertex_components.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include "assets/dynamic_read_buffers/dynamic_vertex_buffer.hpp"
|
||||
|
||||
class dynamic_point_cloud_buffer : public dynamic_vertex_buffer<
|
||||
components::point_cloud_vertex::flags,
|
||||
components::point_cloud_vertex::position,
|
||||
components::point_cloud_vertex::normal,
|
||||
components::point_cloud_vertex::color,
|
||||
components::point_cloud_vertex::reflectance
|
||||
> {
|
||||
public:
|
||||
[[nodiscard]] std::vector<components::point_cloud_vertex::position>& positions();
|
||||
[[nodiscard]] std::vector<components::point_cloud_vertex::normal>& normals();
|
||||
[[nodiscard]] std::vector<components::point_cloud_vertex::color>& colors();
|
||||
[[nodiscard]] std::vector<components::point_cloud_vertex::reflectance>& reflectances();
|
||||
|
||||
[[nodiscard]] const std::vector<components::point_cloud_vertex::position>& positions() const;
|
||||
[[nodiscard]] const std::vector<components::point_cloud_vertex::normal>& normals() const;
|
||||
[[nodiscard]] const std::vector<components::point_cloud_vertex::color>& colors() const;
|
||||
[[nodiscard]] const std::vector<components::point_cloud_vertex::reflectance>& reflectances() const;
|
||||
};
|
||||
|
||||
#define INCLUDE_DYNAMIC_TEXTURE_DATA_IMPLEMENTATION
|
||||
#include "assets/dynamic_read_buffers/dynamic_point_cloud_buffer.ipp"
|
||||
#undef INCLUDE_DYNAMIC_TEXTURE_DATA_IMPLEMENTATION
|
||||
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "glm/mat4x4.hpp"
|
||||
|
||||
using dynamic_pose_buffer = glm::mat4;
|
||||
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "GL/glew.h"
|
||||
|
||||
struct dynamic_shader_buffer
|
||||
{
|
||||
std::vector<char> source{};
|
||||
GLenum type{ GL_INVALID_ENUM };
|
||||
};
|
||||
77
include/assets/dynamic_read_buffers/dynamic_texture_buffer.hpp
Executable file
77
include/assets/dynamic_read_buffers/dynamic_texture_buffer.hpp
Executable file
@@ -0,0 +1,77 @@
|
||||
#pragma once
|
||||
|
||||
#include <cinttypes>
|
||||
#include <bit>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
#include "assets/components/texture_components.hpp"
|
||||
|
||||
class dynamic_texture_buffer {
|
||||
public:
|
||||
using value_type = std::uint8_t;
|
||||
using dim_type = std::int32_t;
|
||||
using size_type = std::make_signed_t<std::size_t>;
|
||||
using difference_type = size_type;
|
||||
using reference = value_type&;
|
||||
using const_reference = const value_type&;
|
||||
using pointer = std::uint8_t*;
|
||||
using const_pointer = const std::uint8_t*;
|
||||
using iterator = pointer;
|
||||
using const_iterator = const_pointer;
|
||||
|
||||
dynamic_texture_buffer() = default;
|
||||
|
||||
dynamic_texture_buffer(
|
||||
std::unique_ptr<value_type>&& data,
|
||||
dim_type width,
|
||||
dim_type height,
|
||||
components::texture::flags components
|
||||
);
|
||||
|
||||
dynamic_texture_buffer(const dynamic_texture_buffer&);
|
||||
|
||||
dynamic_texture_buffer(dynamic_texture_buffer&&) noexcept;
|
||||
|
||||
[[nodiscard]] dynamic_texture_buffer& operator=(const dynamic_texture_buffer&);
|
||||
|
||||
[[nodiscard]] dynamic_texture_buffer& operator=(dynamic_texture_buffer&&) noexcept;
|
||||
|
||||
[[nodiscard]] components::texture::flags components() const;
|
||||
|
||||
[[nodiscard]] dim_type width() const;
|
||||
|
||||
[[nodiscard]] dim_type height() const;
|
||||
|
||||
[[nodiscard]] std::pair<dim_type, dim_type> dimensions() const;
|
||||
|
||||
[[nodiscard]] size_type pixel_count() const;
|
||||
|
||||
[[nodiscard]] size_type component_count() const;
|
||||
|
||||
[[nodiscard]] size_type size() const;
|
||||
|
||||
[[nodiscard]] const_iterator begin() const;
|
||||
|
||||
[[nodiscard]] iterator begin();
|
||||
|
||||
[[nodiscard]] const_iterator end() const;
|
||||
|
||||
[[nodiscard]] iterator end();
|
||||
|
||||
[[nodiscard]] const_iterator cbegin() const;
|
||||
|
||||
[[nodiscard]] const_iterator cend() const;
|
||||
|
||||
[[nodiscard]] const_pointer data() const;
|
||||
|
||||
[[nodiscard]] pointer data();
|
||||
|
||||
private:
|
||||
std::unique_ptr<value_type[]> m_data{ nullptr };
|
||||
dim_type m_width{ 0 }, m_height{ 0 };
|
||||
components::texture::flags m_components{ components::texture::flags::none };
|
||||
};
|
||||
|
||||
#define INCLUDE_DYNAMIC_TEXTURE_DATA_IMPLEMENTATION
|
||||
#include "assets/dynamic_read_buffers/dynamic_texture_buffer.ipp"
|
||||
#undef INCLUDE_DYNAMIC_TEXTURE_DATA_IMPLEMENTATION
|
||||
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "util/uix.hpp"
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include "GL/glew.h"
|
||||
|
||||
template<typename C, typename... Ts>
|
||||
struct dynamic_vertex_buffer {
|
||||
std::tuple<std::vector<Ts>...> vertices{};
|
||||
};
|
||||
|
||||
#define INCLUDE_DYNAMIC_MODEL_DATA_IMPLEMENTATION
|
||||
#include "assets/dynamic_read_buffers/dynamic_texture_buffer.ipp"
|
||||
#undef INCLUDE_DYNAMIC_MODEL_DATA_IMPLEMENTATION
|
||||
Reference in New Issue
Block a user