diff --git a/EGkFrame3d.h b/EGkFrame3d.h index 21b2fe0..ea5196d 100644 --- a/EGkFrame3d.h +++ b/EGkFrame3d.h @@ -46,14 +46,22 @@ class EGK_EXPORT Frame3d bool Invert( void) ; bool ToGlob( const Frame3d& frRef) ; bool ToLoc( const Frame3d& frRef) ; - const Frame3d& operator*=( const Frame3d& frRef) { this->ToGlob( frRef) ; return *this ;} - const Frame3d& operator/=( const Frame3d& frRef) { this->ToLoc( frRef) ; return *this ;} - int GetType( void) const { return m_nType ;} - int GetZType( void) const { return m_nZType ;} - const Point3d& Orig( void) const { return m_ptOrig ;} - const Vector3d& VersX( void) const { return m_vtVersX ;} - const Vector3d& VersY( void) const { return m_vtVersY ;} - const Vector3d& VersZ( void) const { return m_vtVersZ ;} + const Frame3d& operator*=( const Frame3d& frRef) + { this->ToGlob( frRef) ; return *this ;} + const Frame3d& operator/=( const Frame3d& frRef) + { this->ToLoc( frRef) ; return *this ;} + int GetType( void) const + { return m_nType ;} + int GetZType( void) const + { return m_nZType ;} + const Point3d& Orig( void) const + { return m_ptOrig ;} + const Vector3d& VersX( void) const + { return m_vtVersX ;} + const Vector3d& VersY( void) const + { return m_vtVersY ;} + const Vector3d& VersZ( void) const + { return m_vtVersZ ;} bool GetRotationsCAC1( double& dAngC, double& dAngA, double& dAngC1) const ; private : diff --git a/EGkGeoObj.h b/EGkGeoObj.h index e8b7e5d..a2da912 100644 --- a/EGkGeoObj.h +++ b/EGkGeoObj.h @@ -18,6 +18,7 @@ #include "/EgtDev/Include/EGkFrame3d.h" #include "/EgtDev/Include/EGkBBox3d.h" #include "/EgtDev/Include/EGkGeoObjType.h" +#include "/EgtDev/Include/EGkObjGraphics.h" #include //----------------------- Macro per import/export ---------------------------- @@ -48,6 +49,8 @@ class __declspec( novtable) IGeoObj virtual bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) = 0 ; virtual bool ToGlob( const Frame3d& frRef) = 0 ; virtual bool ToLoc( const Frame3d& frRef) = 0 ; + virtual void SetObjGraphics( IObjGraphics* pOGr) ; + virtual IObjGraphics* GetObjGraphics( void) ; } ; //----------------------------------------------------------------------------- diff --git a/EGkGeomDB.h b/EGkGeomDB.h index 85d0bda..3e1808d 100644 --- a/EGkGeomDB.h +++ b/EGkGeomDB.h @@ -14,6 +14,7 @@ #pragma once #include "/EgtDev/Include/EGkGdbConst.h" +#include "/EgtDev/Include/EGkGeoFrame3d.h" #include "/EgtDev/Include/EGkGeoObj.h" #include "/EgtDev/Include/EGtILogger.h" #include @@ -40,7 +41,8 @@ class __declspec( novtable) IGeomDB virtual int AddGeoObj( int nId, int nParentId, IGeoObj* pGeoObj) = 0 ; virtual GdbType GetGdbType( int nId) const = 0 ; virtual IGeoObj* GetGeoObj( int nId) = 0 ; - virtual Frame3d* GetGroupFrame( int nId) = 0 ; + virtual IGeoFrame3d* GetGeoFrame( int nId) = 0 ; + virtual bool GetGroupFrame( int nId, Frame3d& frGlob) = 0 ; virtual bool GetGroupGlobFrame( int nId, Frame3d& frGlob) = 0 ; virtual int GetParentId( int nId) = 0 ; virtual bool GetGlobFrame( int nId, Frame3d& frGlob) = 0 ; diff --git a/EGkPoint3d.h b/EGkPoint3d.h index 7cb1c24..651fa78 100644 --- a/EGkPoint3d.h +++ b/EGkPoint3d.h @@ -40,6 +40,10 @@ class EGK_EXPORT Point3d return *this ; } public : + bool IsSmall( void) const + { return ( ( x * x + y * y + z * z) < ( EPS_SMALL * EPS_SMALL)) ; } + bool IsZero( void) const + { return ( ( x * x + y * y + z * z) < ( EPS_ZERO * EPS_ZERO)) ; } const Point3d& operator +=( const Vector3d& vtV) { this->x += vtV.x ; this->y += vtV.y ; this->z += vtV.z ; return *this ; } const Point3d& operator -=( const Vector3d& vtV) diff --git a/EGkPolyLine.h b/EGkPolyLine.h index 74b601e..7e97508 100644 --- a/EGkPolyLine.h +++ b/EGkPolyLine.h @@ -16,42 +16,49 @@ #include "/EgtDev/Include/EGkPoint3d.h" #include "/EgtDev/Include/EGkGeoCollection.h" +//----------------------- Macro per import/export ---------------------------- +#undef EGK_EXPORT +#if defined( I_AM_EGK) // da definirsi solo nella DLL + #define EGK_EXPORT __declspec( dllexport) +#else + #define EGK_EXPORT __declspec( dllimport) +#endif //----------------------------------------------------------------------------- class PolyLine { public : - PolyLine( void) ; - ~PolyLine( void) ; - bool AddUPoint( double dPar, const Point3d& ptP) ; - bool EraseFirstUPoint( void) ; - bool AddOffsetToU( double dOffset) ; - bool Splice( PolyLine& PL) ; - int GetPointNbr( void) const - { return m_nCount ; } - bool GetFirstUPoint( double* pdPar, Point3d* pptP) const ; - bool GetNextUPoint( double* pdPar, Point3d* pptP) const ; - bool GetFirstU( double& dPar) const - { return GetFirstUPoint( &dPar, nullptr) ; } - bool GetNextU( double& dPar) const - { return GetNextUPoint( &dPar, nullptr) ; } - bool GetFirstPoint( Point3d& ptP) const - { return GetFirstUPoint( nullptr, &ptP) ; } - bool GetNextPoint( Point3d& ptP) const - { return GetNextUPoint( nullptr, &ptP) ; } - bool GetLastUPoint( double* pdPar, Point3d* pptP) const ; - bool GetLastU( double& dPar) - { return GetLastUPoint( &dPar, nullptr) ; } - bool GetLastPoint( Point3d& ptP) - { return GetLastUPoint( nullptr, &ptP) ; } - int GetLineNbr( void) const - { return ( m_nCount > 1 ? ( m_nCount - 1) : 0) ; } - bool GetFirstULine( double* pdIni, Point3d* pptIni, double* pdFin, Point3d* pptFin) const ; - bool GetNextULine( double* pdIni, Point3d* pptIni, double* pdFin, Point3d* pptFin) const ; - bool GetFirstLine( Point3d& ptIni, Point3d& ptFin) const - { return GetFirstULine( nullptr, &ptIni, nullptr, &ptFin) ; } - bool GetNextLine( Point3d& ptIni, Point3d& ptFin) const - { return GetNextULine( nullptr, &ptIni, nullptr, &ptFin) ; } + EGK_EXPORT PolyLine( void) ; + EGK_EXPORT ~PolyLine( void) ; + EGK_EXPORT bool AddUPoint( double dPar, const Point3d& ptP) ; + EGK_EXPORT bool EraseFirstUPoint( void) ; + EGK_EXPORT bool AddOffsetToU( double dOffset) ; + EGK_EXPORT bool Splice( PolyLine& PL) ; + EGK_EXPORT int GetPointNbr( void) const + { return m_nCount ; } + EGK_EXPORT bool GetFirstUPoint( double* pdPar, Point3d* pptP) const ; + EGK_EXPORT bool GetNextUPoint( double* pdPar, Point3d* pptP) const ; + EGK_EXPORT bool GetFirstU( double& dPar) const + { return GetFirstUPoint( &dPar, nullptr) ; } + EGK_EXPORT bool GetNextU( double& dPar) const + { return GetNextUPoint( &dPar, nullptr) ; } + EGK_EXPORT bool GetFirstPoint( Point3d& ptP) const + { return GetFirstUPoint( nullptr, &ptP) ; } + EGK_EXPORT bool GetNextPoint( Point3d& ptP) const + { return GetNextUPoint( nullptr, &ptP) ; } + EGK_EXPORT bool GetLastUPoint( double* pdPar, Point3d* pptP) const ; + EGK_EXPORT bool GetLastU( double& dPar) + { return GetLastUPoint( &dPar, nullptr) ; } + EGK_EXPORT bool GetLastPoint( Point3d& ptP) + { return GetLastUPoint( nullptr, &ptP) ; } + EGK_EXPORT int GetLineNbr( void) const + { return ( m_nCount > 1 ? ( m_nCount - 1) : 0) ; } + EGK_EXPORT bool GetFirstULine( double* pdIni, Point3d* pptIni, double* pdFin, Point3d* pptFin) const ; + EGK_EXPORT bool GetNextULine( double* pdIni, Point3d* pptIni, double* pdFin, Point3d* pptFin) const ; + EGK_EXPORT bool GetFirstLine( Point3d& ptIni, Point3d& ptFin) const + { return GetFirstULine( nullptr, &ptIni, nullptr, &ptFin) ; } + EGK_EXPORT bool GetNextLine( Point3d& ptIni, Point3d& ptFin) const + { return GetNextULine( nullptr, &ptIni, nullptr, &ptFin) ; } private : int m_nCount ; diff --git a/EGrDllMain.h b/EGrDllMain.h new file mode 100644 index 0000000..2d3ba68 --- /dev/null +++ b/EGrDllMain.h @@ -0,0 +1,26 @@ +//---------------------------------------------------------------------------- +// EgalTech 2014-2014 +//---------------------------------------------------------------------------- +// File : EgrDllMain.h Data : 13.02.14 Versione : 1.5b1 +// Contenuto : Prototipi funzioni generali della DLL. +// +// +// +// Modifiche : 13.02.14 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + + +//----------------------- 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 + +//----------------------------------------------------------------------------- +EGR_EXPORT const char* GetEGrVersion( void) ; diff --git a/EGrScene.h b/EGrScene.h new file mode 100644 index 0000000..0448809 --- /dev/null +++ b/EGrScene.h @@ -0,0 +1,86 @@ +//---------------------------------------------------------------------------- +// EgalTech 2013-2014 +//---------------------------------------------------------------------------- +// File : EGrScene.h Data : 13.02.14 Versione : 1.5b1 +// Contenuto : Dichiarazione della interfaccia IEGrScene per scena OpenGL. +// +// +// +// Modifiche : 13.02.14 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + +//---------------------------------------------------------------------------- +#include "/EgtDev/Include/EGkPoint3d.h" +#include "/EgtDev/Include/EGkBBox3d.h" +#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, ILogger* pLogger) = 0 ; + virtual bool CreateContext( HDC hDC, int nDriver, bool b2Buff, int nColorBits, int nDepthBits) = 0 ; + virtual bool IsValid( void) = 0 ; + virtual std::string GetOpenGLInfo( void) = 0 ; + virtual std::string GetGLSLInfo( void) = 0 ; + virtual std::string GetPixelFormatInfo( void) = 0 ; + virtual bool Reshape( int nW, int nH) = 0 ; + virtual bool SetExtension( const BBox3d& b3Ext) = 0 ; + virtual bool Prepare( void) = 0 ; + virtual bool Draw( void) = 0 ; + virtual bool Project( const Point3d& ptWorld, Point3d& ptView) = 0 ; + virtual bool UnProject( const Point3d& ptView, Point3d& ptWorld) = 0 ; + virtual void Destroy( void) = 0 ; + // Camera + virtual bool SetCenter( const Point3d& ptCenter) = 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) = 0 ; + virtual Point3d GetProjectedCenter( void) = 0 ; + virtual void GetCamera( double* pdAngVertDeg, double* pdAngOrizzDeg, double* pdDist = nullptr) = 0 ; + virtual int GetCameraDir( void) = 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 ZoomChange( double dCoeff) = 0 ; + virtual bool ZoomOnPoint( const Point3d& ptWin, double dCoeff) = 0 ; +} ; + +//----------------------------------------------------------------------------- +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} ; diff --git a/EgkObjGraphics.h b/EgkObjGraphics.h new file mode 100644 index 0000000..f079d90 --- /dev/null +++ b/EgkObjGraphics.h @@ -0,0 +1,23 @@ +//---------------------------------------------------------------------------- +// EgalTech 2014-2014 +//---------------------------------------------------------------------------- +// File : EgkObjGraphics.h Data : 11.02.14 Versione : 1.5b2 +// Contenuto : Dichiarazione della interfaccia IObjGraphics. +// +// +// +// Modifiche : 11.02.14 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + + +//---------------------------------------------------------------------------- +class __declspec( novtable) IObjGraphics +{ + public : + ~IObjGraphics( void) {} + virtual void Invalidate( void) = 0 ; +} ;