From 6a7bde930d8cde0f9d6f7fcedf504c99d903c9a4 Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Wed, 11 Sep 2024 18:08:35 +0800 Subject: [PATCH] add normals to CustomGeometry interface --- .../native/include/CustomGeometry.hpp | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/thermion_dart/native/include/CustomGeometry.hpp b/thermion_dart/native/include/CustomGeometry.hpp index 4fac5264..93df18dc 100644 --- a/thermion_dart/native/include/CustomGeometry.hpp +++ b/thermion_dart/native/include/CustomGeometry.hpp @@ -19,18 +19,26 @@ namespace thermion_filament // CustomGeometry.h class CustomGeometry { public: - CustomGeometry(float* vertices, uint32_t numVertices, uint16_t* indices, uint32_t numIndices, RenderableManager::PrimitiveType primitiveType, Engine* engine); + CustomGeometry( + float* vertices, + uint32_t numVertices, + float* normals, + uint32_t numNormals, + uint16_t* indices, + uint32_t numIndices, + RenderableManager::PrimitiveType primitiveType, + Engine* engine); ~CustomGeometry(); - void computeBoundingBox(); - VertexBuffer* vertexBuffer(); - IndexBuffer* indexBuffer(); + VertexBuffer* vertexBuffer() const; + IndexBuffer* indexBuffer() const; Box getBoundingBox() const; - float* vertices; - uint32_t numVertices; - uint16_t* indices; - uint32_t numIndices; + float* vertices = nullptr; + float* normals = nullptr; + uint32_t numVertices = 0; + uint16_t* indices = 0; + uint32_t numIndices = 0; Box boundingBox; RenderableManager::PrimitiveType primitiveType; @@ -39,6 +47,8 @@ private: bool _vertexBufferFreed = false; bool _indexBufferFreed = false; + void computeBoundingBox(); + };