16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-23 02:49:19 +02:00

Merge remote-tracking branch 'tmj/master' into sim

This commit is contained in:
milek7
2020-10-19 03:00:24 +02:00
22 changed files with 1046 additions and 548 deletions

View File

@@ -32,9 +32,11 @@ public:
private:
// types:
struct chunk_record{
std::size_t offset{ 0 }; // beginning of the chunk data as offset from the beginning of the last established buffer
std::size_t size{ 0 }; // size of the chunk in the last established buffer
struct chunk_record {
std::size_t vertex_offset{ 0 }; // beginning of the chunk vertex data as offset from the beginning of the last established buffer
std::size_t vertex_count{ 0 }; // size of the chunk in the last established buffer
std::size_t index_offset{ 0 };
std::size_t index_count{ 0 };
bool is_good{ false }; // true if local content of the chunk matches the data on the opengl end
};
@@ -59,14 +61,10 @@ private:
delete_buffer();
// members:
std::optional<gl::buffer> m_buffer; // buffer data on the opengl end
std::optional<gl::buffer> m_vertexbuffer; // vertex buffer data on the opengl end
std::optional<gl::buffer> m_indexbuffer; // index buffer data on the opengl end
std::optional<gl::vao> m_vao;
std::size_t m_buffercapacity{ 0 }; // total capacity of the last established buffer
chunkrecord_sequence m_chunkrecords; // helper data for all stored geometry chunks, in matching order
// vectors for glMultiDrawArrays in class scope
// to don't waste time on reallocating
std::vector<GLint> m_offsets;
std::vector<GLsizei> m_counts;
};
} // namespace gfx