diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-02-19 22:14:12 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-11-18 15:22:10 +0100 |
commit | 8d9b24b1b84107c90a77d94c86a810cc068fe073 (patch) | |
tree | 5f06bd2f1690080b9f18727ec832bcb65770b4ff /include/RenderBackend/OpenGL/DeviceMemory.hpp | |
parent | 92a30e08849f45fa6f5efb1dd8897a4a69c063a6 (diff) |
Fix rendering of texture with multiple frames
Diffstat (limited to 'include/RenderBackend/OpenGL/DeviceMemory.hpp')
-rw-r--r-- | include/RenderBackend/OpenGL/DeviceMemory.hpp | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/include/RenderBackend/OpenGL/DeviceMemory.hpp b/include/RenderBackend/OpenGL/DeviceMemory.hpp index 5f593fc..802230d 100644 --- a/include/RenderBackend/OpenGL/DeviceMemory.hpp +++ b/include/RenderBackend/OpenGL/DeviceMemory.hpp @@ -5,6 +5,8 @@ #include "../../Triangle.hpp" #include "../../Vec.hpp" +#include <memory> + namespace amalgine { enum class DeviceMemoryType { NONE, @@ -12,11 +14,10 @@ namespace amalgine { VEC3 }; - class DeviceMemory - { + class DeviceMemory { DISABLE_COPY(DeviceMemory) - friend class DeviceFrame; - friend class ShaderProgram; + friend class ShaderFrame; + friend class std::default_delete<DeviceMemory>; public: enum class StorageType { @@ -30,26 +31,20 @@ namespace amalgine { STREAM }; - enum class PrimitiveType - { - TRIANGLE - }; - - //void copy(const DataView<f32> &data, StorageType storageType, PrimitiveType primitiveType = PrimitiveType::TRIANGLE); - void copy(const DataView<vec2f> &texture_coords, StorageType storageType); - void copy(const DataView<Triangle2D> &triangles, StorageType storageType); - void copy(const DataView<Triangle3D> &triangles, StorageType storageType); - void draw(); + void set(const DataView<vec2f> &texture_coords, StorageType storageType); + void set(const DataView<Triangle2D> &triangles, StorageType storageType); + void set(const DataView<Triangle3D> &triangles, StorageType storageType); - DeviceMemoryType get_type() const { return type; } + i32 get_num_vertices() const { return num_vertices; } private: - DeviceMemory(); + DeviceMemory(u32 vertex_array_object_id, i32 attrib_location); ~DeviceMemory(); - void use() const; + void use(); private: - u32 vertexBufferObjectId; - u32 primitiveType; - u32 numVertices; - DeviceMemoryType type; + u32 vertex_array_object_id; + u32 vertex_buffer_object_id; + i32 attrib_location; + i32 num_vertices; + DeviceMemoryType memory_type; }; } |