-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gworld.h
99 lines (78 loc) · 3.67 KB
/
Gworld.h
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#ifndef I_GWORLD__
#define I_GWORLD__
#include "hitlist.h" //searchable objects (for mouse hit testing in global drawing)
#include "afxtempl.h"
enum LINE_TYPE {LT_SHOT,LT_SURFACESHOT, LT_CLOSUREERROR,LT_PASSAGEWIDTH,LT_PASSAGEHEIGHT,LT_WIREFRAME,LT_SURFACE,LT_CROSSSECTION};
typedef struct tagVERTEX
{
float m_fNormal[3];
float m_fPos[3];
} VERTEX;
class CGWorldTriangleGroup
{
protected:
VERTEX * m_pVertices;
COLORREF m_crColor;
int m_iNumVertices;
CGWorldTriangleGroup(int iNumVertices,COLORREF cr);
public:
virtual void DumpToGL() const=0;
void ExpandRectangle(CViewMatrix * pViewPort,CRect * pRect) const;
void SetVertex(int iIndex,VERTEX& vertex);
void SetVertex(int iIndex,const float *pPos);
void SetVertex(int iIndex,const float *pPos,const float * pNormal);
virtual ~CGWorldTriangleGroup();
virtual void DumpToVRML(CArchive&) const=0;
};
class CGWorldTriangleStrip:public CGWorldTriangleGroup
{
public:
CGWorldTriangleStrip(int iNumVertices,COLORREF);
~CGWorldTriangleStrip();
void SetRotationStripNormals();
void SetRectNormals();
void DumpToGL() const;
void DumpToVRML(CArchive&) const;
};
class CGWorldTriangleFan:public CGWorldTriangleGroup
{
public:
CGWorldTriangleFan(int iNumVertices,COLORREF);
~CGWorldTriangleFan();
void DumpToGL() const;
void DumpToVRML(CArchive&) const;
};
// GWorld
//
// THis is a virtual base class for rendering. Rendering is done in two
// derived worlds: GWorldGDI and GWorldGL.
class CGWorld:public CObject
{
public:
CGWorld();
virtual ~CGWorld();
virtual void AddTriangleGroup(CGWorldTriangleGroup * pTriangleGroup)=0;
virtual void AddLineSegment(CPosMatrix& From,CPosMatrix& To,COLORREF crColor,LINE_TYPE lineType)=0;
virtual void AddLabel(CNode *node,CPosMatrix & Pos,LPCSTR szText,BOOL bJunction,COLORREF crColor)=0;
virtual void AddConstraint(CPosMatrix &Pos,COLORREF crColor,CNode * pNode,BOOL bMatchedSearch)=0;
virtual void AddClosureError(CPosMatrix& From,CPosMatrix& To)=0;
virtual void GenerateGeometry(BOOL bFast,BOOL bStereoscopic,BOOL bShowFixedPoints,BOOL bShowClosureErrors)=0;
//Finds the maximum extents of the current geometry
virtual void FindGeometryLimits(CViewMatrix * pViewMatrix,CRect *,BOOL bStereoscopic,BOOL bShowFixedPoints,BOOL bShowClosureErrors)=0;
virtual CPtrArray * GetHitList(CViewMatrix * pViewMatrix,CPoint point,STATIONSHOW show,BOOL bFixedPoints,CRect rViewPort,float fLeft,float fRight,float fTop,float fBottom)=0;
virtual void Empty()=0;
virtual void CompileLists() {}; //Calculate openGL display lists from the geometry added to the GWorld
//VRML Support functions
virtual void WriteGWorldToVRML(CArchive& file,STATIONSHOW SS)=0;
//DXF Support functions
virtual void WriteGWorldToDXF(CStdioFile *pFile, BOOL bShowClosureError, STATIONSHOW bShowStationNames, BOOL bBoxFixedPoints) {};
virtual void DrawText(CDC * dc,CViewMatrix * pViewPort,STATIONSHOW show,CRect rViewPort,float fLeft,float fRight,float fTop,float fBottom)=0;
virtual void DrawTaggedPoints(CDC * dc,CViewMatrix * pViewPort,CRect rViewPort,float fLeft,float fRight,float fTop,float fBottom,BOOL bShowConstraints)=0;
virtual void DrawGDILineSegments(CDC * dc,CViewMatrix * pViewMatrix, CRect rViewPort,float fLeft, float fRight,float fTop,float fBottom,int iLineSize,BOOL bClosureErrors)=0;
//This method is used to dump the internal output of the gworld into some more appropriate data
//structures if that seems appropriate. This is where VRML output is done and where the OpenGL
//world geometry is created. Empty() is the other half of this equation.
virtual void AttachNewDC(CDC * dc) {};
virtual void DetachDC() {};
};
#endif