RWGltf
OCCT package RWGltf: RWGltf_CafReader, RWGltf_CafWriter, RWGltf_DracoParameters, RWGltf_GltfAccessor, and 19 more bound classes.
RWGltf_CafReader
The glTF (GL Transmission Format) mesh reader into XDE document.
Constructors(1)
Empty constructor.
Static methods(2)
- get_type_name(): string
Instance methods(19)
- ToParallel(): boolean
Return TRUE if multithreaded optimizations are allowed; FALSE by default.
- SetParallel(theToParallel: boolean): void
Setup multithreaded execution.
Parameters (1)theToParallel
- ToSkipEmptyNodes(): boolean
Return TRUE if Nodes without Geometry should be ignored, TRUE by default.
- SetSkipEmptyNodes(theToSkip: boolean): void
Set flag to ignore nodes without Geometry.
Parameters (1)theToSkip
- ToLoadAllScenes(): boolean
Return TRUE if all scenes in the document should be loaded, FALSE by default which means only main (default) scene will be loaded.
- ToApplyScale(): boolean
Return TRUE if non-uniform scaling should be applied directly to the triangulation. FALSE if the average scale should be applied to the transformation matrix.
- SetLoadAllScenes(theToLoadAll: boolean): void
Set flag to flag to load all scenes in the document, FALSE by default which means only main (default) scene will be loaded.
Parameters (1)theToLoadAll
- ToUseMeshNameAsFallback(): boolean
Set flag to use Mesh name in case if Node name is empty, TRUE by default.
- SetMeshNameAsFallback(theToFallback: boolean): void
Set flag to use Mesh name in case if Node name is empty.
Parameters (1)theToFallback
- IsDoublePrecision(): boolean
Return flag to fill in triangulation using double or single precision; FALSE by default.
- SetDoublePrecision(theIsDouble: boolean): void
Set flag to fill in triangulation using double or single precision.
Parameters (1)theIsDouble
- ToSkipLateDataLoading(): boolean
Returns TRUE if data loading should be skipped and can be performed later; FALSE by default.
- SetToSkipLateDataLoading(theToSkip: boolean): void
Sets flag to skip data loading.
Parameters (1)theToSkip
- SetToApplyScale(theToApplyScale: boolean): void
Set flag to apply non-uniform scaling directly to the triangulation (modify nodes). TRUE by default. In case of FALSE the average scale is applied to the transformation matrix.
Parameters (1)theToApplyScale
- ToKeepLateData(): boolean
Returns TRUE if data should be loaded into itself without its transferring to new structure. It allows to keep information about deferred storage to load/unload this data later. TRUE by default.
- SetToKeepLateData(theToKeep: boolean): void
Sets flag to keep information about deferred storage to load/unload data later.
Parameters (1)theToKeep
- ToPrintDebugMessages(): boolean
Returns TRUE if additional debug information should be print; FALSE by default.
- SetToPrintDebugMessages(theToPrint: boolean): void
Sets flag to print debug information.
Parameters (1)theToPrint
RWGltf_CafWriter
glTF writer context from XCAF document.
Constructors(1)
- constructor(theFile: TCollection_AsciiString, theIsBinary: boolean): RWGltf_CafWriter
Main constructor.
Parameters (2)theFile—path to output glTF filetheIsBinary—flag to write into binary glTF format (.glb)
Static methods(2)
- get_type_name(): string
Instance methods(27)
Return transformation from OCCT to glTF coordinate system.
Return transformation from OCCT to glTF coordinate system.
- SetCoordinateSystemConverter(theConverter: RWMesh_CoordinateSystemConverter): void
Set transformation from OCCT to glTF coordinate system.
Parameters (1)theConverter
- IsBinary(): boolean
Return flag to write into binary glTF format (.glb), specified within class constructor.
Return preferred transformation format for writing into glTF file; RWGltf_WriterTrsfFormat_Compact by default.
- SetTransformationFormat(theFormat: RWGltf_WriterTrsfFormat): void
Set preferred transformation format for writing into glTF file.
Parameters (1)theFormat
Return name format for exporting Nodes; RWMesh_NameFormat_InstanceOrProduct by default.
- SetNodeNameFormat(theFormat: RWMesh_NameFormat): void
Set name format for exporting Nodes.
Parameters (1)theFormat
Return name format for exporting Meshes; RWMesh_NameFormat_Product by default.
- SetMeshNameFormat(theFormat: RWMesh_NameFormat): void
Set name format for exporting Meshes.
Parameters (1)theFormat
- IsForcedUVExport(): boolean
Return TRUE to export UV coordinates even if there are no mapped texture; FALSE by default.
- SetForcedUVExport(theToForce: boolean): void
Set flag to export UV coordinates even if there are no mapped texture; FALSE by default.
Parameters (1)theToForce
Return default material definition to be used for nodes with only color defined.
- SetDefaultStyle(theStyle: XCAFPrs_Style): void
Set default material definition to be used for nodes with only color defined.
Parameters (1)theStyle
- ToEmbedTexturesInGlb(): boolean
Return flag to write image textures into GLB file (binary gltf export); TRUE by default. When set to FALSE, texture images will be written as separate files. Has no effect on writing into non-binary format.
- SetToEmbedTexturesInGlb(theToEmbedTexturesInGlb: boolean): void
Set flag to write image textures into GLB file (binary gltf export).
Parameters (1)theToEmbedTexturesInGlb
- ToMergeFaces(): boolean
Return flag to merge faces within a single part; FALSE by default.
- SetMergeFaces(theToMerge: boolean): void
Set flag to merge faces within a single part. May reduce JSON size thanks to smaller number of primitive arrays.
Parameters (1)theToMerge
- ToSplitIndices16(): boolean
Return flag to prefer keeping 16-bit indexes while merging face; FALSE by default.
- SetSplitIndices16(theToSplit: boolean): void
Set flag to prefer keeping 16-bit indexes while merging face. Has effect only with
ToMergeFaces()option turned ON. May reduce binary data size thanks to smaller triangle indexes.Parameters (1)theToSplit
- ToParallel(): boolean
Return TRUE if multithreaded optimizations are allowed; FALSE by default.
- SetParallel(theToParallel: boolean): void
Setup multithreaded execution.
Parameters (1)theToParallel
Return Draco parameters.
- SetCompressionParameters(theDracoParameters: RWGltf_DracoParameters): void
Set Draco parameters.
Parameters (1)theDracoParameters
- Perform(theDocument: TDocStd_Document, theRootLabels: NCollection_Sequence_TDF_Label, theLabelFilter: NCollection_Map_TCollection_AsciiString, theFileInfo: any, theProgress: Message_ProgressRange): boolean
Write glTF file and associated binary file. Triangulation data should be precomputed within shapes!
Parameters (5)theDocument—input documenttheRootLabels—list of root shapes to exporttheLabelFilter—optional filter with document nodes to export, with keys defined byXCAFPrs_DocumentExplorer::DefineChildId()and filled recursively (leaves and parent assembly nodes at all levels); when not NULL, all nodes not included into the map will be ignoredtheFileInfo—map with file metadata to put into glTF header sectiontheProgress—optional progress indicator
ReturnsFALSE on file writing failure
- Perform(theDocument: TDocStd_Document, theFileInfo: any, theProgress: Message_ProgressRange): boolean
Write glTF file and associated binary file. Triangulation data should be precomputed within shapes!
Parameters (3)theDocument—input documenttheFileInfo—map with file metadata to put into glTF header sectiontheProgress—optional progress indicator
ReturnsFALSE on file writing failure
RWGltf_DracoParameters
Draco compression parameters.
Constructors(1)
Properties(8)
RWGltf_GltfAccessor
Low-level glTF data structure defining Accessor.
Constructors(1)
Empty constructor.
Properties(8)
RWGltf_GltfAccessorCompType
Properties(7)
RWGltf_GltfAccessorLayout
Properties(8)
RWGltf_GltfAlphaMode
Properties(3)
RWGltf_GltfArrayType
Properties(9)
RWGltf_GltfBufferView
Low-level glTF data structure defining BufferView.
Constructors(1)
Properties(5)
RWGltf_GltfBufferViewTarget
Properties(3)
- RWGltf_GltfBufferViewTarget_ELEMENT_ARRAY_BUFFER:'RWGltf_GltfBufferViewTarget_ELEMENT_ARRAY_BUFFER'readonly
RWGltf_GltfFace
Low-level glTF data structure holding single Face (one primitive array) definition.
Constructors(1)
Properties(7)
RWGltf_GltfJsonParser
INTERNAL tool for parsing glTF document (JSON structure).
Constructors(1)
- constructor(theRootShapes: NCollection_Sequence_TopoDS_Shape): RWGltf_GltfJsonParser
Empty constructor.
Parameters (1)theRootShapes
Instance methods(18)
- SetFilePath(theFilePath: TCollection_AsciiString): void
Set file path.
Parameters (1)theFilePath
- SetProbeHeader(theToProbe: boolean): void
Set flag for probing file without complete reading.
Parameters (1)theToProbe
Return prefix for reporting issues.
- SetErrorPrefix(theErrPrefix: TCollection_AsciiString): void
Set prefix for reporting issues.
Parameters (1)theErrPrefix
- SetAttributeMap(theAttribMap: NCollection_DataMap_TopoDS_Shape_RWMesh_NodeAttributes_TopTools_ShapeMapHasher): void
Set map for storing node attributes.
Parameters (1)theAttribMap—Mutated in place; read the updated value from this argument after the call.
- SetScaleMap(theScaleMap: NCollection_DataMap_TopoDS_Shape_gp_XYZ_TopTools_ShapeMapHasher): void
Set map for storing non-uniform scalings.
Parameters (1)theScaleMap—Mutated in place; read the updated value from this argument after the call.
- SetExternalFiles(theExternalFiles: NCollection_IndexedMap_TCollection_AsciiString): void
Set list for storing external files.
Parameters (1)theExternalFiles—Mutated in place; read the updated value from this argument after the call.
- SetMetadata(theMetadata: any): void
Set metadata map.
Parameters (1)theMetadata—Mutated in place; read the updated value from this argument after the call.
- SetReadAssetExtras(theToRead: boolean): void
Set flag to translate asset.extras into metadata.
Parameters (1)theToRead
Return transformation from glTF to OCCT coordinate system.
- SetCoordinateSystemConverter(theConverter: RWMesh_CoordinateSystemConverter): void
Set transformation from glTF to OCCT coordinate system.
Parameters (1)theConverter
- SetBinaryFormat(theBinBodyOffset: number, theBinBodyLen: number): void
Initialize binary format.
Parameters (2)theBinBodyOffsettheBinBodyLen
- SetSkipEmptyNodes(theToSkip: boolean): void
Set flag to ignore nodes without Geometry, TRUE by default.
Parameters (1)theToSkip
- SetLoadAllScenes(theToLoadAll: boolean): void
Set flag to flag to load all scenes in the document, FALSE by default which means only main (default) scene will be loaded.
Parameters (1)theToLoadAll
- SetMeshNameAsFallback(theToFallback: boolean): void
Set flag to use Mesh name in case if Node name is empty, TRUE by default.
Parameters (1)theToFallback
- SetToApplyScale(theToApplyScale: boolean): void
Set flag to apply non-uniform scaling directly to the triangulation (modify nodes). TRUE by default. In case of FALSE the average scale is applied to the transformation matrix.
Parameters (1)theToApplyScale
- Parse(theProgress: Message_ProgressRange): boolean
Parse glTF document.
Parameters (1)theProgress
Return face list for loading triangulation.
RWGltf_GltfLatePrimitiveArray
Mesh data wrapper for delayed primitive array loading from glTF file.
Constructors(1)
- constructor(theId: TCollection_AsciiString, theName: TCollection_AsciiString): RWGltf_GltfLatePrimitiveArray
Constructor.
Parameters (2)theIdtheName
Static methods(2)
- get_type_name(): string
Instance methods(16)
Entity id.
Entity name.
- SetName(theName: TCollection_AsciiString): void
Assign entity name.
Parameters (1)theName
Return type of primitive array.
- SetPrimitiveMode(theMode: RWGltf_GltfPrimitiveMode): void
Set type of primitive array.
Parameters (1)theMode
- HasStyle(): boolean
Return true if primitive array has assigned material.
Return base color.
Return PBR material definition.
- SetMaterialPbr(theMat: RWGltf_MaterialMetallicRoughness): void
Set PBR material definition.
Parameters (1)theMat
Return common (obsolete) material definition.
- SetMaterialCommon(theMat: RWGltf_MaterialCommon): void
Set common (obsolete) material definition.
Parameters (1)theMat
Return primitive array data elements.
Add primitive array data element.
Parameters (1)theType
- HasDeferredData(): boolean
Return TRUE if there is deferred storage and some triangulation data that can be loaded using
LoadDeferredData(). Load primitive array saved as stream buffer to new triangulation object.
RWGltf_GltfMaterialMap
Material manager for exporting into glTF format.
Constructors(1)
- constructor(theFile: TCollection_AsciiString, theDefSamplerId: number): RWGltf_GltfMaterialMap
Main constructor.
Parameters (2)theFiletheDefSamplerId
Static methods(1)
Instance methods(9)
- FlushGlbBufferViews(theWriter: RWGltf_GltfOStreamWriter, theBinDataBufferId: number, theBuffViewId: number): { theBuffViewId: number }
Add bufferView's into RWGltf_GltfRootElement_BufferViews section with images collected by AddImagesToGlb().
Parameters (3)theWritertheBinDataBufferIdtheBuffViewId
ReturnsA result object with fields:
theBuffViewId: updated value from the call.
- FlushGlbImages(theWriter: RWGltf_GltfOStreamWriter): void
Write RWGltf_GltfRootElement_Images section with images collected by AddImagesToGlb().
Parameters (1)theWriter
- AddImages(theWriter: RWGltf_GltfOStreamWriter, theStyle: XCAFPrs_Style, theIsStarted: boolean): { theIsStarted: boolean }
Add material images in case of non-GLB file (an alternative to AddImagesToGlb() + FlushBufferViews() + FlushImagesGlb()).
Parameters (3)theWritertheStyletheIsStarted
ReturnsA result object with fields:
theIsStarted: updated value from the call.
- AddMaterial(theWriter: RWGltf_GltfOStreamWriter, theStyle: XCAFPrs_Style, theIsStarted: boolean): void
Add material.
Parameters (3)theWritertheStyletheIsStarted
- AddMaterial(theStyle: XCAFPrs_Style): TCollection_AsciiString
Add material.
Parameters (1)theStyle
- AddTextures(theWriter: RWGltf_GltfOStreamWriter, theStyle: XCAFPrs_Style, theIsStarted: boolean): { theIsStarted: boolean }
Add material textures.
Parameters (3)theWritertheStyletheIsStarted
ReturnsA result object with fields:
theIsStarted: updated value from the call.
- NbImages(): number
Return extent of images map.
- NbTextures(): number
Return extent of textures map.
RWGltf_GltfOStreamWriter
rapidjson::Writer wrapper for forward declaration.
RWGltf_GltfPrimArrayData
An element within primitive array - vertex attribute or element indexes.
Constructors(2)
- Parameters (1)
theType
Properties(6)
RWGltf_GltfPrimitiveMode
Properties(8)
RWGltf_GltfRootElement
Properties(21)
RWGltf_GltfSceneNodeMap
Indexed map of scene nodes with custom search algorithm.
Constructors(1)
Empty constructor.
Instance methods(1)
- FindIndex(theNodeId: TCollection_AsciiString): number
Find index from document node string identifier.
Parameters (1)theNodeId
RWGltf_MaterialCommon
glTF 1.0 format common (obsolete) material definition.
Constructors(1)
Properties(11)
RWGltf_MaterialMetallicRoughness
glTF 2.0 format PBR material definition.
Constructors(1)
Properties(14)
RWGltf_TriangulationReader
RWMesh_TriangulationReader implementation creating Poly_Triangulation.
Constructors(1)
Empty constructor.
Static methods(1)
Instance methods(2)
- LoadStreamData(theSourceMesh: RWMesh_TriangulationSource, theDestMesh: Poly_Triangulation): boolean
Loads only primitive arrays saved as stream buffer (it is primarily glTF data encoded in base64 saved to temporary buffer during glTF file reading).
Parameters (2)theSourceMeshtheDestMesh