From 84fc75cc71f8eb0f9953c69aa27d0e4c995baa73 Mon Sep 17 00:00:00 2001 From: Seb James Date: Tue, 16 Sep 2025 10:36:12 +0100 Subject: [PATCH 1/2] Adds vpos and vnorm accessor scheme --- mplot/VisualModelBase.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/mplot/VisualModelBase.h b/mplot/VisualModelBase.h index 5b4e0ea4..dcb8279f 100644 --- a/mplot/VisualModelBase.h +++ b/mplot/VisualModelBase.h @@ -449,6 +449,25 @@ namespace mplot { } return base64::encode (_bytes); } + std::size_t next_vpos_idx = 0; + void init_vpos_accessor() { this->next_vpos_idx = 0; } + sm::vec get_next_vpos() + { + sm::vec pos; + pos.set_from (std::numeric_limits::max()); + if (this->next_vpos_idx < this->vertexPositions.size()) { + sm::vec tmp = { + this->vertexPositions[this->next_vpos_idx], + this->vertexPositions[this->next_vpos_idx + 1], + this->vertexPositions[this->next_vpos_idx + 2] + }; + + pos = (this->viewmatrix * tmp).less_one_dim(); + this->next_vpos_idx += 3; + } + return pos; + } + std::size_t vcol_size() { return this->vertexColors.size(); } std::string vcol_max() { return this->vcol_maxes.str_mat(); } std::string vcol_min() { return this->vcol_mins.str_mat(); } @@ -485,6 +504,20 @@ namespace mplot { } return base64::encode (_bytes); } + std::size_t next_vnorm_idx = 0; + void init_vnorm_accessor() { this->next_vnorm_idx = 0; } + sm::vec get_next_vnorm() + { + sm::vec pos; + pos.set_from (std::numeric_limits::max()); + if (this->next_vnorm_idx < this->vertexPositions.size()) { + pos = { this->vertexPositions[this->next_vnorm_idx], + this->vertexPositions[this->next_vnorm_idx + 1], + this->vertexPositions[this->next_vnorm_idx + 2] }; + this->next_vnorm_idx += 3; + } + return pos; + } // end Visual::savegltf() methods // A VisualModel may be given a name From bf2c7a4243ef4595cedba6717c0283c6eee5f91f Mon Sep 17 00:00:00 2001 From: Seb James Date: Tue, 16 Sep 2025 10:36:48 +0100 Subject: [PATCH 2/2] Latest maths for accessor scheme --- maths | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maths b/maths index a29798cc..9e5fb13a 160000 --- a/maths +++ b/maths @@ -1 +1 @@ -Subproject commit a29798cc764ea1bdbef4682a3c231ab9a6da03ab +Subproject commit 9e5fb13a633c6039e2088cbe36ddfd27395fe527