Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes
RWGltf_GltfLatePrimitiveArray Class Reference

Mesh data wrapper for delayed primitive array loading from glTF file. More...

#include <RWGltf_GltfLatePrimitiveArray.hxx>

Inheritance diagram for RWGltf_GltfLatePrimitiveArray:
Inheritance graph
[legend]

Public Member Functions

 RWGltf_GltfLatePrimitiveArray (const TCollection_AsciiString &theId, const TCollection_AsciiString &theName)
 Constructor.
 
 ~RWGltf_GltfLatePrimitiveArray () override
 Destructor.
 
const TCollection_AsciiStringId () const
 Entity id.
 
const TCollection_AsciiStringName () const
 Entity name.
 
void SetName (const TCollection_AsciiString &theName)
 Assign entity name.
 
RWGltf_GltfPrimitiveMode PrimitiveMode () const
 Return type of primitive array.
 
void SetPrimitiveMode (RWGltf_GltfPrimitiveMode theMode)
 Set type of primitive array.
 
bool HasStyle () const
 Return true if primitive array has assigned material.
 
Quantity_ColorRGBA BaseColor () const
 Return base color.
 
const occ::handle< RWGltf_MaterialMetallicRoughness > & MaterialPbr () const
 Return PBR material definition.
 
void SetMaterialPbr (const occ::handle< RWGltf_MaterialMetallicRoughness > &theMat)
 Set PBR material definition.
 
const occ::handle< RWGltf_MaterialCommon > & MaterialCommon () const
 Return common (obsolete) material definition.
 
void SetMaterialCommon (const occ::handle< RWGltf_MaterialCommon > &theMat)
 Set common (obsolete) material definition.
 
const NCollection_Sequence< RWGltf_GltfPrimArrayData > & Data () const
 Return primitive array data elements.
 
RWGltf_GltfPrimArrayDataAddPrimArrayData (RWGltf_GltfArrayType theType)
 Add primitive array data element.
 
bool HasDeferredData () const override
 Return TRUE if there is deferred storage and some triangulation data that can be loaded using LoadDeferredData().
 
occ::handle< Poly_TriangulationLoadStreamData () const
 Load primitive array saved as stream buffer to new triangulation object.
 
- Public Member Functions inherited from RWMesh_TriangulationSource
 RWMesh_TriangulationSource ()
 Constructor.
 
 ~RWMesh_TriangulationSource () override
 Destructor.
 
const occ::handle< RWMesh_TriangulationReader > & Reader () const
 Returns reader allowing to read data from the buffer.
 
void SetReader (const occ::handle< RWMesh_TriangulationReader > &theReader)
 Sets reader allowing to read data from the buffer.
 
int DegeneratedTriNb () const
 Returns number of degenerated triangles collected during data reading. Used for debug statistic purpose.
 
intChangeDegeneratedTriNb ()
 Gets access to number of degenerated triangles to collect them during data reading.
 
bool HasGeometry () const override
 Returns TRUE if triangulation has some geometry.
 
int NbEdges () const
 Returns the number of edges for this triangulation.
 
int Edge (int theIndex) const
 Returns edge at the given index.
 
void SetEdge (int theIndex, int theEdge)
 Sets an edge.
 
int NbDeferredNodes () const override
 Sets number of nodes for deferred loading.
 
void SetNbDeferredNodes (const int theNbNodes)
 Sets number of nodes for deferred loading.
 
int NbDeferredTriangles () const override
 Returns number of triangles for deferred loading. Note: this is estimated values defined in object header, which might be different from actually loaded values (due to broken header or extra mesh processing). Always check triangulation size of actually loaded data in code to avoid out-of-range issues.
 
void SetNbDeferredTriangles (const int theNbTris)
 Sets number of triangles for deferred loading.
 
NCollection_Array1< int > & InternalEdges ()
 Returns an internal array of edges. Edge()/SetEdge() should be used instead in portable code.
 
void ResizeEdges (int theNbEdges, bool theToCopyOld)
 Method resizing an internal array of triangles.
 
- Public Member Functions inherited from Poly_Triangulation
 Poly_Triangulation ()
 Constructs an empty triangulation.
 
 Poly_Triangulation (const int theNbNodes, const int theNbTriangles, const bool theHasUVNodes, const bool theHasNormals=false)
 Constructs a triangulation from a set of triangles. The triangulation is initialized without a triangle or a node, but capable of containing specified number of nodes and triangles.
 
 Poly_Triangulation (const NCollection_Array1< gp_Pnt > &Nodes, const NCollection_Array1< Poly_Triangle > &Triangles)
 Constructs a triangulation from a set of triangles. The triangulation is initialized with 3D points from Nodes and triangles from Triangles.
 
 Poly_Triangulation (const NCollection_Array1< gp_Pnt > &Nodes, const NCollection_Array1< gp_Pnt2d > &UVNodes, const NCollection_Array1< Poly_Triangle > &Triangles)
 Constructs a triangulation from a set of triangles. The triangulation is initialized with 3D points from Nodes, 2D points from UVNodes and triangles from Triangles, where coordinates of a 2D point from UVNodes are the (u, v) parameters of the corresponding 3D point from Nodes on the surface approximated by the constructed triangulation.
 
 ~Poly_Triangulation () override
 Destructor.
 
virtual occ::handle< Poly_TriangulationCopy () const
 Creates full copy of current triangulation.
 
 Poly_Triangulation (const occ::handle< Poly_Triangulation > &theTriangulation)
 Copy constructor for triangulation.
 
double Deflection () const
 Returns the deflection of this triangulation.
 
void Deflection (const double theDeflection)
 Sets the deflection of this triangulation to theDeflection. See more on deflection in Polygon2D.
 
const occ::handle< Poly_TriangulationParameters > & Parameters () const
 Returns initial set of parameters used to generate this triangulation.
 
void Parameters (const occ::handle< Poly_TriangulationParameters > &theParams)
 Updates initial set of parameters used to generate this triangulation.
 
virtual void Clear ()
 Clears internal arrays of nodes and all attributes.
 
int NbNodes () const
 Returns the number of nodes for this triangulation.
 
int NbTriangles () const
 Returns the number of triangles for this triangulation.
 
bool HasUVNodes () const
 Returns true if 2D nodes are associated with 3D nodes for this triangulation.
 
bool HasNormals () const
 Returns true if nodal normals are defined.
 
gp_Pnt Node (int theIndex) const
 Returns a node at the given index.
 
void SetNode (int theIndex, const gp_Pnt &thePnt)
 Sets a node coordinates.
 
gp_Pnt2d UVNode (int theIndex) const
 Returns UV-node at the given index.
 
void SetUVNode (int theIndex, const gp_Pnt2d &thePnt)
 Sets an UV-node coordinates.
 
const Poly_TriangleTriangle (int theIndex) const
 Returns triangle at the given index.
 
void SetTriangle (int theIndex, const Poly_Triangle &theTriangle)
 Sets a triangle.
 
gp_Dir Normal (int theIndex) const
 Returns normal at the given index.
 
void Normal (int theIndex, NCollection_Vec3< float > &theVec3) const
 Returns normal at the given index.
 
void SetNormal (const int theIndex, const NCollection_Vec3< float > &theNormal)
 Changes normal at the given index.
 
void SetNormal (const int theIndex, const gp_Dir &theNormal)
 Changes normal at the given index.
 
Poly_MeshPurpose MeshPurpose () const
 Returns mesh purpose bits.
 
void SetMeshPurpose (const Poly_MeshPurpose thePurpose)
 Sets mesh purpose bits.
 
const Bnd_BoxCachedMinMax () const
 Returns cached min - max range of triangulation data, which is VOID by default (e.g, no cached information).
 
void SetCachedMinMax (const Bnd_Box &theBox)
 Sets a cached min - max range of this triangulation. The bounding box should exactly match actual range of triangulation data without a gap or transformation, or otherwise undefined behavior will be observed. Passing a VOID range invalidates the cache.
 
bool HasCachedMinMax () const
 Returns TRUE if there is some cached min - max range of this triangulation.
 
void UpdateCachedMinMax ()
 Updates cached min - max range of this triangulation with bounding box of nodal data.
 
bool MinMax (Bnd_Box &theBox, const gp_Trsf &theTrsf, const bool theIsAccurate=false) const
 Extends the passed box with bounding box of this triangulation. Uses cached min - max range when available and:
 
virtual void DumpJson (Standard_OStream &theOStream, int theDepth=-1) const
 Dumps the content of me into the stream.
 
bool IsDoublePrecision () const
 Returns TRUE if node positions are defined with double precision; TRUE by default.
 
void SetDoublePrecision (bool theIsDouble)
 Set if node positions should be defined with double or single precision for 3D and UV nodes. Raises exception if data was already allocated.
 
void ResizeNodes (int theNbNodes, bool theToCopyOld)
 Method resizing internal arrays of nodes (synchronously for all attributes).
 
void ResizeTriangles (int theNbTriangles, bool theToCopyOld)
 Method resizing an internal array of triangles.
 
void AddUVNodes ()
 If an array for UV coordinates is not allocated yet, do it now.
 
void RemoveUVNodes ()
 Deallocates the UV nodes array.
 
void AddNormals ()
 If an array for normals is not allocated yet, do it now.
 
void RemoveNormals ()
 Deallocates the normals array.
 
void ComputeNormals ()
 Compute smooth normals by averaging triangle normals.
 
occ::handle< NCollection_HArray1< gp_Pnt > > MapNodeArray () const
 Returns the table of 3D points for read-only access or NULL if nodes array is undefined. Poly_Triangulation::Node() should be used instead when possible. Returned object should not be used after Poly_Triangulation destruction.
 
occ::handle< NCollection_HArray1< Poly_Triangle > > MapTriangleArray () const
 Returns the triangle array for read-only access or NULL if triangle array is undefined. Poly_Triangulation::Triangle() should be used instead when possible. Returned object should not be used after Poly_Triangulation destruction.
 
occ::handle< NCollection_HArray1< gp_Pnt2d > > MapUVNodeArray () const
 Returns the table of 2D nodes for read-only access or NULL if UV nodes array is undefined. Poly_Triangulation::UVNode() should be used instead when possible. Returned object should not be used after Poly_Triangulation destruction.
 
occ::handle< NCollection_HArray1< float > > MapNormalArray () const
 Returns the table of per-vertex normals for read-only access or NULL if normals array is undefined. Poly_Triangulation::Normal() should be used instead when possible. Returned object should not be used after Poly_Triangulation destruction.
 
NCollection_Array1< Poly_Triangle > & InternalTriangles ()
 Returns an internal array of triangles. Triangle()/SetTriangle() should be used instead in portable code.
 
Poly_ArrayOfNodesInternalNodes ()
 Returns an internal array of nodes. Node()/SetNode() should be used instead in portable code.
 
Poly_ArrayOfUVNodesInternalUVNodes ()
 Returns an internal array of UV nodes. UBNode()/SetUVNode() should be used instead in portable code.
 
NCollection_Array1< NCollection_Vec3< float > > & InternalNormals ()
 Return an internal array of normals. Normal()/SetNormal() should be used instead in portable code.
 
void SetNormals (const occ::handle< NCollection_HArray1< float > > &theNormals)
 
const NCollection_Array1< Poly_Triangle > & Triangles () const
 
NCollection_Array1< Poly_Triangle > & ChangeTriangles ()
 
Poly_TriangleChangeTriangle (const int theIndex)
 
virtual bool LoadDeferredData (const occ::handle< OSD_FileSystem > &theFileSystem=occ::handle< OSD_FileSystem >())
 Loads triangulation data into itself from some deferred storage using specified shared input file system.
 
virtual occ::handle< Poly_TriangulationDetachedLoadDeferredData (const occ::handle< OSD_FileSystem > &theFileSystem=occ::handle< OSD_FileSystem >()) const
 Loads triangulation data into new Poly_Triangulation object from some deferred storage using specified shared input file system.
 
virtual bool UnloadDeferredData ()
 Releases triangulation data if it has connected deferred storage.
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor.
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing.
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter.
 
virtual ~Standard_Transient ()=default
 Destructor must be virtual.
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object.
 
bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type.
 
bool IsInstance (const char *const theTypeName) const
 Returns a true value if this is an instance of TypeName.
 
bool IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
bool IsKind (const char *const theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
 
int GetRefCount () const noexcept
 Get the reference counter of this object.
 
void IncrementRefCounter () noexcept
 Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
 
int DecrementRefCounter () noexcept
 Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
 
virtual void Delete () const
 Memory deallocator for transient classes.
 

Protected Attributes

NCollection_Sequence< RWGltf_GltfPrimArrayDatamyData
 
occ::handle< RWGltf_MaterialMetallicRoughnessmyMaterialPbr
 PBR material.
 
occ::handle< RWGltf_MaterialCommonmyMaterialCommon
 common (obsolete) material
 
TCollection_AsciiString myId
 entity id
 
TCollection_AsciiString myName
 entity name
 
RWGltf_GltfPrimitiveMode myPrimMode
 type of primitive array
 
- Protected Attributes inherited from RWMesh_TriangulationSource
occ::handle< RWMesh_TriangulationReadermyReader
 Sets number of nodes for deferred loading.
 
NCollection_Array1< intmyEdges
 Sets number of nodes for deferred loading.
 
int myNbDefNodes
 Sets number of nodes for deferred loading.
 
int myNbDefTriangles
 Sets number of nodes for deferred loading.
 
int myStatisticOfDegeneratedTriNb
 Sets number of nodes for deferred loading.
 
- Protected Attributes inherited from Poly_Triangulation
std::atomic< Bnd_Box * > myCachedMinMax {nullptr}
 Returns number of deferred triangles that can be loaded using LoadDeferredData(). Note: this is estimated values, which might be different from actually loaded values Always check triangulation size of actually loaded data in code to avoid out-of-range issues.
 
std::shared_mutex myCachedMinMaxMutex
 Returns number of deferred triangles that can be loaded using LoadDeferredData(). Note: this is estimated values, which might be different from actually loaded values Always check triangulation size of actually loaded data in code to avoid out-of-range issues.
 
double myDeflection
 Returns number of deferred triangles that can be loaded using LoadDeferredData(). Note: this is estimated values, which might be different from actually loaded values Always check triangulation size of actually loaded data in code to avoid out-of-range issues.
 
Poly_ArrayOfNodes myNodes
 Returns number of deferred triangles that can be loaded using LoadDeferredData(). Note: this is estimated values, which might be different from actually loaded values Always check triangulation size of actually loaded data in code to avoid out-of-range issues.
 
NCollection_Array1< Poly_TrianglemyTriangles
 Returns number of deferred triangles that can be loaded using LoadDeferredData(). Note: this is estimated values, which might be different from actually loaded values Always check triangulation size of actually loaded data in code to avoid out-of-range issues.
 
Poly_ArrayOfUVNodes myUVNodes
 Returns number of deferred triangles that can be loaded using LoadDeferredData(). Note: this is estimated values, which might be different from actually loaded values Always check triangulation size of actually loaded data in code to avoid out-of-range issues.
 
NCollection_Array1< NCollection_Vec3< float > > myNormals
 Returns number of deferred triangles that can be loaded using LoadDeferredData(). Note: this is estimated values, which might be different from actually loaded values Always check triangulation size of actually loaded data in code to avoid out-of-range issues.
 
Poly_MeshPurpose myPurpose
 Returns number of deferred triangles that can be loaded using LoadDeferredData(). Note: this is estimated values, which might be different from actually loaded values Always check triangulation size of actually loaded data in code to avoid out-of-range issues.
 
occ::handle< Poly_TriangulationParametersmyParams
 Returns number of deferred triangles that can be loaded using LoadDeferredData(). Note: this is estimated values, which might be different from actually loaded values Always check triangulation size of actually loaded data in code to avoid out-of-range issues.
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object.
 
- Static Public Member Functions inherited from Standard_Transient
static constexpr const charget_type_name ()
 Returns a type descriptor about this object.
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class.
 
- Protected Member Functions inherited from RWMesh_TriangulationSource
bool loadDeferredData (const occ::handle< OSD_FileSystem > &theFileSystem, const occ::handle< Poly_Triangulation > &theDestTriangulation) const override
 Loads triangulation data from deferred storage using specified shared input file system.
 
- Protected Member Functions inherited from Poly_Triangulation
virtual occ::handle< Poly_TriangulationcreateNewEntity () const
 Creates new triangulation object (can be inheritor of Poly_Triangulation).
 
void unsetCachedMinMax ()
 Clears cached min - max range saved previously.
 
virtual Bnd_Box computeBoundingBox (const gp_Trsf &theTrsf) const
 Calculates bounding box of nodal data.
 

Detailed Description

Mesh data wrapper for delayed primitive array loading from glTF file.

Constructor & Destructor Documentation

◆ RWGltf_GltfLatePrimitiveArray()

RWGltf_GltfLatePrimitiveArray::RWGltf_GltfLatePrimitiveArray ( const TCollection_AsciiString & theId,
const TCollection_AsciiString & theName )

Constructor.

◆ ~RWGltf_GltfLatePrimitiveArray()

RWGltf_GltfLatePrimitiveArray::~RWGltf_GltfLatePrimitiveArray ( )
override

Destructor.

Member Function Documentation

◆ AddPrimArrayData()

RWGltf_GltfPrimArrayData & RWGltf_GltfLatePrimitiveArray::AddPrimArrayData ( RWGltf_GltfArrayType theType)

Add primitive array data element.

◆ BaseColor()

Quantity_ColorRGBA RWGltf_GltfLatePrimitiveArray::BaseColor ( ) const

Return base color.

◆ Data()

const NCollection_Sequence< RWGltf_GltfPrimArrayData > & RWGltf_GltfLatePrimitiveArray::Data ( ) const
inline

Return primitive array data elements.

◆ HasDeferredData()

bool RWGltf_GltfLatePrimitiveArray::HasDeferredData ( ) const
inlineoverridevirtual

Return TRUE if there is deferred storage and some triangulation data that can be loaded using LoadDeferredData().

Reimplemented from Poly_Triangulation.

◆ HasStyle()

bool RWGltf_GltfLatePrimitiveArray::HasStyle ( ) const
inline

Return true if primitive array has assigned material.

◆ Id()

const TCollection_AsciiString & RWGltf_GltfLatePrimitiveArray::Id ( ) const
inline

Entity id.

◆ LoadStreamData()

occ::handle< Poly_Triangulation > RWGltf_GltfLatePrimitiveArray::LoadStreamData ( ) const

Load primitive array saved as stream buffer to new triangulation object.

◆ MaterialCommon()

const occ::handle< RWGltf_MaterialCommon > & RWGltf_GltfLatePrimitiveArray::MaterialCommon ( ) const
inline

Return common (obsolete) material definition.

◆ MaterialPbr()

const occ::handle< RWGltf_MaterialMetallicRoughness > & RWGltf_GltfLatePrimitiveArray::MaterialPbr ( ) const
inline

Return PBR material definition.

◆ Name()

const TCollection_AsciiString & RWGltf_GltfLatePrimitiveArray::Name ( ) const
inline

Entity name.

◆ PrimitiveMode()

RWGltf_GltfPrimitiveMode RWGltf_GltfLatePrimitiveArray::PrimitiveMode ( ) const
inline

Return type of primitive array.

◆ SetMaterialCommon()

void RWGltf_GltfLatePrimitiveArray::SetMaterialCommon ( const occ::handle< RWGltf_MaterialCommon > & theMat)
inline

Set common (obsolete) material definition.

◆ SetMaterialPbr()

void RWGltf_GltfLatePrimitiveArray::SetMaterialPbr ( const occ::handle< RWGltf_MaterialMetallicRoughness > & theMat)
inline

Set PBR material definition.

◆ SetName()

void RWGltf_GltfLatePrimitiveArray::SetName ( const TCollection_AsciiString & theName)
inline

Assign entity name.

◆ SetPrimitiveMode()

void RWGltf_GltfLatePrimitiveArray::SetPrimitiveMode ( RWGltf_GltfPrimitiveMode theMode)
inline

Set type of primitive array.

Field Documentation

◆ myData

NCollection_Sequence<RWGltf_GltfPrimArrayData> RWGltf_GltfLatePrimitiveArray::myData
protected

◆ myId

TCollection_AsciiString RWGltf_GltfLatePrimitiveArray::myId
protected

entity id

◆ myMaterialCommon

occ::handle<RWGltf_MaterialCommon> RWGltf_GltfLatePrimitiveArray::myMaterialCommon
protected

common (obsolete) material

◆ myMaterialPbr

occ::handle<RWGltf_MaterialMetallicRoughness> RWGltf_GltfLatePrimitiveArray::myMaterialPbr
protected

PBR material.

◆ myName

TCollection_AsciiString RWGltf_GltfLatePrimitiveArray::myName
protected

entity name

◆ myPrimMode

RWGltf_GltfPrimitiveMode RWGltf_GltfLatePrimitiveArray::myPrimMode
protected

type of primitive array


The documentation for this class was generated from the following file: