From bc0711a5c3c2c9a627834136e10b13a8564c5a00 Mon Sep 17 00:00:00 2001 From: osa Date: Thu, 25 Feb 2021 19:18:12 +0300 Subject: [PATCH] 0032171: Data Exchange - RWGltf_TriangulationReader doesn't copy cached bounding box Save cached bounding box in loaded triangulation getting it from "proxy" late-loaded object. --- src/RWGltf/RWGltf_TriangulationReader.cxx | 19 +++++++++++++++++++ src/RWGltf/RWGltf_TriangulationReader.hxx | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/src/RWGltf/RWGltf_TriangulationReader.cxx b/src/RWGltf/RWGltf_TriangulationReader.cxx index de4db86d8a..25c75340e3 100644 --- a/src/RWGltf/RWGltf_TriangulationReader.cxx +++ b/src/RWGltf/RWGltf_TriangulationReader.cxx @@ -14,6 +14,7 @@ #include +#include #include #include @@ -85,6 +86,24 @@ Handle(Poly_Triangulation) RWGltf_TriangulationReader::result() return myTriangulation; } +// ======================================================================= +// function : load +// purpose : +// ======================================================================= +bool RWGltf_TriangulationReader::load (const Handle(RWGltf_GltfLatePrimitiveArray)& theMesh, + const Handle(OSD_FileSystem)& theFileSystem) +{ + if (!RWGltf_PrimitiveArrayReader::load (theMesh, theFileSystem)) + { + return false; + } + if (!theMesh->CachedMinMax().IsVoid()) + { + myTriangulation->SetCachedMinMax (theMesh->CachedMinMax()); + } + return true; +} + // ======================================================================= // function : readBuffer // purpose : diff --git a/src/RWGltf/RWGltf_TriangulationReader.hxx b/src/RWGltf/RWGltf_TriangulationReader.hxx index a1680c0129..3237710ace 100644 --- a/src/RWGltf/RWGltf_TriangulationReader.hxx +++ b/src/RWGltf/RWGltf_TriangulationReader.hxx @@ -34,6 +34,10 @@ public: protected: + //! Load primitive array. + Standard_EXPORT virtual bool load (const Handle(RWGltf_GltfLatePrimitiveArray)& theMesh, + const Handle(OSD_FileSystem)& theFileSystem) Standard_OVERRIDE; + //! Create Poly_Triangulation from collected data Standard_EXPORT virtual Handle(Poly_Triangulation) result() Standard_OVERRIDE;