Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:42

0001 // Copyright (c) 2022 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _RWGltf_ConfigurationNode_HeaderFile
0015 #define _RWGltf_ConfigurationNode_HeaderFile
0016 
0017 #include <DE_ConfigurationNode.hxx>
0018 #include <RWMesh_CoordinateSystem.hxx>
0019 #include <RWGltf_WriterTrsfFormat.hxx>
0020 #include <RWMesh_NameFormat.hxx>
0021 
0022 //! The purpose of this class is to configure the transfer process for glTF format
0023 //! Stores the necessary settings for RWGltf_Provider.
0024 //! Configures and creates special provider to transfer glTF files.
0025 //!
0026 //! Nodes grouped by Vendor name and Format type.
0027 //! The Vendor name is "OCC"
0028 //! The Format type is "GLTF"
0029 //! The supported CAD extensions are ".gltf", ".glb"
0030 //! The import process is supported.
0031 //! The export process is supported.
0032 class RWGltf_ConfigurationNode : public DE_ConfigurationNode
0033 {
0034   DEFINE_STANDARD_RTTIEXT(RWGltf_ConfigurationNode, DE_ConfigurationNode)
0035 public:
0036 
0037   //! Initializes all field by default
0038   Standard_EXPORT RWGltf_ConfigurationNode();
0039 
0040   //! Copies values of all fields
0041   //! @param[in] theNode object to copy
0042   Standard_EXPORT RWGltf_ConfigurationNode(const Handle(RWGltf_ConfigurationNode)& theNode);
0043 
0044   //! Updates values according the resource
0045   //! @param[in] theResource input resource to use
0046   //! @return true if theResource loading has ended correctly
0047   Standard_EXPORT virtual bool Load(const Handle(DE_ConfigurationContext)& theResource) Standard_OVERRIDE;
0048 
0049   //! Writes configuration to the string
0050   //! @return result resource string
0051   Standard_EXPORT virtual TCollection_AsciiString Save() const Standard_OVERRIDE;
0052 
0053   //! Copies values of all fields
0054   //! @return new object with the same field values
0055   Standard_EXPORT virtual Handle(DE_ConfigurationNode) Copy() const Standard_OVERRIDE;
0056 
0057   //! Creates new provider for the own format
0058   //! @return new created provider
0059   Standard_EXPORT virtual Handle(DE_Provider) BuildProvider() Standard_OVERRIDE;
0060 
0061 public:
0062 
0063   //! Checks the import supporting
0064   //! @return true if import is supported
0065   Standard_EXPORT virtual bool IsImportSupported() const Standard_OVERRIDE;
0066 
0067   //! Checks the export supporting
0068   //! @return true if export is supported
0069   Standard_EXPORT virtual bool IsExportSupported() const Standard_OVERRIDE;
0070 
0071   //! Gets CAD format name of associated provider
0072   //! @return provider CAD format
0073   Standard_EXPORT virtual TCollection_AsciiString GetFormat() const Standard_OVERRIDE;
0074 
0075   //! Gets provider's vendor name of associated provider
0076   //! @return provider's vendor name
0077   Standard_EXPORT virtual TCollection_AsciiString GetVendor() const Standard_OVERRIDE;
0078 
0079   //! Gets list of supported file extensions
0080   //! @return list of extensions
0081   Standard_EXPORT virtual TColStd_ListOfAsciiString GetExtensions() const Standard_OVERRIDE;
0082 
0083 public:
0084   struct RWGltf_InternalSection
0085   {
0086     // Common
0087     double FileLengthUnit = 1.; //!< File length units to convert from while reading the file, defined as scale factor for m (meters)
0088     RWMesh_CoordinateSystem SystemCS = RWMesh_CoordinateSystem_Zup; //!< System origin coordinate system to perform conversion into during read
0089     RWMesh_CoordinateSystem FileCS = RWMesh_CoordinateSystem_Yup; //!< File origin coordinate system to perform conversion during read
0090     // Reading
0091     bool ReadSinglePrecision = true; //!< Flag for reading vertex data with single or double floating point precision
0092     bool ReadCreateShapes = false;  //!< Flag for create a single triangulation
0093     TCollection_AsciiString ReadRootPrefix; //!< Root folder for generating root labels names
0094     bool ReadFillDoc = true; //!< Flag for fill document from shape sequence
0095     bool ReadFillIncomplete = true; //!< Flag for fill the document with partially retrieved data even if reader has failed with error
0096     int ReadMemoryLimitMiB = -1; //!< Memory usage limit
0097     bool ReadParallel = false; //!< Flag to use multithreading
0098     bool ReadSkipEmptyNodes = true; //!< Flag to ignore nodes without Geometry
0099     bool ReadLoadAllScenes = false; //!< Flag to load all scenes in the document
0100     bool ReadUseMeshNameAsFallback = true; //!< Flag to use Mesh name in case if Node name is empty
0101     bool ReadSkipLateDataLoading = false; //!< Flag to skip triangulation loading
0102     bool ReadKeepLateData = true;//!< Flag to keep information about deferred storage to load/unload triangulation later
0103     bool ReadPrintDebugMessages = false; //!< Flag to print additional debug information
0104     // Writing
0105     TCollection_AsciiString WriteComment; //!< Export special comment
0106     TCollection_AsciiString WriteAuthor; //!< Author of exported file name
0107     RWGltf_WriterTrsfFormat WriteTrsfFormat = RWGltf_WriterTrsfFormat_Compact; //!< Transformation format to write into glTF file
0108     RWMesh_NameFormat WriteNodeNameFormat = RWMesh_NameFormat_InstanceOrProduct; //!< Name format for exporting Nodes
0109     RWMesh_NameFormat WriteMeshNameFormat = RWMesh_NameFormat_Product; //!< Name format for exporting Meshes
0110     bool WriteForcedUVExport = false; //!< Export UV coordinates even if there are no mapped texture
0111     bool WriteEmbedTexturesInGlb = true; //!< Flag to write image textures into GLB file
0112     bool WriteMergeFaces = false; //!< Flag to merge faces within a single part
0113     bool WriteSplitIndices16 = false; //!< Flag to prefer keeping 16-bit indexes while merging face
0114   } InternalParameters;
0115 };
0116 
0117 #endif // _RWGltf_ConfigurationNode_HeaderFile