-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSphereView.h
More file actions
122 lines (101 loc) · 2.99 KB
/
SphereView.h
File metadata and controls
122 lines (101 loc) · 2.99 KB
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
// SphereView.h : interface of the CSphereView class
#ifndef ___SPHERE_VIEW_H___
#define ___SPHERE_VIEW_H___
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "OpenGLView.h"
#include "SphereDoc.h"
#include "MagicCube.h"
// The struct of light bulb which can be controlled
struct Bulb
{
GLenum LIGHT; // GL_LIGHT*
GLfloat longitude; // 0 ~ 359 degree
GLfloat latitude; // -90 ~ 90 degree
GLfloat radius; // Marked at 0 ~ 2
BOOL isSpot; // Is this bulb a spotlight?
BOOL isMuted; // Is this bulb muted?
};
class CSphereView : public COpenGLView
{
protected: // create from serialization only
CSphereView();
DECLARE_DYNCREATE(CSphereView)
// Attributes
public:
CSphereDoc* GetDocument();
// Operations
public:
float m_xTranslation;
float m_yTranslation;
float m_zTranslation;
float m_xScaling;
float m_yScaling;
float m_zScaling;
float m_xRotation;
float m_yRotation;
BOOL m_yRotationLimit;
CPoint m_LeftDownPos;
BOOL m_LeftButtonDown;
// Colors
float m_ClearColorRed;
float m_ClearColorGreen;
float m_ClearColorBlue;
// Structure of light bulb.
Bulb m_light;
void DrawBulb();
// Instance of main class.
MagicCube m_cube;
CPoint m_pointBegin;
// Do once selection on L/R click.
int Selection(CPoint point);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSphereView)
public:
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 Init();
void Display();
// void DrawTriangle(float *v1, float *v2, float *v3);
// void Subdivide(float *v1, float *v2, float *v3, long depth);
// void NormCrossProd(float v1[3], float v2[3], float out[3]);
// void Normalize(float v[3]);
virtual ~CSphereView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CSphereView)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
// virtual HRESULT accDoDefaultAction(VARIANT varChild);
// void DrawNormSphere(void);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnTimer(UINT_PTR nIDEvent);
};
#ifndef _DEBUG // debug version in MyTestOpenGLView.cpp
inline CSphereDoc* CSphereView::GetDocument()
{ return (CSphereDoc*)m_pDocument; }
#endif
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif