/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #ifndef OdTvMaterialExporter_H #define OdTvMaterialExporter_H #include "TD_PackPush.h" //stl #define STL_USING_MAP #define STL_USING_FUNCTIONAL #define STL_USING_VECTOR #include "OdaSTL.h" //kernel //nw #include "NwModelUnits.h" #include "NwObject.h" //tv #include "TvMaterial.h" #include "TvLayer.h" #include "TvEntity.h" class OdNwMaterialAttribute; typedef OdSmartPtr OdNwMaterialAttributePtr; class OdNwGraphicMaterialAttribute; typedef OdSmartPtr OdNwGraphicMaterialAttributePtr; class OdTvEntity; typedef OdTvSmartPtr OdTvEntityPtr; class OdTvInsert; typedef OdTvSmartPtr OdTvInsertPtr; struct OdNwdExporterBranchState; //---------------------------------------------------------- // // OdTvMaterialExporter // //---------------------------------------------------------- using OdNwMaterialPair = std::pair; //OdTv2NwMaterialMapValue is value for map with key tv material id, need for correct export tv2nw without creation of duplicates materials struct OdTv2NwMaterialMapValue { OdTv2NwMaterialMapValue(); //boolean flag, true - if tv material has nw materials without color/transparency overrides bool m_bIsNonOverrideIsDefined; //nw materials without color/transparency overrides OdNwMaterialPair m_prNwMaterial; //nw materials with tv transparency overrides std::vector< std::pair > m_vTryOverride; //nw materials with tv transparency and tv colors overrides std::map > > m_mClrOverride; }; using OdTv2NwMaterialMapType = std::map; class OdTvMaterialExporter { public: OdTvMaterialExporter(); ~OdTvMaterialExporter() = default; OdTvMaterialExporter(const OdTvMaterialExporter&) = delete; OdTvMaterialExporter& operator=(const OdTvMaterialExporter&) = delete; OdTvMaterialExporter(OdTvMaterialExporter&&); OdTvMaterialExporter& operator=(OdTvMaterialExporter&&) = delete; public: inline void setCurModelUnits(NwModelUnits::Enum nwModelUnits) { m_curModelUnits = nwModelUnits; } inline void setBranchState(OdNwdExporterBranchState* pBranchState) { m_pBranchState = pBranchState; } void exportMaterial(const OdNwObjectId& nwModelItemId, const OdTvMaterialDef& tvMatDef, const OdTvColorDef& tvClrDef, const OdTvTransparencyDef& tvTrcyDef); protected: void exportMaterial(const OdNwObjectId& nwModelItemId, const OdTvMaterialId& tvMatId, OdUInt32* pOverrideColor, double* pOverrideTransparency); bool getColor(const OdTvColorDef& tvClrDef, OdUInt32& nColor, OdUInt32 skipNonDefaultClr = 0) const; bool getTransparency(const OdTvTransparencyDef& tvTrcyDef, double& dTransparency) const; OdTvMaterialId getMaterial(const OdTvMaterialDef& tvMatDef, OdUInt32 skipNonDefaultMat = 0) const; private: NwModelUnits::Enum m_curModelUnits; OdTv2NwMaterialMapType m_mMaterials; OdNwdExporterBranchState* m_pBranchState; }; #include "TD_PackPop.h" #endif // OdMaterialExporter_H