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 { 37 cd_wire, 38 cd_solid, 39 cd_texture, 40 cd_light, 41 cd_blend 42 } camera_draw_mode; 43 44 typedef struct 45 { 46 int width, height; 47 48 idVec3 origin; 49 idAngles angles; 50 51 camera_draw_mode draw_mode; 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 60 ///////////////////////////////////////////////////////////////////////////// 61 // CCamWnd window 62 class CXYWnd; 63 64 class CCamWnd : public CWnd 65 { 66 DECLARE_DYNCREATE(CCamWnd); 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); 87 CXYWnd* m_pXYFriend; 88 void SetXYFriend(CXYWnd* pWnd); 89 virtual ~CCamWnd(); Camera()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 ); GetRenderMode()104 bool GetRenderMode() { 105 return renderMode; 106 } GetRebuildMode()107 bool GetRebuildMode() { 108 return rebuildMode; 109 } GetEntityMode()110 bool GetEntityMode() { 111 return entityMode; 112 } GetAnimationMode()113 bool GetAnimationMode() { 114 return animationMode; 115 } GetSelectMode()116 bool GetSelectMode() { 117 return selectMode; 118 } GetSoundMode()119 bool GetSoundMode() { 120 return soundMode; 121 } 122 123 124 bool UpdateRenderEntities(); 125 void MarkWorldDirty(); 126 SetView(const idVec3 & origin,const idAngles & angles)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 146 qhandle_t worldModelDef; 147 idRenderModel *worldModel; // createRawModel of the brush and patch geometry 148 bool worldDirty; 149 bool renderMode; 150 bool rebuildMode; 151 bool entityMode; 152 bool selectMode; 153 bool animationMode; 154 bool soundMode; 155 void FreeRendererState(); 156 void UpdateCaption(); 157 bool BuildBrushRenderData(brush_t *brush); 158 void DrawEntityData(); 159 160 161 camera_t m_Camera; 162 int m_nCambuttonstate; 163 CPoint m_ptButton; 164 CPoint m_ptCursor; 165 CPoint m_ptLastCursor; 166 face_t* m_pSide_select; 167 idVec3 m_vCull1; 168 idVec3 m_vCull2; 169 int m_nCullv1[3]; 170 int m_nCullv2[3]; 171 bool m_bClipMode; 172 idVec3 saveOrg; 173 idAngles saveAng; 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 200 ///////////////////////////////////////////////////////////////////////////// 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_) 206