~ffo/fabathome-model1/stable

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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/*License Notification
Fab@Home operates under the BSD Open Source License

Copyright (c) 2006, Hod Lipson and Evan Malone (evan.malone@cornell.edu) All rights reserved. 

Redistribution and use in source and binary forms, with or without modification, 
are permitted provided that the following conditions are met: 

Redistributions of source code must retain the above copyright notice, 
this list of conditions and the following disclaimer. 
Redistributions in binary form must reproduce the above copyright notice, 
this list of conditions and the following disclaimer in the documentation and/or 
other materials provided with the distribution. 
Neither the name of the Fab@Home Project nor the names of its contributors may be 
used to endorse or promote products derived from this software without specific 
prior written permission. 

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// FabAtHomeView.h : interface of the CFabAtHomeView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_FabAtHomeVIEW_H__DBB5840A_C0B1_11D4_A896_002078E0CCA0__INCLUDED_)
#define AFX_FabAtHomeVIEW_H__DBB5840A_C0B1_11D4_A896_002078E0CCA0__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "gl\gl.h"
#include "gl\glu.h"

class CFabAtHomeView : public CView
{
protected: // create from serialization only
	CFabAtHomeView();
	DECLARE_DYNCREATE(CFabAtHomeView)
	void InitGL();
    BOOL bSetupPixelFormat(void);
	void ResetView(void); //reset the view to its initial condition
    void DrawScene(void);
	void DrawStatusInfo( CDC* pDC ); //display status of physical printer
	void SetViewTransformation();
	void DrawMainAxes(double size);
	void UpdatePerspective();
	void UpdateCurrentLayer();
	void Pick(UINT nFlags, CPoint point);

// Attributes
public:
	static bool ReportGLError(CString& note, CStdioFile *pFile = NULL);
	CFabAtHomeDoc* GetDocument();

	double		m_fov; // field of view (degree)
	HGLRC		hrc;
	CRect		m_oldRect;
	float		m_fRadius;
	CClientDC	*m_pDC;
	double		scale;

	bool		bRolling;
	bool		bPanning;
	CPoint		startPoint;
	CVec		eye;
	CVec		view;
	CVec		up;
	GLdouble	rotmat[16];
	GLdouble	rotmat0[16];

	bool bShowPrinter;
	bool bShowModel;
	bool bShowPaths;
	bool bShowTrace;
	bool bShowStatus;
	bool bShowTool;
	bool bShaded;
	bool bShowCommanded; // show commanded positions vs show "real-time"
	int firstlayer, lastlayer;
	bool bModelNormals;
	bool bPathNormals;
	bool bFollowCurrentLayer;
protected:
	UINT m_uiTimer;
	DWORD m_dwTimerPeriod; //period for view update timer
	CMutex m_mutAccess; //mutex for thread safety
	bool m_bDrawing; //flag to indicate drawing in progress

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CFabAtHomeView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual void OnInitialUpdate();
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL

// Implementation
public:
	void SetLighting();
	virtual ~CFabAtHomeView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CFabAtHomeView)
	afx_msg void OnDestroy();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnViewShaded();
	afx_msg void OnUpdateViewShaded(CCmdUI* pCmdUI);
	afx_msg void OnViewShowpaths();
	afx_msg void OnUpdateViewShowpaths(CCmdUI* pCmdUI);
	afx_msg void OnViewShowmodel();
	afx_msg void OnUpdateViewShowmodel(CCmdUI* pCmdUI);
	afx_msg void OnViewNextpath();
	afx_msg void OnViewPreviouspath();
	afx_msg void OnViewAllpaths();
	afx_msg void OnUpdateViewNextpath(CCmdUI* pCmdUI);
	afx_msg void OnUpdateViewAllpaths(CCmdUI* pCmdUI);
	afx_msg void OnUpdateViewPreviouspath(CCmdUI* pCmdUI);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnViewShowtool();
	afx_msg void OnUpdateViewShowtool(CCmdUI* pCmdUI);
	afx_msg void OnViewNormals();
	afx_msg void OnUpdateViewNormals(CCmdUI* pCmdUI);
	afx_msg void OnViewModelnormals();
	afx_msg void OnUpdateViewModelnormals(CCmdUI* pCmdUI);
	afx_msg void OnViewPathnormals();
	afx_msg void OnUpdateViewPathnormals(CCmdUI* pCmdUI);
	afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnViewShowstatus();
	afx_msg void OnUpdateViewShowstatus(CCmdUI *pCmdUI);
	afx_msg void OnViewShowcommanded();
	afx_msg void OnUpdateViewShowcommanded(CCmdUI *pCmdUI);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnViewZoomin();
	afx_msg void OnViewZoomout();
	afx_msg void OnViewCurrentpath();
	afx_msg void OnUpdateViewCurrentpath(CCmdUI *pCmdUI);
	afx_msg void OnViewResetview();
	afx_msg void OnViewShowprinter();
	afx_msg void OnUpdateViewShowprinter(CCmdUI *pCmdUI);
	afx_msg void OnViewShowtrace();
	afx_msg void OnUpdateViewShowtrace(CCmdUI *pCmdUI);
};

#ifndef _DEBUG  // debug version in FabAtHomeView.cpp
inline CFabAtHomeDoc* CFabAtHomeView::GetDocument()
   { return (CFabAtHomeDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_FabAtHomeVIEW_H__DBB5840A_C0B1_11D4_A896_002078E0CCA0__INCLUDED_)