/////////////////////////////////////////////////////////////////////////////// // 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 __NW_GICONTEXTFORNwDatabase_H__ #define __NW_GICONTEXTFORNwDatabase_H__ #include "Gi/GiSelectionStyle.h" #include "GiDefaultContext.h" #include "StaticRxObject.h" #include "NwDatabase.h" #include "NwExport.h" #include "NwObjectReactor.h" #include "NwOcclCullingMode.h" #include "TD_PackPush.h" struct OdGsClientViewInfo; class OdGiSelectionStyle; /** \details Provides the operations and properties that are used for rendering an OdNwDatabase object. */ class NWDBEXPORT OdGiContextForNwDatabase : public OdGiDefaultContext { /** \details Defines properties that are used for rendering an OdNwDatabase object. */ enum { /** Plot generation. */ kPlotGeneration = 1, /** Use Gs model. */ kUseGsModel = 2, /** Gi zero text normals. */ kOdGiZeroTextNormals = 4, /** Disable layout helper link reactors. */ kDisableLayoutHelperLinkReactors = 8, /** TrueType font poly draw. */ kTTFPolyDraw = 16, /** Track database destroy. */ kTrackDbDestroy = 32, /** Manage contextual colors. */ kManageContextualColors = 64, /** Keep PS layout helper view. */ kKeepPSLayoutHelperView = 128, /** Erase PS layout helper view. */ kErasePSLayoutHelperView = 256, /** Last flag. */ kLastFlag = kErasePSLayoutHelperView }; OdUInt32 m_fflags; /** \details Provides the methods for working with a database holder. */ class NWDBEXPORT DatabaseHolder : public OdStaticRxObject { public: /** \details Default constructor. */ DatabaseHolder(); /** \details Destructor. Frees allocated resources. */ ~DatabaseHolder(); /** \details Sets the given database object for the DatabaseHolder object. \param pDb [in] Pointer to the database object to set. */ void setDatabase(OdNwDatabase * pDb); /** \details Notification function called whenever a database is about to be deleted from memory. \param pDb [in] Pointer to the database being deleted. \remarks This function is called before the operation. */ void goodbye(const OdNwDatabase* pDb); OdNwDatabase* m_pDb; } m_DbHolder; //DOM-IGNORE-BEGIN ODRX_DECLARE_MEMBERS(OdGiContextForNwDatabase); protected: ODCOLORREF m_paletteBackground; OdGiSelectionStyle m_selectionStyle; bool m_usePartialViewing; NwOcclCullingMode m_useCpuOcclussionCulling; bool m_usePartialViewingFixedFrameRate; OdUInt32 m_partialViewingTrisLimit; OdString m_reflectionEnvironmentTexture; bool m_drawPointCloudAsRcs; //DOM-IGNORE-END public: /** \details Default constructor. */ OdGiContextForNwDatabase(); /** \details Virtual destructor. Frees allocated resources. */ virtual ~OdGiContextForNwDatabase(); /** \details Receives a pointer to the database. \returns Pointer to the database. */ virtual OdDbBaseDatabase* database() const; /** \details Indicates whether this vectorization is intended for hard copy output. \returns The true value if this vectorization is intended for hard copy output, or false otherwise. */ virtual bool isPlotGeneration() const; /** \details Sets the flag indicating whether this vectorization is intended for hard copy output. \param plotGeneration [in] Hard copy output flag to set. */ virtual void setPlotGeneration(bool plotGeneration); /** \details Sets the background palette. \param ODCOLORREF [in] Background palette to set. */ virtual void setPaletteBackground(ODCOLORREF paletteBackground); /** \details Opens for reading the specified drawable object that belongs to the database associated with this context object. \param drawableId [in] Object ID of the drawable to open. \returns A smart pointer to the open drawable object. */ virtual OdGiDrawablePtr openDrawable(OdDbStub* drawableId); /** \details Receives the palette background color for this vectorization. \returns Palette background as an ODCOLORREF. */ virtual ODCOLORREF paletteBackground() const; /** \details Sets a pointer to the database. \param pNwDatabase [in] Pointer to the OdNwDatabase object to set. */ void setDatabase( OdNwDatabase* pNwDatabase ); /** \details Receives the database that is currently being vectorized. \returns Pointer to the database that is currently being vectorized. */ OdNwDatabase* getDatabase() const; /** \details Retrieves an OdGsClientViewInfo object for the specified viewport. \param vpId [in] Object ID of the viewport to get the OdGsClientViewInfo object for. \param viewInfo [out] Receives the client view information. */ virtual void fillGsClientViewInfo(const OdNwObjectId& vpId, OdGsClientViewInfo& viewInfo); /** \details Receives the internal drawable filtration function ID. \param viewportId [in] Pointer to the object ID of the viewport object to be queried. \returns An internal drawable filtration function ID as OdIntPtr. */ virtual OdIntPtr drawableFilterFunctionId(OdDbStub* viewportId) const; /** \details Retrieves the set of flags for the drawable filtration function. \param functionId [in] Internal drawable filtration function ID. \param pDrawable [in] Currently vectorizing drawable pointer. \param nFlags [in] Set of input flags. \returns Currently returns 0. \remarks Called for each drawable vectorization. */ virtual OdUInt32 drawableFilterFunction(OdIntPtr functionId, const OdGiPathNode* pPathNode, OdUInt32 nFlags); /** \details Indicates whether the GsModel flag of this context object is set. \returns The true value if the GsModel flag of this context object is set, or false otherwise. */ bool useGsModel() const; /** \details Controls the GsModel flag of this context object. \param enable [in] Specify true to enable the GsModel flag, or false to disable. */ void enableGsModel(bool enable); /** \details Retrieves the lineweight display style configuration. \param styleEntry [in] Lineweight style entry for which the current setting is to be returned. \returns * For the kPointLineWeight style, 0 is returned if the point lineweight is disabled, or 1 is returned if enabled. * For the kLineCapStyle style, the entry is returned as a member of the OdPs::LineEndStyle enumeration. * For the kLineJoinStyle style, the entry is returned as a member of the OdPs::LineJoinStyle enumeration. */ OdUInt32 lineWeightConfiguration(LineWeightStyle styleEntry) const; /** \details Indicates whether smooth contour information output is used for TrueType fonts. \returns The true value if smooth contour information output is used for TrueType fonts (OdCharacterProperties::kBezierCurves flag), or false otherwise. */ virtual bool ttfPolyDraw() const; /** \details Enables or disables the TTF PolyDraw mode which adjusts the quality of the TrueType font visualization using smoother contour information output. \param bPolyDraw [in] Flag indicating whether the TTF PolyDraw mode is enabled or disabled. */ void setTtfPolyDrawMode(bool bPolyDraw); /** \details Gets the selection style for entity highlighting. \param nStyle [in] Selection style index. \param selStyle [out] Receives the selection style data. \returns Number of selection styles provided by this context object. */ OdUInt32 selectionStyle(OdUInt32 nStyle, OdGiSelectionStyle &selStyle) const override; /** \details Sets the selection style for entities highlighting. \param nStyle [in] Selection style index. \param selStyle [out] Sets the selection style data. \returns Number of selection styles provided by this context object. */ OdUInt32 setSelectionStyle(OdUInt32 nStyle, const OdGiSelectionStyle &selStyle); /** \details Indicates whether the partial viewing flag of this context object is set. \returns The true value if the partial viewing flag is set, or false otherwise. */ bool usePartialViewing() const; /** \details Sets the partial viewing flag of this context object. \param enable [in] Specify true to enable the partial viewing flag, or false to disable. */ void setPartialViewing(bool enable); /** \details Receives tris count of current partial viewing's limit of this context object. \returns Tris count of current partial viewing's limit as an OdUInt32. */ OdUInt32 getPartialViewingTrisLimit() const; /** \details Set the partial viewing's tris(rendering primitives) limit of this context object. \param trisLimit [in] Tris count of current partial viewing's limit. \remarks If trisLimit is zero - partial viewing limit is disabled. */ void setPartialViewingTrisLimit(OdUInt32 trisLimit); /** \details Receives path to the reflection evironment texture of this context object. \returns string with absolute or relative path ot reflection environment texture. */ OdString getReflectionEnvironment() const; /** \details Sets path to the reflection evironment texture of this context object. \param sPathToTxt [in] string with absolute or relative path ot reflection environment texture. */ void setReflectionEnvironment(const OdString& sPathToTxt); /** \details Indicates whether the partial viewing's software occlusion culling flag of this context object is set. \returns The NwOcclCullingMode::kNONE value if the CPU occlusion culling flag is not set, or false otherwise. \remarks The occlusion culling must be one of the following: Name Value Description kNONE 0x00 Occlusion query is disabled. kSCALAR 0x01 Occlusion query will use CPU depth buffer without simd-optimization. kSSE2 0x02 Occlusion query will use CPU depth buffer with SSE2 - widely supported. kSSE4 0x03 Occlusion query will use CPU depth buffer with SSE4.1 - enhanced blending operations. kAVX 0x04 Occlusion query will use CPU depth buffer with AVX - 256-bit operations (currently supported initially). kAVX2 0x05 Occlusion query will use CPU depth buffer with AVX2- enhanced AVX operations (currently supported initially). kARM_NEON 0x06 Occlusion query will use CPU depth buffer with NEON - arm-architecture intrinsics.
*/ NwOcclCullingMode useCPUOcclussionCulling() const; /** \details Sets the partial viewing's software occlusion culling mode of this context object. \param mode [in] Specifyed mode to enable the partial viewing's software occlusion culling. \remarks The occlusion culling mode must be one of the following: Name Value Description kNONE 0x00 Occlusion query is disabled. kSCALAR 0x01 Occlusion query will use CPU depth buffer without simd-optimization. kSSE2 0x02 Occlusion query will use CPU depth buffer with SSE2 - widely supported. kSSE4 0x03 Occlusion query will use CPU depth buffer with SSE4.1 - enhanced blending operations. kAVX 0x04 Occlusion query will use CPU depth buffer with AVX - 256-bit operations (currently supported initially). kAVX2 0x05 Occlusion query will use CPU depth buffer with AVX2- enhanced AVX operations (currently supported initially). kARM_NEON 0x06 Occlusion query will use CPU depth buffer with NEON - arm-architecture intrinsics.
*/ void setCPUOcclussionCulling(NwOcclCullingMode mode); /** \details Indicates whether the partial viewing's fixed frame rate flag of this context object is set. \returns The true value if the fixed frame rate flag is set, or false otherwise. */ bool useFixedFrameRate() const; /** \details Sets the partial viewing's fixed frame rate flag of this context object. \param enable [in] Specify true to enable the partial viewing's fixed frame rate flag, or false to disable. \remarks If it's set in true - then fixed frame rate value will be getted from corresponded speed element. */ void setFixedFrameRate(bool fixedFrameRate); /** \details Indicates whether external point cloud geometry should be drawn as RCS. \returns The true value if external point cloud geometry should be drawn as RCS, or false otherwise. */ bool drawPointCloudAsRcs() const; /** \details Sets the flag indicating whether external point cloud geometry should be drawn as RCS. \param enable [in] Specify true to enable drawing external point cloud geometry as RCS, or false to disable. */ void setDrawPointCloudAsRcs(bool enable); }; /** \details This template class is a specialization of the OdSmartPtr class for OdGiContextForNwDatabase object pointers. */ typedef OdSmartPtr OdGiContextForNwDatabasePtr; #include "TD_PackPop.h" #endif // __NW_GICONTEXTFORNwDatabase_H__