File indexing completed on 2025-01-18 10:04:42
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _RWGltf_GltfMaterialMap_HeaderFile
0015 #define _RWGltf_GltfMaterialMap_HeaderFile
0016
0017 #include <RWMesh_MaterialMap.hxx>
0018 #include <RWGltf_GltfBufferView.hxx>
0019
0020 class RWGltf_GltfOStreamWriter;
0021
0022
0023 class RWGltf_GltfMaterialMap : public RWMesh_MaterialMap
0024 {
0025 DEFINE_STANDARD_RTTIEXT(RWGltf_GltfMaterialMap, RWMesh_MaterialMap)
0026 public:
0027
0028
0029 Standard_EXPORT RWGltf_GltfMaterialMap (const TCollection_AsciiString& theFile,
0030 const Standard_Integer theDefSamplerId);
0031
0032
0033 Standard_EXPORT virtual ~RWGltf_GltfMaterialMap();
0034
0035 public:
0036
0037
0038
0039
0040 Standard_EXPORT void AddGlbImages (std::ostream& theBinFile,
0041 const XCAFPrs_Style& theStyle);
0042
0043
0044 Standard_EXPORT void FlushGlbBufferViews (RWGltf_GltfOStreamWriter* theWriter,
0045 const Standard_Integer theBinDataBufferId,
0046 Standard_Integer& theBuffViewId);
0047
0048
0049 Standard_EXPORT void FlushGlbImages (RWGltf_GltfOStreamWriter* theWriter);
0050
0051 public:
0052
0053
0054
0055 Standard_EXPORT void AddImages (RWGltf_GltfOStreamWriter* theWriter,
0056 const XCAFPrs_Style& theStyle,
0057 Standard_Boolean& theIsStarted);
0058
0059
0060 Standard_EXPORT void AddMaterial (RWGltf_GltfOStreamWriter* theWriter,
0061 const XCAFPrs_Style& theStyle,
0062 Standard_Boolean& theIsStarted);
0063
0064 Standard_EXPORT void AddTextures (RWGltf_GltfOStreamWriter* theWriter,
0065 const XCAFPrs_Style& theStyle,
0066 Standard_Boolean& theIsStarted);
0067
0068
0069 Standard_Integer NbImages() const { return myImageMap.Extent(); }
0070
0071
0072 Standard_Integer NbTextures() const { return myTextureMap.Extent(); }
0073
0074 public:
0075
0076
0077 Standard_EXPORT static const Handle(Image_Texture)& baseColorTexture (const Handle(XCAFDoc_VisMaterial)& theMat);
0078
0079 protected:
0080
0081
0082 Standard_EXPORT void addImage (RWGltf_GltfOStreamWriter* theWriter,
0083 const Handle(Image_Texture)& theTexture,
0084 Standard_Boolean& theIsStarted);
0085
0086
0087
0088
0089 Standard_EXPORT void addGlbImage (std::ostream& theBinFile,
0090 const Handle(Image_Texture)& theTexture);
0091
0092
0093 Standard_EXPORT void addTexture (RWGltf_GltfOStreamWriter* theWriter,
0094 const Handle(Image_Texture)& theTexture,
0095 Standard_Boolean& theIsStarted);
0096
0097
0098 Standard_EXPORT virtual TCollection_AsciiString AddMaterial (const XCAFPrs_Style& theStyle) Standard_OVERRIDE;
0099
0100
0101 Standard_EXPORT virtual void DefineMaterial (const XCAFPrs_Style& theStyle,
0102 const TCollection_AsciiString& theKey,
0103 const TCollection_AsciiString& theName) Standard_OVERRIDE;
0104
0105 protected:
0106
0107 RWGltf_GltfOStreamWriter* myWriter;
0108 NCollection_IndexedDataMap<Handle(Image_Texture), RWGltf_GltfBufferView> myImageMap;
0109 NCollection_Map<Handle(Image_Texture)> myTextureMap;
0110
0111 Standard_Integer myDefSamplerId;
0112
0113 };
0114
0115 #endif