/////////////////////////////////////////////////////////////////////////////// // 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 ODOPENGLSTREAMVECTORIZER_INCLUDED #define ODOPENGLSTREAMVECTORIZER_INCLUDED #include "TD_PackPush.h" // Comment to disable metafile stream implementation #define OD_OGL_ENABLEMETASTREAM #include "GsOpenGLVectorizer.h" #include "ExOpenGLMetafileStream.h" #include "ExOpenGLMetafileWriter.h" #include "ExOpenGLMetafileReader.h" #include "TtfFontsCache.h" // Enable/disable textures/raster images binding #ifdef GL_VERSION_1_1 #define OD_OGL_ENABLETEXBINDING #endif // Ability to share textures data between OpenGL contexts. // Internal OpenGL mechanisms (like wglShareLists) have some limitations, so do all job manually. #define OD_OGL_TEXTURESHARING #ifdef OD_OGL_TEXTURESHARING #include "OdList.h" /** */ struct OdOpenGLArrayWrapperShared : public OdRxObject, public OdOpenGLArrayWrapper { static OdSmartPtr createSharedArray(); /** \details Destructor for the OdOpenGLArrayWrapperShared class. Clears data allocated for this array. */ ~OdOpenGLArrayWrapperShared() override { clearArray(); } }; typedef OdSmartPtr OdOpenGLArrayWrapperSharedPtr; /** \details \sa */ class OdOpenGLResourceSharingProvider { public: struct OdOpenGLResourceShareRef; struct OdOpenGLResourceShareEntry { const void *m_pBasePtr; OdRxObjectPtr m_pLock; // Optionally lock m_pBasePtr memory block const void *m_pSecondPtr; OdRxObjectPtr m_pSecondLock; // Optionally lock m_pSecondPtr memory block #ifdef OD_OGL_ENABLETEXBINDING GLuint m_uBinding; GLuint m_uSecondBinding; #endif OdList m_refs; OdOpenGLResourceSharingProvider *m_pProv; OdOpenGLResourceShareEntry() : m_pBasePtr(NULL) , m_pSecondPtr(NULL) #ifdef OD_OGL_ENABLETEXBINDING , m_uBinding(0xFFFFFFFF) , m_uSecondBinding(0xFFFFFFFF) #endif { } ~OdOpenGLResourceShareEntry(); bool operator ==(const OdOpenGLResourceShareEntry& e2) const { return m_pBasePtr == e2.m_pBasePtr; } }; protected: typedef OdList shareEntries; shareEntries m_sharedEntries; OdGsOpenGLVectorizeDevice *m_pDevice; public: explicit OdOpenGLResourceSharingProvider() : m_pDevice(NULL) { } ~OdOpenGLResourceSharingProvider() { onManagerDestroy(); } void setDevice(OdGsOpenGLVectorizeDevice *pDevice) { m_pDevice = pDevice; } struct OdOpenGLResourceShareRef { typedef std::map sharedDefs; mutable sharedDefs m_sharedDefs; OdOpenGLResourceShareRef() { } ~OdOpenGLResourceShareRef() { unlinkShared(); } OdOpenGLResourceShareEntry *getShared(OdGsOpenGLVectorizeDevice* pCurDevice) const; OdOpenGLResourceShareEntry *createShared(OdGsOpenGLVectorizeDevice* pCurDevice, /*this*/ OdOpenGLResourceSharingProvider *pProv) const; void unlinkShared(OdGsOpenGLVectorizeDevice* pDevice); void unlinkShared(); // Client overrides virtual const void* rsrAccessPtr(int /*n*/) const { return NULL; } virtual OdRxObject *rsrAccessObj(int /*n*/) const { return NULL; } #ifdef OD_OGL_ENABLETEXBINDING virtual void rsrRenderToBind(const void* /*pPtr*/, const void* /*pSecPtr*/, GLint /*secBind*/) { } #endif }; void onManagerDestroy(); // Managing methods OdOpenGLResourceShareEntry *appendEntry(OdOpenGLResourceShareRef *pRef, OdGsOpenGLVectorizeDevice* pCurDevice /*this*/); void unlinkEntry(OdOpenGLResourceShareRef *pRef, OdGsOpenGLVectorizeDevice* pCurDevice, OdOpenGLResourceShareEntry *pEntry); }; #endif /** \details \sa */ class OdOpenGLFragmentProgram { protected: int m_bTried; GLuint m_progBind; public: OdOpenGLFragmentProgram() : m_bTried(0), m_progBind(0) { } bool isInited() const { return m_bTried > 0; } bool initShad(OdGsOpenGLVectorizeDevice *pDevice, const char *pAsm); void uninitShad(OdGsOpenGLVectorizeDevice *pDevice); void bind(OdGsOpenGLVectorizeDevice *pDevice) const; void unbind(OdGsOpenGLVectorizeDevice *pDevice) const; bool canBind() const { return m_bTried > 1; } void setParam(OdGsOpenGLVectorizeDevice *pDevice, GLuint nParam, GLfloat p1, GLfloat p2, GLfloat p3, GLfloat p4) const; void setParam(OdGsOpenGLVectorizeDevice *pDevice, GLuint nParam, const GLfloat *ps) const; }; /** \details This class implements streamed device -independent OpenGL Vectorizer devices. Library: Source code provided. */ class OdGsOpenGLStreamVectorizeDevice : public OdGsOpenGLVectorizeDevice , public OdTtfFontsCacheCallback , public OdGsMaterialTextureDataFiler { friend class OdGsOpenGLStreamVectorizeView; public: class RasterImageCacheCallback { public: virtual void rasterImageCacheDestroyed() = 0; }; /** \details This structure represents information about raster image. */ struct RasterImageInfo { /** Pointer to a raster image object. */ const OdGiRasterImage *m_pImg; /** Flag that indicates whether the image contains transparency data. */ bool m_bTransparency; /** Foreground color. */ ODCOLORREF m_fgColor; /** Flag that indicates whether to use secondary color. */ bool m_bSecColor; /** Background color. */ ODCOLORREF m_bkColor; /** Image brightness. */ double m_fBrightness; /** Image contrast. */ double m_fContrast; /** Image fade. */ double m_fFade; /** \details Equality operator for the RasterImageInfo structure. \param riInfo [in] Raster image info structure to compare. \returns true if all the following conditions are met: * Raster image objects are equal; * Transparency flags are equal. If transparency is used, foreground colors are also compared; * Secondary color usage flags are equal. If these flags are used, background colors are also compared; * Brightness values are equal; * Contrast values are equal; * Fade values are equal; */ bool operator ==(const RasterImageInfo &riInfo) const { return (m_pImg == riInfo.m_pImg) && (m_bTransparency == riInfo.m_bTransparency) && ((m_bTransparency) ? (m_fgColor == riInfo.m_fgColor) : true) && (m_bSecColor == riInfo.m_bSecColor) && ((m_bSecColor) ? (m_bkColor == riInfo.m_bkColor) : true) && (m_fBrightness == riInfo.m_fBrightness) && (m_fContrast == riInfo.m_fContrast) && (m_fFade == riInfo.m_fFade); } /** \details Inequality operator for the RasterImageInfo structure. \param riInfo [in] Raster image info structure to compare. \returns true if at least one of the following conditions fails: * Raster image objects are equal; * Transparency flags are equal. If transparency is used, foreground colors are also compared; * Secondary color usage flags are equal. If these flags are used, background colors are also compared; * Brightness values are equal; * Contrast values are equal; * Fade values are equal; */ bool operator !=(const RasterImageInfo &riInfo) const { return (m_pImg != riInfo.m_pImg) || (m_bTransparency != riInfo.m_bTransparency) || ((m_bTransparency) ? (m_fgColor != riInfo.m_fgColor) : false) || (m_bSecColor != riInfo.m_bSecColor) || ((m_bSecColor) ? (m_bkColor != riInfo.m_bkColor) : false) || (m_fBrightness != riInfo.m_fBrightness) || (m_fContrast != riInfo.m_fContrast) || (m_fFade != riInfo.m_fFade); } /** \details Assignment operator for the RasterImageInfo structure. \param riInfo [in] Raster image info structure to assign. \returns Reference to this RasterImageInfo structure with modified parameters. */ RasterImageInfo &operator =(const RasterImageInfo &riInfo) { m_pImg = riInfo.m_pImg; m_bTransparency = riInfo.m_bTransparency; m_fgColor = riInfo.m_fgColor; m_bSecColor = riInfo.m_bSecColor; m_bkColor = riInfo.m_bkColor; m_fBrightness = riInfo.m_fBrightness; m_fContrast = riInfo.m_fContrast; m_fFade = riInfo.m_fFade; return *this; } }; struct RasterImageCacheEntry : public RasterImageInfo { #ifdef OD_OGL_TEXTURESHARING // The bits array must be always available to provide sharing OdOpenGLArrayWrapperSharedPtr m_texData; OdOpenGLArrayWrapperSharedPtr m_palData; #ifdef OD_OGL_ENABLETEXBINDING GLuint m_uBinding; GLuint m_uPalBinding; #endif #else #ifndef OD_OGL_ENABLETEXBINDING OdOpenGLArrayWrapper m_texData; OdOpenGLArrayWrapper m_palData; #else GLuint m_uBinding; GLuint m_uPalBinding; #endif #endif OdUInt32 m_uLutSize; OdUInt32 m_uRefCounter; // OdArray m_callbacks; }; enum FragmentProgram { kPaletteShader = 0, NFragmentPrograms }; private: OdArray m_rasterImageCache; OdArray m_resourceCallbacks; #ifdef OD_OGL_TEXTURESHARING OdOpenGLResourceSharingProvider m_sharingProv; #endif OdTtfFontsCachePtr m_ttfFontsCache; OdOpenGLFragmentProgram m_fragmentProgram[NFragmentPrograms]; public: // Raster images cache support /** \details Clears the raster image cache. */ void clearRasterImageCache(); /** \details Finds a cache entry by the specified raster image info. \param riInfo [in] Raster image info structure used for searching for a corresponding cache entry. \returns Pointer to a cahce entry if found, or returns NULL if the corresponding entry is not found. */ RasterImageCacheEntry *findRasterImage(const RasterImageInfo &riInfo) const; #ifndef OD_OGL_ENABLETEXBINDING /** \details Adds a cache entry by the specified raster image info. \param riInfo [in] Raster image info structure. \param pData [in] Pointer to texture data. \param uSize [in] Size of texture data in bytes. \param pPalData [in] Pointer to palette data. \param uLutSize [in] Palette size. \returns Pointer to the added raster image cache entry. */ RasterImageCacheEntry *addRasterImage(const RasterImageInfo &riInfo, const void *pData, OdUInt32 uSize, const void *pPalData, OdUInt32 uLutSize); #else #ifndef OD_OGL_TEXTURESHARING RasterImageCacheEntry *addRasterImage(const RasterImageInfo &riInfo, GLuint uBinding, OdUInt32 uLutSize, GLuint uPalBinding); #else RasterImageCacheEntry *addRasterImage(const RasterImageInfo &riInfo, const void *pData, OdUInt32 uSize, GLuint uBinding, const void *pPalData, OdUInt32 uLutSize, GLuint uPalBinding); #endif #endif /** \details Increments a reference counter for the specified image cache entry and appends the specified callback for it. \param pEntry [in] Raster image cache entry. \param pCallback [in] Pointer to the callback to append. */ void incrementRasterImageRef(RasterImageCacheEntry *pEntry, RasterImageCacheCallback *pCallback); /** \details Decrements a reference counter for the specified image cache entry and removes the specified callback for it. If the reference counter reaches 0, this method performs cleanup of related resources and deletes the image cache entry. \param pEntry [in] Raster image cache entry. \param pCallback [in] Pointer to the callback to append. */ void decrementRasterImageRef(RasterImageCacheEntry *pEntry, RasterImageCacheCallback *pCallback); /** \details Adds the specified callback to the array of RasterImageCacheCallback objects. \param pCallback [in] Pointer to the callback to append. */ void addResourceCallback(RasterImageCacheCallback *pCallback); /** \details Removes the specified callback from the array of RasterImageCacheCallback objects. \param pCallback [in] Pointer to the callback to remove. */ void removeResourceCallback(RasterImageCacheCallback *pCallback); #ifdef OD_OGL_TEXTURESHARING OdOpenGLResourceSharingProvider &sharingProvider() { return m_sharingProv; } #endif OdTtfFontsCache *ttfFontsCache() { return m_ttfFontsCache.get(); } const OdTtfFontsCache *ttfFontsCache() const { return m_ttfFontsCache.get(); } OdOpenGLFragmentProgram &fragmentProgram(FragmentProgram nProg) { return m_fragmentProgram[nProg]; } const OdOpenGLFragmentProgram &fragmentProgram(FragmentProgram nProg) const { return m_fragmentProgram[nProg]; } protected: void onContextDelete() override; public: /** \details Default constructor for the OdGsOpenGLStreamVectorizeDevice class. */ OdGsOpenGLStreamVectorizeDevice(); /** \details Destructor for the OdGsOpenGLStreamVectorizeDevice class. */ ~OdGsOpenGLStreamVectorizeDevice() override; // Open sharing for this level bool isModelCompatible(OdGsModel* pModel) const override { return OdGsBaseVectorizeDevice::isModelCompatible(pModel); } ODRX_USING_HEAP_OPERATORS(OdGsOpenGLVectorizeDevice); //DOM-IGNORE-BEGIN // TtfFonts cache support OdRxObjectPtr tfcNewMetafile(void *pSessionId) override; OdGiConveyorGeometry *tfcBeginMetafile(OdRxObject *pMetafile, void *pSessionId) override; void tfcFinalizeMetafile(OdRxObject *pMetafile, void *pSessionId) override; void tfcPlayMetafile(const OdGeMatrix3d &xForm, const OdRxObject *pMetafile, void *pSessionId) const override; bool tfcSaveMetafile(const OdRxObject* pMetafile, OdGsFiler *pFiler) override; OdRxObjectPtr tfcLoadMetafile(OdGsFiler *pFiler) override; //DOM-IGNORE-END /** \details Checks whether the device supports saving its state. \returns true. */ bool isSupportDeviceStateSaving() const override; /** \details Saves data of a client device to the specified filer. \param pFiler [in] Pointer to a filer where to save device state. \returns true if the state of client device is saved successfully, false otherwise. */ bool saveClientDeviceState(OdGsFilerGSS *pFiler) const override; /** \details Loads data of a client device from the specified filer. \param pFiler [in] Pointer to a filer from which to read device state. \returns true if the state of client device is loaded successfully, false otherwise. */ bool loadClientDeviceState(OdGsFilerGSS *pFiler) override; /** \details Saves material texture data to the specified filer. This method also writes information that indicates whether the specified material texture data is present in the material texture manager of the device. \param pTextureData [in] Pointer to material texture data to save. \param pFiler [in] Pointer to a filer where to save material texture data. \returns true if the state of material texture data is saved successfully, false otherwise. */ bool saveClientMaterialTextureData(const OdGiMaterialTextureData *pTextureData, OdGsFiler *pFiler) override; /** \details Loads material texture data from the specified filer. \param pFiler [in] Pointer to a filer from where to load material texture data. \param pEntry [in] Entry in which load material texture data. \returns Smart pointer to the loaded material texture data. */ OdGiMaterialTextureDataPtr loadClientMaterialTextureData(OdGsFiler *pFiler, OdGiMaterialTextureEntry *pEntry) override; }; /** \details This class implements streamed device -independent OpenGL vectorizer views. Library: Source code provided. */ class OdGsOpenGLStreamVectorizeView : public OdGsOpenGLVectorizeView , protected OdOpenGLMetafileReaderCallback , public OdOpenGLCheckMarkIface { protected: OdRxObjectPtr m_pTexObject; OdGsOpenGLStreamVectorizeDevice::RasterImageInfo m_procTexInfo; OdGiXformPtr m_pSelectXfm; OdGiConveyorConnector m_mfEntryPoint; bool m_bIsVertsColors; bool m_bDynamicSubEntHlt; bool m_bSecondaryBinding; bool m_bShmClipped; friend class OdOpenGLStreamList; OdOpenGLMetafileWriter m_metaWrite; OdOpenGLMetafileReader m_metaRead; struct LwdDataCache { bool m_bEnabled; // Lineweight enabled int m_nPix; // Number of pixels for lineweight bool m_bForced; // Points lineweight forced bool m_bExtendPoints; // Enable extended lineweights mode for points bool m_bExtendLines; // Enable extended lineweights mode for points bool m_bPerspective; // Perspective mode (coef couldn't be precomputed) double m_dPreCft; // Precomputed ortho coefficient bool m_bPrecomputed; // Enabled if parameters precomputed for current view state OdGeVector3d m_basis[3]; // View basis OdGeVector3d m_xfmBasis[3]; // Xformed basis OdGeMatrix3d m_xfm; // Stored transform LwdDataCache() : m_bEnabled(false), m_nPix(1), m_bForced(false), m_bExtendPoints(true), m_bExtendLines(true) , m_bPerspective(false), m_dPreCft(0.0), m_bPrecomputed(false) { } } m_metaLwd; OdOpenGLLwdStyle m_styleLwd; void beginFaces(GLenum mode, OdGsView::RenderMode rm) override; void endFaces(OdGsView::RenderMode rm) override; void draw_color(ODCOLORREF color) override; void draw_noColorMod(bool bState) override; void draw_linetype(OdOpenGLLinePatt::Entry entry, OdInt32 state, bool isAdaptive = true, double scaleFactor = 1.0) override; void draw_fillStyle(OdOpenGLFillPatt::Entry entry, OdInt32 state) override; void draw_lineStyle(bool bByDefault, OdPs::LineEndStyle capStyle = OdPs::kLesRound, OdPs::LineJoinStyle joinStyle = OdPs::kLjsRound) override; void pushTriangle(double *texCoords, const OdInt32* indices, const OdGeVector3d *n1, const OdGeVector3d *n2, const OdGeVector3d *n3); void updateShmClipping(OdRxObject *pMf); void metafileLineStipple(OdOpenGLLinePatt::Entry entry, OdUInt8 state) override; void metafileFillStipple(OdOpenGLFillPatt::Entry entry, OdUInt8 state) override; const OdOpenGLLinePatt *metafileGetLinePattPtr() const override; const OdOpenGLFillPatt *metafileGetFillPattPtr() const override; public: /** \details Default constructor for the OdGsOpenGLStreamVectorizeView class. */ OdGsOpenGLStreamVectorizeView(); /** \details Destructor for the OdGsOpenGLStreamVectorizeView class. */ ~OdGsOpenGLStreamVectorizeView() override; //DOM-IGNORE-BEGIN OdRxObjectPtr newGsMetafile() override; void beginMetafile(OdRxObject* pMetafile) override; void endMetafile(OdRxObject* pMetafile) override; void playMetafile(const OdRxObject* pMetafile) override; //DOM-IGNORE-END /** \details Saves the specified Metafile (cache) into OdGsFiler object. \param pMetafile [in] Pointer to the GsMetafile. \param pFiler [in] Pointer to the OdGsFiler object. \returns true if saved successfully, false otherwise. */ bool saveMetafile(const OdRxObject* pMetafile, OdGsFiler *pFiler) override; /** \details Loads the Metafile (cache) from OdGsFiler object. \param pFiler [in] Pointer to the OdGsFiler object. \returns true if loaded successfully, false otherwise. */ OdRxObjectPtr loadMetafile(OdGsFiler *pFiler) override; /** \details Saves the specified material cache into OdGsFiler object. \param pMtl [in] Pointer to the material cahce. \param pFiler [in] Pointer to the OdGsFiler object. \returns true if saved successfully, false otherwise. */ bool saveClientMaterialCache(const OdRxObject* pMtl, OdGsFiler *pFiler) override; /** \details Loads the specified material cache from OdGsFiler object. \param pFiler [in] Pointer to the OdGsFiler object. \param pMatItem [in] Pointer to material item. Not used. \returns Smart pointer to the loaded object representing a material cache. */ OdRxObjectPtr loadClientMaterialCache(OdGsFiler *pFiler, OdGiMaterialItem *pMatItem) override; /** \details Saves the specified material texture data into OdGsFilerGSS object. \param pTextureData [in] Pointer to the material texture data. \param pFiler [in] Pointer to the OdGsFilerGSS object. \returns true if saved successfully, false otherwise. */ bool saveClientMaterialTextureData(const OdGiMaterialTextureData *pTextureData, OdGsFiler *pFiler) override; /** \details Loads material texture data from the specified filer. \param pFiler [in] Pointer to a filer from where to load material texture data. \param pEntry [in] Entry in which load material texture data. \returns Smart pointer to the loaded material texture data. */ OdGiMaterialTextureDataPtr loadClientMaterialTextureData(OdGsFiler *pFiler, OdGiMaterialTextureEntry *pEntry) override; /** \details Saves data of a client view to the specified filer. \param pFiler [in] Pointer to a filer where to save view state. \returns true if the state of client view is saved successfully, false otherwise. */ bool saveClientViewState(OdGsFilerGSS *pFiler) const override; /** \details Loads data of a client device from the specified filer. \param pFiler [in] Pointer to a filer from which to read device state. \returns true if the state of client device is loaded successfully, false otherwise. */ bool loadClientViewState(OdGsFilerGSS *pFiler) override; /** \details Begins the view vectorization procedure. */ void beginViewVectorization() override; /** \details Sets viewport's common data before display() call. */ void loadViewport() override; /** \details Draws the frame (border) for the viewport. */ void drawViewportFrame() override; /** \details Ends the view vectorization procedure. */ void endViewVectorization() override; /** \details Outputs polyline data. \param numPoints [in] Number of points in the polyline. \param vertexList [in] Array of vertices that make up the polyline. \sa */ void polylineOut(OdInt32 numPoints, const OdGePoint3d* vertexList) override; /** \details Outputs polyline data. \param numPoints [in] Number of points in the polyline. \param vertexIndexList [in] Array of indices of vertices that make up the polyline. \sa */ void polylineOut(OdInt32 numPoints, const OdInt32* vertexIndexList) override; /** \details Outputs polygon data. \param numPoints [in] Number of points in the polygon. \param vertexList [in] Array of vertices that make up the polygon. \param pNormal [in] Normal vector for the polygon. \sa */ void polygonOut(OdInt32 numPoints, const OdGePoint3d* vertexList, const OdGeVector3d* pNormal) override; bool isSMIndexable(const OdGiEdgeData* edgeData, const OdGiFaceData* faceData, const OdGiVertexData* vertexData, bool bShell); /** \details Processes shell data. \param numVertices [in] Number of vertices. \param vertexList [in] Array of vertices. \param faceListSize [in] Number of entries in faceList. \param faceList [in] Array of numbers that define the faces. \param pEdgeData [in] Pointer to additional edge data. \param pFaceData [in] Pointer to additional face data. \param pVertexData [in] Pointer to additional vertex data. \sa */ void shellProc( OdInt32 numVertices, const OdGePoint3d* vertexList, OdInt32 faceListSize, const OdInt32* faceList, const OdGiEdgeData* pEdgeData = 0, const OdGiFaceData* pFaceData = 0, const OdGiVertexData* pVertexData = 0) override; /** \details Processes mesh data. \param numRows [in] Number of rows. \param numColumns [in] Number of columns. \param vertexList [in] Array of vertices. \param pEdgeData [in] Pointer to additional edge data. \param pFaceData [in] Pointer to additional face data. \param pVertexData [in] Pointer to additional vertex data. \sa */ void meshProc( OdInt32 numRows, OdInt32 numColumns, const OdGePoint3d* vertexList, const OdGiEdgeData* pEdgeData = 0, const OdGiFaceData* pFaceData = 0, const OdGiVertexData* pVertexData = 0) override; void prepareShMFacesGeneration(const OdGiFaceData* pFaceData, OdGsView::RenderMode rm) override; /** \details Outputs a triangle. \param vertices [in] List of 3 numbers that define the vertices in the triangle. \param pNormal [in] Normal vector for this triangle. */ void triangleOut( const OdInt32* vertices, const OdGeVector3d* pNormal ) override; /** \details Releases a texture map. */ void uninitTexture() override; bool isTextureLoaded(const OdGiRasterImage* pImage, bool transparency, ODCOLORREF fgColor, // only if transparency enabled bool secColor, ODCOLORREF bkColor, // only if secColor enabled double brightness, double contrast, double fade, const OdUInt8 *&pData, OdUInt32 &bufSize, const OdUInt8 *&pPalData, OdUInt32 &lutSize) override; void glInitTexture(OdOpenGLAlphaTestType bEnableAlphaTest, GLint glFormat, GLsizei pxWidth, GLsizei pxHeight, const void *pTexture, GLint glFilter, GLint glEnvMode, const OdGeQuaternion &glSPlane, const OdGeQuaternion &glTPlane, OdUInt32 bufSize, bool bBitonal, const void *pPalTexture, OdUInt32 lutSize) override; bool canUseLut() const override; void glBindSecondary(GLint secondBinding, OdUInt32 lutSize); void metafileProcessInitTexture(const OdOpenGLMetafileReaderCallback::RasterImageEntrySet &dataSet, OdRxObject *pData = NULL) override; void metafileProcessUninitTexture() override; /** \details Introduces a shell into this Vectorizer context. \param numVertices [in] Number of vertices. \param vertexList [in] Array of vertices. \param faceListSize [in] Number of entries in faceList. \param faceList [in] Array of numbers that define the faces. \param pEdgeData [in] Pointer to additional edge data. \param pFaceData [in] Pointer to additional face data. \param pVertexData [in] Pointer to additional vertex data. \sa */ void shell( OdInt32 numVertices, const OdGePoint3d* vertexList, OdInt32 faceListSize, const OdInt32* faceList, const OdGiEdgeData* pEdgeData = NULL, const OdGiFaceData* pFaceData = NULL, const OdGiVertexData* pVertexData = NULL) override; /** \details Introduces a mesh into this Vectorizer context. \param numRows [in] Number of rows. \param numColumns [in] Number of columns. \param vertexList [in] Array of vertices. \param pEdgeData [in] Pointer to additional edge data. \param pFaceData [in] Pointer to additional face data. \param pVertexData [in] Pointer to additional vertex data. \sa */ void mesh( OdInt32 numRows, OdInt32 numColumns, const OdGePoint3d* vertexList, const OdGiEdgeData* pEdgeData = NULL, const OdGiFaceData* pFaceData = NULL, const OdGiVertexData* pVertexData = NULL) override; /** \details Processes polypoint data. \param numPoints [in] Number of points. \param vertexList [in] Pointer to an array of vertices. \param pColors [in] Pointer to point colors. \param pTransparency [in] Pointer to point transparency. \param pNormals [in] Array of normal vectors. \param pExtrusions [in] Array of vectors defining extrusions. \param pSubEntMarkers [in] Array of sub-entity markers. \param nPointSize [in] Points size. */ void polypointProc(OdInt32 numPoints, const OdGePoint3d* vertexList, const OdCmEntityColor* pColors, const OdCmTransparency* pTransparency = 0, const OdGeVector3d* pNormals = 0, const OdGeVector3d* pExtrusions = 0, const OdGsMarker* pSubEntMarkers = 0, OdInt32 nPointSize = 0) override; bool useSharedBlockReferences() const override { return true; } /** \details Method that is called when entity traits are modified. */ void onTraitsModified() override; OdUInt8 metafileCheckMarker(OdOpenGLGsMarker gsMarker, bool bPrevState, const OdGsMatrixParam *&pXform) override; void metafileSelectMarker(OdOpenGLGsMarker gsMarker) override; bool useMetafileAsGeometry() const override { return m_bDynamicSubEntHlt; } /** \details Checks whether the DynamicSubEntHlt flag is enabled. \returns true if this flag is enabled, false otherwise. \remarks The subentity highlighting mode provides the ability to cache geometry markers for entity geometry parts. These parts of the entity geometry can be highlighted independently from all other entity geometry. If it is turned on, a subentity marker is stored inside a metafile and the renderer is able to check whether the marked part of the geometry must be highlighted. This property takes effect only if geometry cache is turned on. */ inline bool dynamicSubEntHlt() const { return m_bDynamicSubEntHlt; } OdGiConveyorOutput& outputForMetafileGeometry() override; void setTransformForMetafileGeometry(const OdGeMatrix3d& mtx) override; OdGeMatrix3d getTransformForMetafileGeometry() const override; /** \details Invokes the specified OdGsSelectionReactor object for the specified selection area (or point) in this view. \param pts [in] Array of points. \param numPoints [in] Number of points. \param pReactor [in] Pointer to the reactor. \param mode [in] Selection mode. */ void select(const OdGePoint2d* pts, int nPoints, OdGsSelectionReactor* pReactor, OdGsView::SelectionMode mode) override; OdGiConveyorGeometry &metafileEntryPoint() { return m_mfEntryPoint.geometry(); } /** \details Pushes a transformation matrix for a metafile onto the stack. The resulting transformation is created by multiplying the specified transform matrix by the existing one. This allows you to easily adjust an entity coordinate system. Use the popMetafileTransform() to remove this transform matrix from the stack when you are finished with this transformation. \param xfm [in] Transformation matrix. \param uFlags [in] Metafile transform flags. \remarks This method takes effect only if the passed flags parameter has the OdGsBaseVectorizer::kSharedRefUpdate flag set to true. */ void pushMetafileTransform(const OdGeMatrix3d& mtx, OdUInt32 uFlags = 0) override; /** \details Pops a transformation from the stack. This method should be used after a successful pushMetafileTransform() method call to restore previous transform state. \param uFlags [in] Metafile transform flags. */ void popMetafileTransform(OdUInt32 uFlags = 0) override; #ifdef OD_OGL_ES void metafilePushStencilAttrib(); void metafilePopStencilAttrib(); #endif bool isMappingDelayed() const; /** \details Returns the state of the AlternativeHlt flag. \returns true if this flag is enabled, false otherwise. \remarks This flag instructs vectorizer to use alternative highlighting behavior. Highlighting in alternative highlighting behavior renders as a semi-transparent color on top of highlighted geometry. */ bool metafileForceAlternativeHlt() const override { return forceAlternativeHlt(); } bool matafileImageContentsHlt() const override { return GETBIT(giContext().imageSelectionBehavior(), OdGiContext::kImageHighlight); } // Lineweights void draw_lineweight(OdDb::LineWeight lwLineWeight, GLfloat pixels) override; void draw_lineweight(double dLineWeight, GLfloat pixels) override; void draw_lineweight(OdInt32 nLineWeight, bool bReset) override; double computeLineweightCft(const OdGePoint3d *pOrigin); /** \details Processes a lineweight. \param lwd [in] Lineweight setting. \returns true if lineweight is enabled, false otherwise. */ bool metafileProcessLineweight(const OdOpenGLLwdSetting &lwd) override; /** \details Checks whether lineweight should be enabled for points. \returns true if lineweight should be enabled for points, false otherwise. */ bool metafilePointsLineweight() const override; /** \details Checks whether extended lineweights mode is enabled for points. \returns true if extended lineweights mode is enabled for points, false otherwise. */ bool metafileDrawExtendedPointLineweight() const override; /** \details Checks whether extended lineweights mode is enabled for lines. \returns true if extended lineweights mode is enabled for lines, false otherwise. */ bool metafileDrawExtendedLineLineweight() const override; /** \details Draws an extended line. \param origin [in] Pointer to an array of points that compose the line (consists of 2 points). \param color [in] Pointer to an array of color components. Color can be in RGB or RGBA format. */ void metafileDrawExtendedLine(const OdGePoint3d *origin, const OdUInt8 *color = NULL) override; /** \details Draws extended points. \param origin [in] Pointer to an array of points (consists of 2 points). \param color [in] Pointer to an array of color components. Color can be in RGB or RGBA format. */ void metafileDrawExtendedPoint(const OdGePoint3d *origin, const OdUInt8 *color = NULL) override; /** \details Draws an extended line strip. \param pPoints [in] Pointer to an array of points that compose the line strip (consists of 2 points). \param nPoints [in] Number of points. \param color [in] Pointer to an array of color components. Color can be in RGB or RGBA format. */ void metafileDrawExtendedLineStrip(const OdGePoint3d *pPoints, OdUInt32 nPoints, const OdUInt8 *color = NULL) override; /** \details Returns background color. \param bkgndColor [out] Receives background color value. */ void metafileGetBackgroundColor(ODCOLORREF &bkgndColor) override; /** \details Returns color converter callback associated with this object. \returns Pointer to the OdColorConverterCallback instance. */ OdColorConverterCallback *metafileColorConverter() override; /** \details Sets a lineweight style. \param bByDefault [in] Flag that specifies whether to enable default lineweight style. \param lesStyle [in] Line end style for non-default lineweight style. \param ljsStyle [in] Line join style for non-default lineweight style. */ void metafileLineweightStyle(bool bByDefault, OdPs::LineEndStyle lesStyle = OdPs::kLesRound, OdPs::LineJoinStyle ljsStyle = OdPs::kLjsRound) override; /** \details Returns lineweight style associated with this object. \returns Pointer to the OdOpenGLLwdStyle instance. */ const OdOpenGLLwdStyle *metafileGetLwdStylePtr() const override; //DOM-IGNORE-BEGIN // TtfFonts cache support OdRxObjectPtr tfcNewMetafile(); OdGiConveyorGeometry *tfcBeginMetafile(OdRxObject *pMetafile); void tfcFinalizeMetafile(OdRxObject *pMetafile); void tfcPlayMetafile(const OdGeMatrix3d &xForm, const OdRxObject *pMetafile) const; void metafileTtfText(OdUInt64 fontKeyA, OdUInt64 fontKeyB, const OdUInt32 *pText, OdUInt32 nText, const OdGeMatrix3d &baseTransform, const OdGeVector3d &stepDir) override; //DOM-IGNORE-BEGIN /** \details Processes text data. \param position [in] Position of the text. \param u [in] U parameter of the text. \param v [in] V parameter of the text. \param msg [in] Message string. \param nLength [in] Message length. \param raw [in] Flag that specifies whether escape sequences, such as %%P, are not converted to special characters. \param pStyle [in] Pointer to a text style. \param pExtrusion [in] Extrusion vector. \sa */ void textProc(const OdGePoint3d& position, const OdGeVector3d& u, const OdGeVector3d& v, const OdChar* msg, OdInt32 nLength, bool raw, const OdGiTextStyle* pStyle, const OdGeVector3d* pExtrusion) override; // Materials support protected: // OdGsBaseMaterialView overrides void renderMaterialCache(OdGiMaterialItemPtr pCache, OdDbStub *materialId) override; void metafileProcessMaterial(OdRxObject *pMetafile) override; #ifdef OD_OGL_ENABLETEXBINDING OdRxClassPtr createMaterialDesc() const override; #endif void mapperChangedForDelayCache() override; void playDelayCacheEntry(const DelayCacheEntry *pEntry) override; void delayCacheProcessed(const OdGiDrawable *pDrawable) override; void display(bool update) override; }; #include "TD_PackPop.h" #endif //ODOPENGLSTREAMVECTORIZER_INCLUDED