/////////////////////////////////////////////////////////////////////////////// // 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. /////////////////////////////////////////////////////////////////////////////// // XmlGlesLoader.h #ifndef OD_XML_GLES_LOADER_H_ #define OD_XML_GLES_LOADER_H_ #include "TD_PackPush.h" #include "Ge/GeMatrix3d.h" #include "OdBinaryData.h" #include "TrVisRendition.h" #include "TrVisUniqueIdMapping.h" #include "OdFakeDbStub.h" /** */ struct OdTrXmlMetafileOrderDef { OdTrVisViewportId m_viewportId; OdTrVisOverlayId m_overlayId; OdUInt32 m_nInvalidFrom; OdUInt32 m_nInvalidLen; OdUInt64Vector m_metafileOrder; void setDefault() { m_viewportId = OdTrVisViewportId(); m_overlayId = kTrVisMainOverlayId; m_nInvalidFrom = 0; m_nInvalidLen = 0; m_metafileOrder.clear(); } }; /** */ struct OdTrXmlLightsListDef { OdTrVisViewportId m_viewportId; OdArray > m_Defs; bool m_bDefaultLightsOn; void setDefault() { m_viewportId = kTrVisNullId; m_Defs.clear(); m_bDefaultLightsOn = true; } }; /** */ struct OdTrXmlLightOverridesDef { OdTrVisLightId m_lightId; OdUInt32 m_nKindOfMod; void setDefault() { m_lightId = kTrVisNullId; m_nKindOfMod = 0; } }; /** */ /** */ struct OdTrXmlOverlayExtentsOverrideDef : public OdTrVisExtentsDef { OdTrVisViewportId m_viewportId; OdTrVisOverlayId m_overlayId; void setDefault() { m_viewportId = OdTrVisViewportId(); m_overlayId = kTrVisMainOverlayId; OdTrVisExtentsDef::setDefault(); } }; /** */ struct OdTrXmlOverlayViewParamsOverrideDef { OdTrVisViewportId m_viewportId; OdTrVisOverlayId m_overlayId; bool m_bOverride; OdTrVisViewParamsDef m_viewParams; void setDefault() { m_viewportId = OdTrVisViewportId(); m_overlayId = kTrVisMainOverlayId; m_bOverride = false; m_viewParams.setDefault(); } }; /** */ struct OdTrXmlMetafileOrderInheritanceDef { OdTrVisViewportId m_viewportId1; OdTrVisOverlayId m_overlayId; OdTrVisViewportId m_viewportId2; void setDefault() { m_viewportId1 = OdTrVisViewportId(); m_viewportId2 = OdTrVisViewportId(); m_overlayId = kTrVisMainOverlayId; } }; /** */ struct OdTrXmlLayerOverrideDef { OdTrVisViewportId m_overrideViewportId; bool m_bOverrideLayer; OdTrVisLayerProps m_overrideLayerProps; void setDefault() { m_overrideViewportId = 0; m_bOverrideLayer = false; m_overrideLayerProps.resetLayerFlags(); } }; /** */ struct OdTrXmlGroupMetafilesDef { OdUInt64Vector m_metafiles; void setDefault() { m_metafiles.clear(); } }; /** */ struct OdTrXmlStateBranchMarkersDef { OdTrVisStateBranchId m_stateBranchId; OdTrVisStateBranchMarkersRange m_range; void setDefault() { m_stateBranchId = kTrVisNullId; m_range.set(); } }; /** */ #define PATH_ENTRY(path, enKey, func) pk_##enKey, typedef enum { pk_None = 0, # include "PathEntryDefs.h" pk_UpperBound, pk_Count = pk_UpperBound - 1 } OdEnPathKey; /** \details This interface should provide Id's map sharing between different OdXmlGlesLoader instances */ class OdXmlGlesLoaderIdMapper { public: virtual ~OdXmlGlesLoaderIdMapper() {} /** \details Obtain exist or generate new ID */ virtual OdTrVisId getId( const OdAnsiString&, OdTrVisRendition::DataType type ) const = 0; /** \details Check is ID for specified key exist */ virtual bool hasId( const OdAnsiString&, OdTrVisRendition::DataType type ) const = 0; /** \details Set special ID value by specified key */ virtual void setSpecialId( const OdAnsiString&, OdTrVisId, OdTrVisRendition::DataType type ) = 0; /** \details Clear all amps */ virtual void reset() = 0; /** \details Returns pointer to map - */ virtual OdSharedPtr > > getMapFakeDbStub() = 0; }; /** \details Simple implementation of OdXmlGlesLoaderIdMapper interface using OdTrVisUniqueIDMappingImpl */ class OdXmlGlesIdMapper : public OdXmlGlesLoaderIdMapper { protected: OdTrVisUniqueIDMappingImpl< OdAnsiString > m_mappingImpl; OdSharedPtr > > m_pMapFakeDbStub; public: OdXmlGlesIdMapper() { m_pMapFakeDbStub = new std::map >(); } ~OdXmlGlesIdMapper() override {}; OdTrVisId getId( const OdAnsiString& key, OdTrVisRendition::DataType type ) const override { return m_mappingImpl.getTrVisId( key, type ); } bool hasId( const OdAnsiString& key, OdTrVisRendition::DataType type ) const override { return m_mappingImpl.hasUID( key, type ); } void reset() override { m_mappingImpl.clean(); m_pMapFakeDbStub->clear(); } void setSpecialId( const OdAnsiString& key, OdTrVisId id, OdTrVisRendition::DataType type ) override { m_mappingImpl.setSpecialId( key, id, type ); } OdSharedPtr > > getMapFakeDbStub() override { return m_pMapFakeDbStub; } }; /** */ class OdXmlGlesLoader { protected: OdTrVisRendition* m_pRendition; OdTrVisId m_id; // current Internal ID OdXmlGlesLoaderIdMapper* m_pIdMapper; //OdSharedPtr m_pProgramDef; OdSharedPtr m_pMaterialDef; struct TextureDescription { OdTrVisTexture::Format fmt; OdUInt32 nWidth, nHeight, nAlign, nScanLineLength; bool isValid; OdTrVisTexture::Format pal_fmt; OdUInt32 pal_nWidth, pal_nAlign, pal_nScanLineLength; }; TextureDescription m_curTexture; OdSharedPtr m_pTextureDef; OdSharedPtr m_pSectionPlane; OdSharedPtr m_pViewportDef; OdInt32 m_nViewportInsertedIndex; OdSharedPtr m_pOverlayDef; OdSharedPtr m_pOverlayViewParamsOverrideDef; OdSharedPtr m_pViewParamsDef; OdSharedPtr m_pMetafileDef; OdArray > m_ArrayOffset; OdSharedPtr m_pWriter; OdBaseMetafileOutputStream m_streamWriter; OdSharedPtr m_pSurfaceDef; OdSharedPtr m_pExtentsDef; OdSharedPtr m_pMetafileOrderDef; OdSharedPtr m_pViewportLinestyleDef; OdSharedPtr m_pViewportFadingDef; OdSharedPtr m_pViewportLwdDef; OdSharedPtr m_pViewportShadingDef; OdSharedPtr m_pViewportClipDef; OdSharedPtr m_pBackgroundDef; OdSharedPtr m_pFogDef; OdSharedPtr m_pRenderSettingsDef; OdSharedPtr m_pSectionDef; OdSharedPtr m_pLightOverDef; OdSharedPtr m_pLightsListDef; OdSharedPtr m_pLightDef; OdSharedPtr m_pVisualStyleDef; OdSharedPtr m_pMetafileOrderInheritance; OdTrVisVisualStyleProperty* m_pVisualStyleProperty; OdGiVariant::VariantType m_typeVisualStyle; OdSharedPtr m_pLayerDef; OdSharedPtr m_pLayerOverrideDef; OdSharedPtr m_pStateBranchDef; OdSharedPtr m_pGroupMetafilesDef; OdSmartPtr m_pExtensionObject; OdSharedPtr m_pStateBranchMarkersDef; OdSharedPtr m_pPropertyDef; OdTrVisPropertyDef::PropertyType m_propertyType; OdUInt8 m_objectChangedFlag; OdUInt32 m_mfUserEntryNumData; // cache of fake DbStub OdSharedPtr > > m_pMapFakeDbStub; OdTrVisMetafileContainer* metafile(); OdTrVisArrayWrapper m_arrayType; OdArray > m_aMarkers; OdUInt32 m_uaMarkerIndex; bool m_bDestroyIdMapped; public: OdXmlGlesLoader( OdTrVisRendition* pRendition, OdXmlGlesLoaderIdMapper* pIdMapper = NULL); virtual ~OdXmlGlesLoader(); const OdTrVisArrayWrapper &activeArrayType() const { return m_arrayType; } bool DropBegin(OdEnPathKey pk); virtual bool DropEnd(OdEnPathKey pk); bool DropBoolean(OdEnPathKey pk, bool data); bool DropUInt8RGB(OdEnPathKey pk, const OdBinaryData& data); bool DropUInt8(OdEnPathKey pk, OdUInt8 data); bool DropUInt16(OdEnPathKey pk, OdUInt16 data); bool DropUInt32(OdEnPathKey pk, OdUInt32 data); bool DropUInt64(OdEnPathKey pk, OdUInt64 data); bool DropBinaryStream(OdEnPathKey pk, const OdBinaryData& data); bool DropUInts8(OdEnPathKey pk, const OdUInt8Array &data); bool DropUInts16(OdEnPathKey pk, const OdUInt16Array &data); bool DropUInts32(OdEnPathKey pk, const OdUInt32Array &data); bool DropInt16(OdEnPathKey pk, OdInt16 data); bool DropInt32(OdEnPathKey pk, OdInt32 data); bool DropFloat(OdEnPathKey pk, float data); bool DropFloats(OdEnPathKey pk, const OdArray >& data); bool DropDouble(OdEnPathKey pk, double data); bool DropDoubles(OdEnPathKey pk, const OdArray >& data); bool DropMatrix(OdEnPathKey pk, const OdGeMatrix3d& data, const OdArray >* pDataFloats = NULL); // bool DropStaticId(OdEnPathKey pk, OdTrVisId idValue); // prog virtual bool DropId(OdEnPathKey pk, const OdAnsiString& asValue); bool DropDbOwning(OdEnPathKey pk, const OdAnsiString& asValue); bool DropChars(OdEnPathKey pk, const OdAnsiString& asValue); // bool DropShareableClientData(OdEnPathKey pk, const OdAnsiString& asValue); }; #include "TD_PackPop.h" #endif // OD_XML_GLES_LOADER_H_