//---------------------------------------------------------------------------- // EgalTech 2014-2024 //---------------------------------------------------------------------------- // File : EGrScene.h Data : 16.02.24 Versione : 2.6b4 // Contenuto : Dichiarazione della interfaccia IEGrScene per scena OpenGL. // // // // Modifiche : 13.02.14 DS Creazione modulo. // 16.02.24 DS Aggiunte Set/Get CameraDirOrizzOffset. // //---------------------------------------------------------------------------- #pragma once //---------------------------------------------------------------------------- #include "/EgtDev/Include/EGkPoint3d.h" #include "/EgtDev/Include/EGkBBox3d.h" #include "/EgtDev/Include/EGkPlane3d.h" #include "/EgtDev/Include/EGkColor.h" #include "/EgtDev/Include/EgtNumCollection.h" #define NOMINMAX #include #include class IGeomDB ; class ILogger ; //----------------------- Macro per import/export ---------------------------- #undef EGR_EXPORT #if defined( I_AM_EGR) // da definirsi solo nella DLL #define EGR_EXPORT __declspec( dllexport) #else #define EGR_EXPORT __declspec( dllimport) #endif //---------------------------------------------------------------------------- class IEGrScene { public : // Basic virtual ~IEGrScene( void) {} virtual bool Init( IGeomDB* pGeomDB) = 0 ; virtual bool CreateContext( HDC hDC, int nDriver, bool b2Buff, int nColorBits, int nDepthBits) = 0 ; virtual bool IsValid( void) const = 0 ; virtual std::string GetOpenGLInfo( void) const = 0 ; virtual std::string GetGLSLInfo( void) const = 0 ; virtual std::string GetPixelFormatInfo( void) const = 0 ; virtual IGeomDB* GetGeomDB( void) const = 0 ; virtual bool RedrawWindow( void) = 0 ; virtual bool Resize( int nW, int nH) = 0 ; virtual bool SetBackground( Color colBackTop, Color colBackBottom) = 0 ; virtual bool GetBackground( Color& colBackTop, Color& colBackBottom) = 0 ; virtual bool Draw( void) = 0 ; virtual bool Project( const Point3d& ptWorld, Point3d& ptView) const = 0 ; virtual bool UnProject( const Point3d& ptView, Point3d& ptWorld) const = 0 ; virtual void Destroy( void) = 0 ; // Camera virtual bool SetCenter( const Point3d& ptCenter) = 0 ; virtual bool SetCameraDirOrizzOffset( int nRightStepOffset = 0) = 0 ; virtual bool SetCamera( double dAngVertDeg, double dAngOrizzDeg, double dDist) = 0 ; virtual bool SetCamera( int nDir, double dDist = 0) = 0 ; virtual const Point3d& GetCenter( void) const = 0 ; virtual Point3d GetProjectedCenter( void) const = 0 ; virtual int GetCameraDirOrizzOffset( void) const = 0 ; virtual void GetCamera( double* pdAngVertDeg, double* pdAngOrizzDeg, double* pdDist = nullptr) const = 0 ; virtual int GetCameraDir( void) const = 0 ; virtual const Vector3d& GetCameraUp( void) const = 0 ; virtual void GetOrthoCamParam(double* pdWidth, double* pdHeight, double* pdNear, double* pdFar) const = 0 ; virtual bool PanCamera( const Point3d& ptWinOld, const Point3d& ptWinNew) = 0 ; virtual bool RotateCamera( const Point3d& ptWinOld, const Point3d& ptWinNew) = 0 ; virtual bool ZoomAll( void) = 0 ; virtual bool ZoomObject( int nId) = 0 ; virtual bool ZoomRadius( double dRadius) = 0 ; virtual bool ZoomChange( double dCoeff) = 0 ; virtual bool ZoomOnPoint( const Point3d& ptWin, double dCoeff) = 0 ; virtual bool ZoomWin( const Point3d& ptWin1, const Point3d& ptWin2) = 0 ; // ShowMode virtual bool SetShowMode( int nShowMode) = 0 ; virtual int GetShowMode( void) const = 0 ; virtual void SetShowCurveDirection( bool bShow) = 0 ; virtual bool GetShowCurveDirection( void) const = 0 ; virtual void SetShowTriaAdvanced( bool bAdvanced)= 0 ; virtual bool GetShowTriaAdvanced( void) const = 0 ; virtual void SetShowZmap( int nMode) = 0 ; virtual int GetShowZmap( void) const = 0 ; virtual void SetShowText( int nMode) = 0 ; virtual int GetShowText( void) const = 0 ; // Geometry virtual bool SetExtension( const BBox3d& b3Ext) = 0 ; virtual bool UpdateExtension( void) = 0 ; virtual bool SetMark( Color colMark) = 0 ; virtual bool SetSelSurf( Color colSelSurf) = 0 ; virtual bool SetLineWidth( int nW) = 0 ; // Grid virtual bool SetGridShow( bool bShowGrid, bool bShowFrame) = 0 ; virtual bool SetGridGeo( double dSnapStep, int nMinLineSstep, int nMajLineSstep, int nExtSstep) = 0 ; virtual bool SetGridGeoAdv( double dSnapStep, int nMinLineSstep, int nMajLineSstep, double dXmin, double dXmax, double dYmin, double dYmax) = 0 ; virtual bool SetGridColor( Color colMinLine, Color colMajLine) = 0 ; virtual void GetGridParam( double& dSnapStep, int& nExtStep) const = 0 ; virtual bool GetShowGrid( void) = 0 ; // Glob Frame virtual bool SetGlobFrameShow( bool bShow) = 0 ; // Direct virtual bool SetGeoLineAttribs( Color GLcol) = 0 ; virtual bool SetGeoLine( const Point3d& ptP1, const Point3d& ptP2) = 0 ; virtual bool ResetGeoLine( void) = 0 ; virtual bool SetGeoTriaAttribs( Color GTcol) = 0 ; virtual bool SetGeoTria( const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptP3) = 0 ; virtual bool ResetGeoTria( void) = 0 ; virtual bool SetWinRectAttribs( bool bOutline, Color WRcol) = 0 ; virtual bool SetWinRect( const Point3d& ptWinRectP1, const Point3d& ptWinRectP2) = 0 ; virtual bool ResetWinRect( void) = 0 ; // Select virtual bool Select( const Point3d& ptView, int nW, int nH, int& nSel) = 0 ; virtual bool SetObjFilterForSelect( bool bZerodim, bool bCurve, bool bSurf, bool bVolume, bool bExtra) = 0 ; virtual bool UnselectableAdd( int nId) = 0 ; virtual bool UnselectableRemove( int nId) = 0 ; virtual bool UnselectableClearAll( void) = 0 ; virtual bool UnselectableFind( int nId) = 0 ; virtual bool GetSelectedObjs( INTVECTOR& nIds) const = 0 ; virtual int GetFirstSelectedObj( void) = 0 ; virtual int GetNextSelectedObj( void) = 0 ; virtual double GetSelectedObjWinZ( int nSel = - 1) const = 0 ; virtual double GetSelectedObjMinWinZ( int nSel = - 1) const = 0 ; virtual bool GetPointFromSelect( int nSelId, const Point3d& ptView, Point3d& ptSel, int& nAux) = 0 ; // Snap // anche per lo snap valgono SetObjFilterForSelect e Unselectable* virtual bool GetGraphicSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH, Point3d& ptSel) = 0 ; virtual bool GetGridSnapPointZ( bool bSketch, const Point3d& ptWin, const Point3d& ptGrid, Point3d& ptSel) const = 0 ; virtual int GetLastSnapId( void) const = 0 ; virtual bool GetLastSnapDir( Vector3d& vtDir) const = 0 ; virtual bool GetPlaneSnapPoint( const Point3d& ptWin, const Plane3d& plPlane, Point3d& ptSel) const = 0 ; // Texture virtual bool SetTextureMaxLinPixels( int nMaxLinPix) = 0 ; virtual bool LoadTexture( const std::string& sName, const std::string& sFile, double dMMxPix, double dDimX, double dDimY, int nRepeat) = 0 ; virtual bool UnloadTexture( const std::string& sName) = 0 ; virtual bool UnloadAllTextures( void) = 0 ; virtual bool ExistsTexture( const std::string& sName) const = 0 ; virtual bool GetTexturePixels( const std::string& sName, int& nWidth, int& nHeight) const = 0 ; virtual bool GetTextureImagePixels( const std::string& sName, int& nWidth, int& nHeight) const = 0 ; virtual bool GetTextureDimensions( const std::string& sName, double& dDimX, double& dDimY) const = 0 ; virtual bool ChangeTextureDimensions( const std::string& sName, double dDimX, double dDimY) = 0 ; // Image virtual bool GetImage( int nShowMode, Color colBackTop, Color colBackBottom, int nDestWidth, int nDestHeight, const std::string& sFile) = 0 ; } ; //----------------------------------------------------------------------------- extern "C" { EGR_EXPORT IEGrScene* CreateEGrScene(void) ; } //------------------------ Costanti per tipo di driver OpenGL ---------------- enum OglDriver { OD_SOFT = 1, OD_OLD = 2, OD_NEW = 3} ; //------------------------ Costanti per direzione Camera --------------------- enum CameraDir { CT_NONE = 0, CT_TOP = 1, CT_FRONT = 2, CT_RIGHT = 3, CT_BACK = 4, CT_LEFT = 5, CT_BOTTOM = 6, CT_ISO_SW = 7, CT_ISO_SE = 8, CT_ISO_NE = 9, CT_ISO_NW = 10, CT_CPLANE = 11} ; //------------------------ Costanti per tipo di visualizzazione -------------- enum ShowMode { SM_WIREFRAME = 0, SM_HIDDENLINE = 1, SM_SHADING = 2} ; //------------------------ Costanti per tipo di snap al punto ---------------- enum SnapPoint { SP_NONE = 0, SP_SKETCH = 1, SP_GRID = 2, SP_END = 3, SP_MID = 4, SP_CENTER = 5, SP_CENTROID = 6, SP_NEAR = 7, SP_INTERS = 8, SP_TANG = 9, SP_PERP = 10, SP_MINDIST = 11} ; //------------------------ Costanti per textures ----------------------------- enum TxrRepeat { TXR_CLAMP = 0, TXR_REPEAT = 1, TXR_MIRROR = 2} ; //------------------------ Costanti per tipo visualizz. Zmap ----------------- enum ZmapShowMode { ZSM_SURF = 1, ZSM_LINES = 2, ZSM_NORMALS = 4, ZSM_COLORS = 8} ; //------------------------ Costanti per tipo visualizz. Text ----------------- enum TextShowMode { TXT_OUTLINE = 1, TXT_FILL = 2} ;