doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CamWnd.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_CAMWND_H__44B4BA03_781B_11D1_B53C_00AA00A410FC__INCLUDED_)
29 #define AFX_CAMWND_H__44B4BA03_781B_11D1_B53C_00AA00A410FC__INCLUDED_
30 
31 #if _MSC_VER >= 1000
32 #pragma once
33 #endif // _MSC_VER >= 1000
34 
35 typedef enum
36 {
43 
44 typedef struct
45 {
46  int width, height;
47 
50 
52 
53  idVec3 color; // background
54 
55  idVec3 forward, right, up; // move matrix
56  idVec3 vup, vpn, vright; // view matrix
57 } camera_t;
58 
59 
61 // CCamWnd window
62 class CXYWnd;
63 
64 class CCamWnd : public CWnd
65 {
67 // Construction
68 public:
69  CCamWnd();
70 
71 // Attributes
72 public:
73 
74 // Operations
75 public:
76 
77 // Overrides
78  // ClassWizard generated virtual function overrides
79  //{{AFX_VIRTUAL(CCamWnd)
80  protected:
81  virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
82  //}}AFX_VIRTUAL
83 
84 // Implementation
85 public:
86  void ShiftTexture_BrushPrimit(face_t *f, int x, int y);
88  void SetXYFriend(CXYWnd* pWnd);
89  virtual ~CCamWnd();
90  camera_t& Camera(){return m_Camera;};
91  void Cam_MouseControl(float dtime);
92  void Cam_ChangeFloor(bool up);
93  void BuildRendererState();
94  void ToggleRenderMode();
95  void ToggleRebuildMode();
96  void ToggleEntityMode();
97  void ToggleSelectMode();
98  void ToggleAnimationMode();
99  void ToggleSoundMode();
100  void SetProjectionMatrix();
101  void UpdateCameraView();
102 
103  void BuildEntityRenderState( entity_t *ent, bool update );
104  bool GetRenderMode() {
105  return renderMode;
106  }
107  bool GetRebuildMode() {
108  return rebuildMode;
109  }
110  bool GetEntityMode() {
111  return entityMode;
112  }
114  return animationMode;
115  }
116  bool GetSelectMode() {
117  return selectMode;
118  }
119  bool GetSoundMode() {
120  return soundMode;
121  }
122 
123 
124  bool UpdateRenderEntities();
125  void MarkWorldDirty();
126 
127  void SetView( const idVec3 &origin, const idAngles &angles ) {
128  m_Camera.origin = origin;
129  m_Camera.angles = angles;
130  }
131 
132 protected:
133  void Cam_Init();
134  void Cam_BuildMatrix();
135  void Cam_PositionDrag();
136  void Cam_MouseLook();
137  void Cam_MouseDown(int x, int y, int buttons);
138  void Cam_MouseUp (int x, int y, int buttons);
139  void Cam_MouseMoved (int x, int y, int buttons);
140  void InitCull();
141  bool CullBrush (brush_t *b, bool cubicOnly);
142  void Cam_Draw();
143  void Cam_Render();
144 
145  // game renderer interaction
147  idRenderModel *worldModel; // createRawModel of the brush and patch geometry
154  bool soundMode;
155  void FreeRendererState();
156  void UpdateCaption();
157  bool BuildBrushRenderData(brush_t *brush);
158  void DrawEntityData();
159 
160 
163  CPoint m_ptButton;
164  CPoint m_ptCursor;
166  face_t* m_pSide_select;
169  int m_nCullv1[3];
170  int m_nCullv2[3];
174  bool saveValid;
175 
176  // Generated message map functions
177 protected:
178  void OriginalMouseDown(UINT nFlags, CPoint point);
179  void OriginalMouseUp(UINT nFlags, CPoint point);
180  //{{AFX_MSG(CCamWnd)
181  afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
182  afx_msg void OnPaint();
183  afx_msg void OnDestroy();
184  afx_msg void OnClose();
185  afx_msg void OnMouseMove(UINT nFlags, CPoint point);
186  afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
187  afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
188  afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
189  afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
190  afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
191  afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
192  afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
193  afx_msg void OnSize(UINT nType, int cx, int cy);
194  afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
195  afx_msg void OnTimer(UINT nIDEvent);
196  //}}AFX_MSG
197  DECLARE_MESSAGE_MAP()
198 };
199 
201 
202 //{{AFX_INSERT_LOCATION}}
203 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
204 
205 #endif // !defined(AFX_CAMWND_H__44B4BA03_781B_11D1_B53C_00AA00A410FC__INCLUDED_)
camera_draw_mode
Definition: CamWnd.h:35
afx_msg void OnMButtonUp(UINT nFlags, CPoint point)
Definition: CamWnd.cpp:300
idVec3 up
Definition: CamWnd.h:55
int qhandle_t
Definition: Lib.h:81
int m_nCambuttonstate
Definition: CamWnd.h:162
bool GetSoundMode()
Definition: CamWnd.h:119
qhandle_t worldModelDef
Definition: CamWnd.h:146
CCamWnd()
Definition: CamWnd.cpp:76
idVec3 color
Definition: CamWnd.h:53
bool entityMode
Definition: CamWnd.h:151
bool GetEntityMode()
Definition: CamWnd.h:110
CPoint m_ptLastCursor
Definition: CamWnd.h:165
CONST PIXELFORMATDESCRIPTOR UINT
Definition: win_qgl.cpp:47
idRenderModel * worldModel
Definition: CamWnd.h:147
void Cam_Init()
Definition: CamWnd.cpp:425
void SetView(const idVec3 &origin, const idAngles &angles)
Definition: CamWnd.h:127
bool BuildBrushRenderData(brush_t *brush)
idVec3 vup
Definition: CamWnd.h:56
GLenum GLint GLint y
Definition: glext.h:2849
bool renderMode
Definition: CamWnd.h:149
void BuildEntityRenderState(entity_t *ent, bool update)
Definition: CamWnd.cpp:1237
void UpdateCaption()
Definition: CamWnd.cpp:1868
bool UpdateRenderEntities()
Definition: CamWnd.cpp:1805
camera_t & Camera()
Definition: CamWnd.h:90
Definition: Vector.h:316
virtual BOOL PreCreateWindow(CREATESTRUCT &cs)
Definition: CamWnd.cpp:151
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
Definition: CamWnd.cpp:187
void SetProjectionMatrix()
Definition: CamWnd.cpp:894
idAngles angles
Definition: CamWnd.h:49
afx_msg void OnLButtonUp(UINT nFlags, CPoint point)
Definition: CamWnd.cpp:284
GLdouble right
Definition: qgl.h:273
void SetXYFriend(CXYWnd *pWnd)
Definition: CamWnd.cpp:224
void ShiftTexture_BrushPrimit(face_t *f, int x, int y)
Definition: CamWnd.cpp:1175
bool worldDirty
Definition: CamWnd.h:148
GLenum GLint x
Definition: glext.h:2849
camera_t m_Camera
Definition: CamWnd.h:161
#define BOOL
Definition: mprintf.c:71
idVec3 m_vCull2
Definition: CamWnd.h:168
virtual ~CCamWnd()
Definition: CamWnd.cpp:97
void ToggleSelectMode()
Definition: CamWnd.cpp:1965
afx_msg void OnSize(UINT nType, int cx, int cy)
Definition: CamWnd.cpp:1151
camera_draw_mode draw_mode
Definition: CamWnd.h:51
CPoint m_ptCursor
Definition: CamWnd.h:164
void Cam_PositionDrag()
Definition: CamWnd.cpp:517
void ToggleEntityMode()
Definition: CamWnd.cpp:1918
Definition: CamWnd.h:64
void BuildRendererState()
Definition: CamWnd.cpp:1707
bool m_bClipMode
Definition: CamWnd.h:171
void ToggleRenderMode()
Definition: CamWnd.cpp:1894
void Cam_MouseLook()
Definition: CamWnd.cpp:530
bool CullBrush(brush_t *b, bool cubicOnly)
Definition: CamWnd.cpp:742
void FreeRendererState()
Definition: CamWnd.cpp:1828
void DrawEntityData()
Definition: CamWnd.cpp:1992
bool GetRenderMode()
Definition: CamWnd.h:104
int m_nCullv2[3]
Definition: CamWnd.h:170
bool GetAnimationMode()
Definition: CamWnd.h:113
afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
Definition: CamWnd.cpp:1166
void Cam_MouseControl(float dtime)
Definition: CamWnd.cpp:552
bool selectMode
Definition: CamWnd.h:152
face_t * m_pSide_select
Definition: CamWnd.h:166
idVec3 origin
Definition: CamWnd.h:48
Definition: CamWnd.h:37
int m_nCullv1[3]
Definition: CamWnd.h:169
void Cam_MouseUp(int x, int y, int buttons)
Definition: CamWnd.cpp:674
void InitCull()
Definition: CamWnd.cpp:715
afx_msg void OnTimer(UINT nIDEvent)
Definition: CamWnd.cpp:2121
afx_msg void OnMButtonDown(UINT nFlags, CPoint point)
Definition: CamWnd.cpp:292
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct)
Definition: CamWnd.cpp:324
afx_msg void OnRButtonDown(UINT nFlags, CPoint point)
Definition: CamWnd.cpp:308
void Cam_BuildMatrix()
Definition: CamWnd.cpp:439
GLenum GLsizei GLsizei height
Definition: glext.h:2856
void ToggleAnimationMode()
Definition: CamWnd.cpp:1931
idVec3 m_vCull1
Definition: CamWnd.h:167
void MarkWorldDirty()
Definition: CamWnd.cpp:1977
GLubyte GLubyte b
Definition: glext.h:4662
void Cam_MouseDown(int x, int y, int buttons)
Definition: CamWnd.cpp:613
void OriginalMouseDown(UINT nFlags, CPoint point)
Definition: CamWnd.cpp:410
void Cam_Draw()
Definition: CamWnd.cpp:946
afx_msg void OnLButtonDown(UINT nFlags, CPoint point)
Definition: CamWnd.cpp:275
void ToggleRebuildMode()
Definition: CamWnd.cpp:1906
bool saveValid
Definition: CamWnd.h:174
void OriginalMouseUp(UINT nFlags, CPoint point)
Definition: CamWnd.cpp:397
void Cam_MouseMoved(int x, int y, int buttons)
Definition: CamWnd.cpp:683
bool soundMode
Definition: CamWnd.h:154
tuple f
Definition: idal.py:89
void Cam_Render()
Definition: CamWnd.cpp:2055
idAngles saveAng
Definition: CamWnd.h:173
afx_msg void OnDestroy()
Definition: CamWnd.cpp:232
bool animationMode
Definition: CamWnd.h:153
Definition: XYWnd.h:70
int width
Definition: CamWnd.h:46
afx_msg void OnPaint()
Definition: CamWnd.cpp:197
bool GetSelectMode()
Definition: CamWnd.h:116
afx_msg void OnRButtonUp(UINT nFlags, CPoint point)
Definition: CamWnd.cpp:316
idVec3 saveOrg
Definition: CamWnd.h:172
CPoint m_ptButton
Definition: CamWnd.h:163
void UpdateCameraView()
Definition: CamWnd.cpp:2136
bool rebuildMode
Definition: CamWnd.h:150
afx_msg void OnClose()
Definition: CamWnd.cpp:240
void Cam_ChangeFloor(bool up)
Definition: CamWnd.cpp:472
void ToggleSoundMode()
Definition: CamWnd.cpp:1948
CXYWnd * m_pXYFriend
Definition: CamWnd.h:87
DECLARE_DYNCREATE(CCamWnd)
bool GetRebuildMode()
Definition: CamWnd.h:107
afx_msg void OnMouseMove(UINT nFlags, CPoint point)
Definition: CamWnd.cpp:250