doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GLWidget.h
Go to the documentation of this file.
1 /*
2 ===========================================================================
3 
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
6 
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
8 
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
21 
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
23 
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25 
26 ===========================================================================
27 */
28 #if !defined(AFX_IDGLWIDGET_H__6399A341_2976_4A6E_87DD_9AF4DBD4C5DB__INCLUDED_)
29 #define AFX_IDGLWIDGET_H__6399A341_2976_4A6E_87DD_9AF4DBD4C5DB__INCLUDED_
30 
31 #if _MSC_VER > 1000
32 #pragma once
33 #endif // _MSC_VER > 1000
34 
36 // idGLWidget window
37 
38 class idGLDrawable {
39 public:
40  idGLDrawable();
42  virtual void draw(int x, int y, int w, int h);
43  virtual void setMedia(const char *name){}
44  virtual void buttonDown(int button, float x, float y);
45  virtual void buttonUp(int button, float x, float y);
46  virtual void mouseMove(float x, float y);
47  virtual int getRealTime() {return realTime;};
48  virtual bool ScreenCoords() {
49  return true;
50  }
51  void SetRealTime(int i) {
52  realTime = i;
53  }
54  virtual void Update() {};
55  float getScale() {
56  return scale;
57  }
58  void setScale(float f) {
59  scale = f;
60  }
61 protected:
62  float scale;
63  float xOffset;
64  float yOffset;
65  float zOffset;
66  float pressX;
67  float pressY;
68  bool handleMove;
69  int button;
70  int realTime;
71 };
72 
74 public:
77  void AddTris(srfTriangles_t *tris, const idMaterial *mat);
78  virtual void draw(int x, int y, int w, int h);
79  void InitWorld();
80 protected:
86 };
87 
89 public:
90 
92  material = mat;
93  scale = 1.0;
94  light = 1.0;
95  worldDirty = true;
96  }
97 
99  material = NULL;
100  light = 1.0;
101  worldDirty = true;
102  realTime = 50;
103  }
104 
106  }
107 
108  virtual void setMedia(const char *name);
109  virtual void draw(int x, int y, int w, int h);
110  virtual void buttonUp(int button){}
111  virtual void buttonDown(int button, float x, float y);
112  virtual void mouseMove(float x, float y);
113  virtual void Update() { worldDirty = true ;};
114 
115 protected:
116  const idMaterial *material;
118  float light;
119 };
120 
122 public:
123 
124  idGLDrawableModel(const char *name);
125 
127 
129 
130  virtual void setMedia(const char *name);
131 
132  virtual void buttonDown(int button, float x, float y);
133  virtual void mouseMove(float x, float y);
134  virtual void draw(int x, int y, int w, int h);
135  virtual void Update() { worldDirty = true ;};
136  virtual bool ScreenCoords() {
137  return false;
138  }
139  void SetSkin( const char *skin );
140 
141 protected:
143  float light;
147  float radius;
149 
150 };
151 
153 public:
154 
156  }
157 
159  }
160 
161  virtual void setMedia(const char *name) {
162  }
163 
164 
165  virtual void draw(int x, int y, int w, int h);
166 
167  virtual int getRealTime() {return 0;};
168 
169 protected:
170 
171 };
172 
173 
174 
175 class idGLWidget : public CWnd
176 {
177 // Construction
178 public:
179  idGLWidget();
180  void setDrawable(idGLDrawable *d);
181 
182 // Attributes
183 public:
184 
185 // Operations
186 public:
187 
188 // Overrides
189  // ClassWizard generated virtual function overrides
190  //{{AFX_VIRTUAL(idGLWidget)
191  public:
192  virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
193  protected:
194  virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
195  //}}AFX_VIRTUAL
196 
197 // Implementation
198 public:
199  virtual ~idGLWidget();
200 
201  // Generated message map functions
202 protected:
205  //{{AFX_MSG(idGLWidget)
206  afx_msg void OnPaint();
207  afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
208  afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
209  afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
210  afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
211  afx_msg void OnMouseMove(UINT nFlags, CPoint point);
212  afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
213  afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
214  afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
215  afx_msg void OnTimer(UINT nIDEvent);
216  afx_msg BOOL OnEraseBkgnd(CDC* pDC);
217  //}}AFX_MSG
218 
219  DECLARE_MESSAGE_MAP()
220 };
221 
224 public:
226  };
228  }
229  void init();
230 protected:
231  //{{AFX_MSG(idGLConsoleWidget)
232  afx_msg void OnPaint();
233  afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
234  afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
235  afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
236  afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
237  //}}AFX_MSG
238  DECLARE_MESSAGE_MAP()
239 
240 };
241 
243 
244 //{{AFX_INSERT_LOCATION}}
245 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
246 
247 #endif // !defined(AFX_IDGLWIDGET_H__6399A341_2976_4A6E_87DD_9AF4DBD4C5DB__INCLUDED_)
idGLDrawable * drawable
Definition: GLWidget.h:203
qhandle_t modelDef
Definition: GLWidget.h:85
virtual ~idGLWidget()
Definition: GLWidget.cpp:109
int qhandle_t
Definition: Lib.h:81
afx_msg void OnLButtonUp(UINT nFlags, CPoint point)
Definition: GLWidget.cpp:715
afx_msg void OnMButtonDown(UINT nFlags, CPoint point)
Definition: GLWidget.cpp:726
virtual void setMedia(const char *name)
Definition: GLWidget.cpp:476
virtual void draw(int x, int y, int w, int h)
Definition: GLWidget.cpp:263
virtual void setMedia(const char *name)
Definition: GLWidget.cpp:517
float scale
Definition: GLWidget.h:62
int realTime
Definition: GLWidget.h:70
CONST PIXELFORMATDESCRIPTOR UINT
Definition: win_qgl.cpp:47
bool handleMove
Definition: GLWidget.h:68
qhandle_t lightDef
Definition: GLWidget.h:84
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:4804
afx_msg void OnMouseMove(UINT nFlags, CPoint point)
Definition: GLWidget.cpp:748
virtual void draw(int x, int y, int w, int h)
Definition: GLWidget.cpp:622
qhandle_t worldModelDef
Definition: GLWidget.h:83
DWORD
Definition: win_qgl.cpp:61
GLenum GLint GLint y
Definition: glext.h:2849
float xOffset
Definition: GLWidget.h:63
virtual void buttonDown(int button, float x, float y)
Definition: GLWidget.cpp:288
float pressY
Definition: GLWidget.h:67
idRenderModel * worldModel
Definition: GLWidget.h:82
Definition: Vector.h:316
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
Definition: GLWidget.cpp:884
const idMaterial * material
Definition: GLWidget.h:113
virtual void buttonDown(int button, float x, float y)
Definition: GLWidget.cpp:202
virtual bool ScreenCoords()
Definition: GLWidget.h:48
float yOffset
Definition: GLWidget.h:64
virtual void draw(int x, int y, int w, int h)
Definition: GLWidget.cpp:354
GLenum GLint x
Definition: glext.h:2849
int i
Definition: process.py:33
#define BOOL
Definition: mprintf.c:71
afx_msg void OnLButtonDown(UINT nFlags, CPoint point)
Definition: GLWidget.cpp:895
virtual int getRealTime()
Definition: GLWidget.h:47
afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
Definition: GLWidget.cpp:868
void setDrawable(idGLDrawable *d)
Definition: GLWidget.cpp:801
virtual bool ScreenCoords()
Definition: GLWidget.h:136
idGLDrawableConsole console
Definition: GLWidget.h:223
virtual void buttonDown(int button, float x, float y)
Definition: GLWidget.cpp:533
virtual int getRealTime()
Definition: GLWidget.h:167
idGLDrawableMaterial(const idMaterial *mat)
Definition: GLWidget.h:91
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:3454
Definition: Vector.h:808
afx_msg void OnPaint()
Definition: GLWidget.cpp:154
~idGLDrawable()
Definition: GLWidget.h:41
afx_msg void OnTimer(UINT nIDEvent)
Definition: GLWidget.cpp:809
virtual void mouseMove(float x, float y)
Definition: GLWidget.cpp:294
afx_msg void OnLButtonDown(UINT nFlags, CPoint point)
Definition: GLWidget.cpp:704
#define NULL
Definition: Lib.h:88
afx_msg void OnPaint()
Definition: GLWidget.cpp:880
afx_msg BOOL OnEraseBkgnd(CDC *pDC)
Definition: GLWidget.cpp:899
virtual void draw(int x, int y, int w, int h)
Definition: GLWidget.cpp:827
float getScale()
Definition: GLWidget.h:55
virtual void setMedia(const char *name)
Definition: GLWidget.h:161
void setScale(float f)
Definition: GLWidget.h:58
float pressX
Definition: GLWidget.h:66
virtual void Update()
Definition: GLWidget.h:135
afx_msg void OnMButtonUp(UINT nFlags, CPoint point)
Definition: GLWidget.cpp:737
virtual void buttonUp(int button, float x, float y)
Definition: GLWidget.cpp:211
void SetRealTime(int i)
Definition: GLWidget.h:51
virtual void Update()
Definition: GLWidget.h:113
Definition: Quat.h:48
virtual void draw(int x, int y, int w, int h)
Definition: GLWidget.cpp:924
void SetSkin(const char *skin)
Definition: GLWidget.cpp:528
virtual void buttonUp(int button)
Definition: GLWidget.h:110
int button
Definition: GLWidget.h:69
tuple f
Definition: idal.py:89
const GLcharARB * name
Definition: glext.h:3629
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, CCreateContext *pContext=NULL)
Definition: GLWidget.cpp:140
afx_msg void OnRButtonUp(UINT nFlags, CPoint point)
Definition: GLWidget.cpp:790
idVec3 lastPress
Definition: GLWidget.h:146
Definition: Str.h:116
virtual void mouseMove(float x, float y)
Definition: GLWidget.cpp:216
virtual BOOL PreCreateWindow(CREATESTRUCT &cs)
Definition: GLWidget.cpp:133
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
Definition: GLWidget.cpp:759
afx_msg void OnRButtonDown(UINT nFlags, CPoint point)
Definition: GLWidget.cpp:779
virtual void mouseMove(float x, float y)
Definition: GLWidget.cpp:546
virtual void Update()
Definition: GLWidget.h:54
idRenderWorld * world
Definition: GLWidget.h:81
float zOffset
Definition: GLWidget.h:65
virtual void setMedia(const char *name)
Definition: GLWidget.h:43
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
Definition: GLWidget.cpp:844
void AddTris(srfTriangles_t *tris, const idMaterial *mat)
Definition: GLWidget.cpp:917
bool initialized
Definition: GLWidget.h:204