| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
#ifndef _CONTROLPOINTSMANAGER_H_ |
| 38 |
#define _CONTROLPOINTSMANAGER_H_ |
| 39 |
|
| 40 |
class CControlPointsManager |
| 41 |
{ |
| 42 |
protected: |
| 43 |
|
| 44 |
OpenGLBinding *m_pQglTable; |
| 45 |
C2DView *m_p2DView; |
| 46 |
public: |
| 47 |
CControlPointsManager() { m_pQglTable = NULL; m_p2DView = NULL; } |
| 48 |
virtual ~CControlPointsManager() { } |
| 49 |
void Init( C2DView *p2DView, OpenGLBinding *pQglTable ) { m_pQglTable = pQglTable; m_p2DView = p2DView; } |
| 50 |
|
| 51 |
virtual bool OnLButtonDown( int x, int y ) = 0; |
| 52 |
virtual bool OnMouseMove( int x, int y ) = 0; |
| 53 |
virtual bool OnLButtonUp( int x, int y ) = 0; |
| 54 |
|
| 55 |
virtual void render() = 0; |
| 56 |
virtual void Commit() = 0; |
| 57 |
}; |
| 58 |
|
| 59 |
|
| 60 |
class CControlPointsManagerBFace : public CControlPointsManager |
| 61 |
{ |
| 62 |
enum EManagerState { Idle, Drag } ManagerState; |
| 63 |
int m_NumPoints; |
| 64 |
|
| 65 |
CtrlPts_t m_RefPts; |
| 66 |
|
| 67 |
CtrlPts_t *m_pPts; |
| 68 |
|
| 69 |
float m_TM[2][3]; |
| 70 |
|
| 71 |
int m_TexSize[2]; |
| 72 |
|
| 73 |
float m_TransOffset[2]; |
| 74 |
|
| 75 |
int m_iDragPoint; |
| 76 |
|
| 77 |
bool m_bGotAnchor; |
| 78 |
|
| 79 |
int m_iAnchorPoint; |
| 80 |
|
| 81 |
float m_Anchor[2]; |
| 82 |
|
| 83 |
_QERFaceData *m_pFaceData; |
| 84 |
|
| 85 |
public: |
| 86 |
|
| 87 |
CControlPointsManagerBFace() { ManagerState = Idle; } |
| 88 |
virtual ~CControlPointsManagerBFace() { } |
| 89 |
|
| 90 |
void Init( int iPts, CtrlPts_t * Pts, C2DView * p2DView, int TexSize[2], _QERFaceData * pFaceData, OpenGLBinding * pQglTable ); |
| 91 |
|
| 92 |
|
| 93 |
virtual bool OnLButtonDown( int x, int y ); |
| 94 |
virtual bool OnMouseMove( int x, int y ); |
| 95 |
virtual bool OnLButtonUp( int x, int y ); |
| 96 |
|
| 97 |
virtual void render(); |
| 98 |
virtual void Commit(); |
| 99 |
|
| 100 |
private: |
| 101 |
|
| 102 |
void UpdateCtrlPts(); |
| 103 |
void ComputeTransOffset( int i ); |
| 104 |
void XYSpaceForSTSpace( float xy[2], const float st[2] ); |
| 105 |
}; |
| 106 |
|
| 107 |
|
| 108 |
class CControlPointsManagerPatch : public CControlPointsManager |
| 109 |
{ |
| 110 |
enum EManagerState { Idle, Drag } ManagerState; |
| 111 |
|
| 112 |
patchMesh_t* m_pPatch; |
| 113 |
|
| 114 |
patchMesh_t* m_pWorkPatch; |
| 115 |
int m_iDragPoint[2]; |
| 116 |
|
| 117 |
public: |
| 118 |
|
| 119 |
CControlPointsManagerPatch() { ManagerState = Idle; } |
| 120 |
virtual ~CControlPointsManagerPatch() { } |
| 121 |
|
| 122 |
void Init( patchMesh_t* pWorkPatch, C2DView *p2DView, OpenGLBinding *pQglTable, patchMesh_t* pPatch ); |
| 123 |
|
| 124 |
|
| 125 |
virtual bool OnLButtonDown( int x, int y ); |
| 126 |
virtual bool OnMouseMove( int x, int y ); |
| 127 |
virtual bool OnLButtonUp( int x, int y ); |
| 128 |
|
| 129 |
virtual void render(); |
| 130 |
virtual void Commit(); |
| 131 |
}; |
| 132 |
|
| 133 |
#endif |