/////////////////////////////////////////////////////////////////////////////// // 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. /////////////////////////////////////////////////////////////////////////////// // TrGL2 renderer local client #ifndef ODGLES2LOCALRENDITIONCLIENT #define ODGLES2LOCALRENDITIONCLIENT #include "TD_PackPush.h" #include "TrRndLocalRenditionHost.h" #include "TrRndRenderModule.h" // Forward declarations class OdTrVisGsBranchMarkersAccessor; /** \details */ struct OdTrVecStateBranchGsClient : public OdTrRndStateBranchClient { mutable OdTrVisGsBranchMarkersAccessor *m_pUsedAccessors, *m_pFreedAccessors; /** \details Default constructor for the OdTrVecStateBranchGsClient class. */ OdTrVecStateBranchGsClient() : m_pUsedAccessors(NULL), m_pFreedAccessors(NULL) {} /** \details Destructor for the OdTrVecStateBranchGsClient class. */ ~OdTrVecStateBranchGsClient() override; /** \details Returns a pointer to a state branch defined by the specified ID. \param branchId [in] State branch identifier. */ OdTrVisStateBranchPtr stateBranchGetPtr(OdTrVisStateBranchId branchId) const override; /** \details Returns an identifier of the state branch from the specified pointer. \param pStateBranch [in] Pointer to a state branch. \returns State branch identifier. */ OdTrVisStateBranchId stateBranchId(OdTrVisStateBranchPtr pStateBranch) const override; void stateBranchLock(OdTrVisStateBranchId branchId) const override; bool stateBranchUnlock(OdTrVisStateBranchId branchId) const override; /** \details Checks whether the state branch is empty. \param pStateBranch [in] Pointer to a state branch. \returns true if the state branch has no markers and the child array is empty, false otherwise. */ bool stateBranchIsEmpty(OdTrVisStateBranchPtr pStateBranch) const override; /** \details Checks whether the state branch has GsMarkers. \param pStateBranch [in] Pointer to a state branch. \returns true if the state branch has markers, false otherwise. */ bool stateBranchHasMarkers(OdTrVisStateBranchPtr pStateBranch) const override; /** \details Returns a pointer to the child of a state branch. \param pStateBranch [in] Pointer to a state branch. \param childId [in] Child identifier. */ OdTrVisStateBranchPtr stateBranchGetChild(OdTrVisStateBranchPtr pStateBranch, OdTrVisOwning childId) const override; OdTrVisStateChildIt stateBranchNextChild(OdTrVisStateBranchPtr pStateBranch, OdTrVisStateChildIt it = nullptr, OdTrVisStateBranchId *pChildId = nullptr) const override; /** \details Checks whether the state branch has the specified GsMarkers. \param pStateBranch [in] Pointer to a state branch. \param gsMarker [in] Gs marker to check. \returns true if the state branch has the specified marker, false otherwise. */ OdTrVisStateMarkerPtr stateBranchHasMarker(OdTrVisStateBranchPtr pStateBranch, OdTrVisGsMarker gsMarker) const override; OdTrVisStateMarkerIt stateBranchNextMarker(OdTrVisStateBranchPtr pStateBranch, OdTrVisStateMarkerIt it = nullptr, OdTrVisGsMarker *pMarkerId = nullptr) const override; OdUInt32 stateBranchIntegerParam(OdTrVisStateBranchPtr pStateBranch, OdTrVisStateMarkerPtr pMarker = nullptr) const override; const OdGeMatrix3d &stateBranchMatrixParam(OdTrVisStateBranchPtr pStateBranch, OdTrVisStateMarkerPtr pMarker = nullptr) const override; /** \details Returns the accessor for Gs markers. \param pStateBranch [in] Pointer to a state branch. \returns Pointer to the instance that accesses markers of the state branch. */ OdTrRndMarkersAccessor* stateBranchMarkers(OdTrVisStateBranchPtr pStateBranch) const override; /** \details Releases the specified markers accessor. \param pAccessor [in] Pointer to the markers accessor. */ void releaseMarkersAccessor( OdTrRndMarkersAccessor* pAccessor ) const override; static OdTrRndStateBranchClientPtr createObject(); }; /** \details */ class OdTrVecLocalRenditionGsClient : public OdTrRndLocalRenditionClient { protected: OdTrRndStateBranchClientPtr m_pStateBranchClient; OdTrRndRenderModulePtr m_pRenderModule; public: /** \details Returns a pointer to a render module. \returns Pointer to a render module. */ OdTrRndRenderModule *renderModule() { return m_pRenderModule; } /** \details Returns a pointer to a render module. \returns Pointer to a render module. */ const OdTrRndRenderModule *renderModule() const { return m_pRenderModule; } /** \details Creates a local context. \param pDevice [in] Pointer to a client device. \returns Smart pointer to the created context. */ OdTrRndLocalContextPtr createLocalContext(OdTrVisRenderClient *pDevice) override; /** \details Returns optional state branches interface. \returns Smart pointer to the state branches interface. \remarks If the interface exists, rendition is initialized as Gs-based. */ OdTrRndStateBranchClientPtr stateBranchClient() override; /** \details Creates optional resource sharing provider (for multiple devices session sharing). \returns Smart pointer to the created sharing provider. */ OdTrVisSharingProviderClientPtr createSharingProvider() override; // Predefined textures generation /** \details Generates a linetype texture. \param ltpId [in] Linetype index. \param outPixels [out] Receives a set of bytes that represents a rasterized linetype. \param forePixVal [in] Value that is set for enabled linetype pattern bytes. \returns true. \remarks Background bytes (linetype gaps) are drawn as zeroes. Foreground bytes (linetype dashes) are drawn using forePixVal. */ bool generateLinetypeTexture(OdPs::LineType ltpId, OdUInt8Array& outPixels, OdUInt8 forePixVal) const override; /** \details Generates a fill type texture. \param fsId [in] Fillstyle number. \param outPixels [out] Receives a set of bytes that represents a rasterized fillstyle. \param dimX [in] Width of image to fill. \param dimY [in] Height of image to fill. \param forePixVal [in] Value that is set for enabled fillstyle pattern bytes. \returns true. \remarks Background bytes (fillstyle holes) are drawn as zeroes. Foreground bytes (fillstyle points) are drawn using forePixVal. */ bool generateFilltypeTexture(OdPs::FillStyle fsId, OdUInt8Array& outPixels, OdUInt32 dimX, OdUInt32 dimY, OdUInt8 forePixVal) const override; /** \details Creates an instance of the OdTrRndLocalRenditionClient class. \param pRenderModule [in] Pointer to a render module to assign. \returns Smart pointer to the created instance. */ static OdTrRndLocalRenditionClientPtr createObject(OdTrRndRenderModule *pRenderModule); }; #include "TD_PackPop.h" #endif // ODGLES2LOCALRENDITIONCLIENT