doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DialogAFView.cpp
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 
29 #include "../../idlib/precompiled.h"
30 #pragma hdrstop
31 
32 #include "../../sys/win32/rc/AFEditor_resource.h"
33 
34 #include "DialogAF.h"
35 #include "DialogAFView.h"
36 
37 // DialogAFView dialog
38 
40  { IDC_CHECK_VIEW_BODIES, "show bodies" },
41  { IDC_CHECK_VIEW_BODYNAMES, "show body names" },
42  { IDC_CHECK_VIEW_BODYMASS, "show body mass" },
43  { IDC_CHECK_VIEW_TOTALMASS, "show total mass" },
44  { IDC_CHECK_VIEW_INERTIATENSOR, "show body inertia tensor" },
45  { IDC_CHECK_VIEW_VELOCITY, "show body velocity" },
46  { IDC_CHECK_VIEW_CONSTRAINTNAMES, "show constraint names" },
47  { IDC_CHECK_VIEW_CONSTRAINTS, "show constraints" },
48  { IDC_CHECK_VIEW_PRIMARYONLY, "show only primary constraints" },
49  { IDC_CHECK_VIEW_LIMITS, "show constraint limits" },
50  { IDC_CHECK_VIEW_CONSTRAINEDBODIES, "show bodies constrained by current constraint (body1 = cyan, body2 = blue)" },
51  { IDC_CHECK_VIEW_TREES, "show tree structures" },
52  { IDC_CHECK_MD5_SKELETON, "show md5 with skeleton" },
53  { IDC_CHECK_MD5_SKELETONONLY, "show only the md5 skeleton" },
54  { IDC_CHECK_LINES_DEPTHTEST, "zbuffer lines" },
55  { IDC_CHECK_LINES_USEARROWS, "use arrows" },
56  { IDC_CHECK_PHYSICS_NOFRICTION, "disable all friction" },
57  { IDC_CHECK_PHYSICS_NOLIMITS, "disable all joint limits" },
58  { IDC_CHECK_PHYSICS_NOGRAVITY, "disable gravity" },
59  { IDC_CHECK_PHYSICS_NOSELFCOLLISION, "disable self collision detection" },
60  { IDC_CHECK_PHYSICS_TIMING, "show performance timings" },
61  { IDC_CHECK_PHYSICS_DRAG_ENTITIES, "drag entities" },
62  { IDC_CHECK_PHYSICS_SHOW_DRAG_SELECTION, "show selection box around the entity selected for dragging" },
63  { 0, NULL }
64 };
65 
66 IMPLEMENT_DYNAMIC(DialogAFView, CDialog)
67 
68 /*
69 ================
70 DialogAFView::DialogAFView
71 ================
72 */
73 DialogAFView::DialogAFView(CWnd* pParent /*=NULL*/)
74  : CDialog(DialogAFView::IDD, pParent)
75 
76 {
77  m_showBodies = cvarSystem->GetCVarBool( "af_showBodies" );
78  m_showBodyNames = cvarSystem->GetCVarBool( "af_showBodyNames" );
79  m_showMass = cvarSystem->GetCVarBool( "af_showMass" );
80  m_showTotalMass = cvarSystem->GetCVarBool( "af_showTotalMass" );
81  m_showInertia = cvarSystem->GetCVarBool( "af_showInertia" );
82  m_showVelocity = cvarSystem->GetCVarBool( "af_showVelocity" );
83  m_showConstraints = cvarSystem->GetCVarBool( "af_showConstraints" );
84  m_showConstraintNames = cvarSystem->GetCVarBool( "af_showConstraintNames" );
85  m_showPrimaryOnly = cvarSystem->GetCVarBool( "af_showPrimaryOnly" );
86  m_showLimits = cvarSystem->GetCVarBool( "af_showLimits" );
87  m_showConstrainedBodies = cvarSystem->GetCVarBool( "af_showConstrainedBodies" );
88  m_showTrees = cvarSystem->GetCVarBool( "af_showTrees" );
89  m_showSkeleton = cvarSystem->GetCVarInteger( "af_showSkel" ) == 1;
90  m_showSkeletonOnly = cvarSystem->GetCVarInteger( "af_showSkel" ) == 2;
91  m_debugLineDepthTest = cvarSystem->GetCVarBool( "r_debugLineDepthTest" );
92  m_debugLineUseArrows = cvarSystem->GetCVarInteger( "r_debugArrowStep" ) != 0;
93  m_noFriction = cvarSystem->GetCVarBool( "af_skipFriction" );
94  m_noLimits = cvarSystem->GetCVarBool( "af_skipLimits" );
95  m_gravity = cvarSystem->GetCVarFloat( "g_gravity" );
96  m_noGravity = ( m_gravity == 0.0f );
97  m_noSelfCollision = cvarSystem->GetCVarBool( "af_skipSelfCollision" );
98  m_showTimings = cvarSystem->GetCVarBool( "af_showTimings" );
99  m_dragEntity = cvarSystem->GetCVarBool( "g_dragEntity" );
100  m_dragShowSelection = cvarSystem->GetCVarBool( "g_dragShowSelection" );
101 
102  Create( IDD_DIALOG_AF_VIEW, pParent );
103  EnableToolTips( TRUE );
104 }
105 
106 /*
107 ================
108 DialogAFView::~DialogAFView
109 ================
110 */
112 }
113 
114 /*
115 ================
116 DialogAFView::DoDataExchange
117 ================
118 */
119 void DialogAFView::DoDataExchange(CDataExchange* pDX) {
120  CDialog::DoDataExchange(pDX);
121  //{{AFX_DATA_MAP(DialogAFView)
122  DDX_Check(pDX, IDC_CHECK_VIEW_BODIES, m_showBodies);
123  DDX_Check(pDX, IDC_CHECK_VIEW_BODYNAMES, m_showBodyNames);
124  DDX_Check(pDX, IDC_CHECK_VIEW_BODYMASS, m_showMass);
125  DDX_Check(pDX, IDC_CHECK_VIEW_TOTALMASS, m_showTotalMass);
127  DDX_Check(pDX, IDC_CHECK_VIEW_VELOCITY, m_showVelocity);
131  DDX_Check(pDX, IDC_CHECK_VIEW_LIMITS, m_showLimits);
133  DDX_Check(pDX, IDC_CHECK_VIEW_TREES, m_showTrees);
134  DDX_Check(pDX, IDC_CHECK_MD5_SKELETON, m_showSkeleton);
139  DDX_Check(pDX, IDC_CHECK_PHYSICS_NOLIMITS, m_noLimits);
140  DDX_Check(pDX, IDC_CHECK_PHYSICS_NOGRAVITY, m_noGravity);
142  DDX_Check(pDX, IDC_CHECK_PHYSICS_TIMING, m_showTimings);
145  //}}AFX_DATA_MAP
146 }
147 
148 /*
149 ================
150 DialogAFView::OnToolHitTest
151 ================
152 */
153 int DialogAFView::OnToolHitTest( CPoint point, TOOLINFO* pTI ) const {
154  CDialog::OnToolHitTest( point, pTI );
155  return DefaultOnToolHitTest( toolTips, this, point, pTI );
156 }
157 
158 BEGIN_MESSAGE_MAP(DialogAFView, CDialog)
159  ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipNotify)
160  ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipNotify)
161  ON_BN_CLICKED(IDC_CHECK_VIEW_BODIES, OnBnClickedCheckViewBodies)
162  ON_BN_CLICKED(IDC_CHECK_VIEW_BODYNAMES, OnBnClickedCheckViewBodynames)
163  ON_BN_CLICKED(IDC_CHECK_VIEW_BODYMASS, OnBnClickedCheckViewBodyMass)
164  ON_BN_CLICKED(IDC_CHECK_VIEW_TOTALMASS, OnBnClickedCheckViewTotalMass)
165  ON_BN_CLICKED(IDC_CHECK_VIEW_INERTIATENSOR, OnBnClickedCheckViewInertiatensor)
166  ON_BN_CLICKED(IDC_CHECK_VIEW_VELOCITY, OnBnClickedCheckViewVelocity)
167  ON_BN_CLICKED(IDC_CHECK_VIEW_CONSTRAINTS, OnBnClickedCheckViewConstraints)
168  ON_BN_CLICKED(IDC_CHECK_VIEW_CONSTRAINTNAMES, OnBnClickedCheckViewConstraintnames)
169  ON_BN_CLICKED(IDC_CHECK_VIEW_PRIMARYONLY, OnBnClickedCheckViewPrimaryonly)
170  ON_BN_CLICKED(IDC_CHECK_VIEW_LIMITS, OnBnClickedCheckViewLimits)
171  ON_BN_CLICKED(IDC_CHECK_VIEW_CONSTRAINEDBODIES, OnBnClickedCheckViewConstrainedBodies)
172  ON_BN_CLICKED(IDC_CHECK_VIEW_TREES, OnBnClickedCheckViewTrees)
173  ON_BN_CLICKED(IDC_CHECK_MD5_SKELETON, OnBnClickedCheckMd5Skeleton)
174  ON_BN_CLICKED(IDC_CHECK_MD5_SKELETONONLY, OnBnClickedCheckMd5Skeletononly)
175  ON_BN_CLICKED(IDC_CHECK_LINES_DEPTHTEST, OnBnClickedCheckLinesDepthtest)
176  ON_BN_CLICKED(IDC_CHECK_LINES_USEARROWS, OnBnClickedCheckLinesUsearrows)
177  ON_BN_CLICKED(IDC_CHECK_PHYSICS_NOFRICTION, OnBnClickedCheckPhysicsNofriction)
178  ON_BN_CLICKED(IDC_CHECK_PHYSICS_NOLIMITS, OnBnClickedCheckPhysicsNolimits)
179  ON_BN_CLICKED(IDC_CHECK_PHYSICS_NOGRAVITY, OnBnClickedCheckPhysicsNogravity)
180  ON_BN_CLICKED(IDC_CHECK_PHYSICS_NOSELFCOLLISION, OnBnClickedCheckPhysicsNoselfcollision)
181  ON_BN_CLICKED(IDC_CHECK_PHYSICS_TIMING, OnBnClickedCheckPhysicsTiming)
182  ON_BN_CLICKED(IDC_CHECK_PHYSICS_DRAG_ENTITIES, OnBnClickedCheckPhysicsDragEntities)
183  ON_BN_CLICKED(IDC_CHECK_PHYSICS_SHOW_DRAG_SELECTION, OnBnClickedCheckPhysicsShowDragSelection)
184 END_MESSAGE_MAP()
185 
186 
187 // DialogAFView message handlers
188 
189 BOOL DialogAFView::OnToolTipNotify( UINT id, NMHDR *pNMHDR, LRESULT *pResult ) {
190  return DefaultOnToolTipNotify( toolTips, id, pNMHDR, pResult );
191 }
192 
194  UpdateData(TRUE);
195  cvarSystem->SetCVarBool( "af_showBodies", m_showBodies != FALSE );
196 }
197 
199  UpdateData(TRUE);
200  cvarSystem->SetCVarBool( "af_showBodyNames", m_showBodyNames != FALSE );
201 }
202 
204  UpdateData(TRUE);
205  cvarSystem->SetCVarBool( "af_showMass", m_showMass != FALSE );
206 }
207 
209  UpdateData(TRUE);
210  cvarSystem->SetCVarBool( "af_showTotalMass", m_showTotalMass != FALSE );
211 }
212 
214  UpdateData(TRUE);
215  cvarSystem->SetCVarBool( "af_showInertia", m_showInertia != FALSE );
216 }
217 
219  UpdateData(TRUE);
220  cvarSystem->SetCVarBool( "af_showVelocity", m_showVelocity != FALSE );
221 }
222 
224  UpdateData(TRUE);
225  cvarSystem->SetCVarBool( "af_showConstraints", m_showConstraints != FALSE );
226 }
227 
229  UpdateData(TRUE);
230  cvarSystem->SetCVarBool( "af_showConstraintNames", m_showConstraintNames != FALSE );
231 }
232 
234  UpdateData(TRUE);
235  cvarSystem->SetCVarBool( "af_showPrimaryOnly", m_showPrimaryOnly != FALSE );
236 }
237 
239  UpdateData(TRUE);
240  cvarSystem->SetCVarBool( "af_showLimits", m_showLimits != FALSE );
241 }
242 
244  UpdateData(TRUE);
245  cvarSystem->SetCVarBool( "af_showConstrainedBodies", m_showConstrainedBodies != FALSE );
246 }
247 
249  UpdateData(TRUE);
250  cvarSystem->SetCVarBool( "af_showTrees", m_showTrees != FALSE );
251 }
252 
254  UpdateData(TRUE);
255  if ( !m_showSkeletonOnly ) {
256  if ( m_showSkeleton ) {
257  cvarSystem->SetCVarInteger( "r_showSkel", 1 );
258  } else {
259  cvarSystem->SetCVarInteger( "r_showSkel", 0 );
260  }
261  }
262 }
263 
265  UpdateData(TRUE);
266  if ( m_showSkeletonOnly ) {
267  cvarSystem->SetCVarInteger( "r_showSkel", 2 );
268  } else {
269  if ( m_showSkeleton ) {
270  cvarSystem->SetCVarInteger( "r_showSkel", 1 );
271  } else {
272  cvarSystem->SetCVarInteger( "r_showSkel", 0 );
273  }
274  }
275 }
276 
278  UpdateData(TRUE);
279  cvarSystem->SetCVarBool( "r_debugLineDepthTest", m_debugLineDepthTest != FALSE );
280 }
281 
283  UpdateData(TRUE);
284  if ( m_debugLineUseArrows ) {
285  cvarSystem->SetCVarInteger( "r_debugArrowStep", 120 );
286  } else {
287  cvarSystem->SetCVarInteger( "r_debugArrowStep", 0 );
288  }
289 }
290 
292  UpdateData(TRUE);
293  cvarSystem->SetCVarBool( "af_skipFriction", m_noFriction != FALSE );
294 }
295 
297  UpdateData(TRUE);
298  cvarSystem->SetCVarBool( "af_skipLimits", m_noLimits != FALSE );
299 }
300 
302  UpdateData(TRUE);
303  cvarSystem->SetCVarFloat( "g_gravity", m_noGravity ? 0.0f : m_gravity );
304 }
305 
307  UpdateData(TRUE);
308  cvarSystem->SetCVarBool( "af_skipSelfCollision", m_noSelfCollision != FALSE );
309 }
310 
312  UpdateData(TRUE);
313  cvarSystem->SetCVarBool( "af_showTimings", m_showTimings != FALSE );
314 }
315 
317  UpdateData(TRUE);
318  cvarSystem->SetCVarBool( "g_dragEntity", m_dragEntity != FALSE );
319 }
320 
322  UpdateData(TRUE);
323  cvarSystem->SetCVarBool( "g_dragShowSelection", m_dragShowSelection != FALSE );
324 }
BOOL DefaultOnToolTipNotify(const toolTip_t *toolTips, UINT id, NMHDR *pNMHDR, LRESULT *pResult)
Definition: StdAfx.cpp:104
BOOL m_showBodyNames
Definition: DialogAFView.h:75
virtual void SetCVarInteger(const char *name, const int value, int flags=0)=0
BOOL m_showConstrainedBodies
Definition: DialogAFView.h:84
#define IDC_CHECK_VIEW_LIMITS
afx_msg void OnBnClickedCheckViewInertiatensor()
#define IDC_CHECK_VIEW_CONSTRAINTNAMES
idCVarSystem * cvarSystem
Definition: CVarSystem.cpp:487
afx_msg void OnBnClickedCheckPhysicsShowDragSelection()
afx_msg void OnBnClickedCheckViewBodyMass()
virtual void SetCVarFloat(const char *name, const float value, int flags=0)=0
afx_msg void OnBnClickedCheckPhysicsNolimits()
#define IDD_DIALOG_AF_VIEW
#define IDC_CHECK_PHYSICS_NOGRAVITY
BOOL m_showPrimaryOnly
Definition: DialogAFView.h:82
afx_msg void OnBnClickedCheckViewConstrainedBodies()
CONST PIXELFORMATDESCRIPTOR UINT
Definition: win_qgl.cpp:47
BOOL m_showVelocity
Definition: DialogAFView.h:79
#define IDC_CHECK_VIEW_CONSTRAINEDBODIES
BOOL m_noGravity
Definition: DialogAFView.h:92
afx_msg void OnBnClickedCheckPhysicsTiming()
virtual int GetCVarInteger(const char *name) const =0
BOOL m_debugLineDepthTest
Definition: DialogAFView.h:88
#define IDC_CHECK_VIEW_PRIMARYONLY
#define IDC_CHECK_PHYSICS_NOLIMITS
afx_msg void OnBnClickedCheckMd5Skeletononly()
#define IDC_CHECK_LINES_USEARROWS
afx_msg void OnBnClickedCheckPhysicsNofriction()
virtual ~DialogAFView()
BOOL m_debugLineUseArrows
Definition: DialogAFView.h:89
afx_msg void OnBnClickedCheckViewTotalMass()
BOOL m_dragShowSelection
Definition: DialogAFView.h:96
#define BOOL
Definition: mprintf.c:71
afx_msg void OnBnClickedCheckLinesDepthtest()
afx_msg void OnBnClickedCheckMd5Skeleton()
BOOL m_showInertia
Definition: DialogAFView.h:78
#define IDC_CHECK_VIEW_CONSTRAINTS
afx_msg void OnBnClickedCheckViewLimits()
virtual void DoDataExchange(CDataExchange *pDX)
BOOL m_showLimits
Definition: DialogAFView.h:83
virtual int OnToolHitTest(CPoint point, TOOLINFO *pTI) const
BOOL m_showTimings
Definition: DialogAFView.h:94
#define NULL
Definition: Lib.h:88
#define IDC_CHECK_LINES_DEPTHTEST
virtual void SetCVarBool(const char *name, const bool value, int flags=0)=0
BOOL m_noFriction
Definition: DialogAFView.h:90
#define IDC_CHECK_PHYSICS_NOFRICTION
BOOL m_showConstraintNames
Definition: DialogAFView.h:81
int DefaultOnToolHitTest(const toolTip_t *toolTips, const CDialog *dialog, CPoint point, TOOLINFO *pTI)
Definition: StdAfx.cpp:75
#define IDC_CHECK_VIEW_INERTIATENSOR
#define IDC_CHECK_MD5_SKELETON
#define IDC_CHECK_VIEW_BODIES
afx_msg void OnBnClickedCheckPhysicsNogravity()
#define IDC_CHECK_VIEW_TOTALMASS
afx_msg void OnBnClickedCheckViewPrimaryonly()
virtual float GetCVarFloat(const char *name) const =0
#define IDC_CHECK_PHYSICS_DRAG_ENTITIES
#define IDC_CHECK_VIEW_BODYMASS
afx_msg void OnBnClickedCheckPhysicsDragEntities()
afx_msg void OnBnClickedCheckViewVelocity()
BOOL m_noSelfCollision
Definition: DialogAFView.h:93
BOOL m_showTotalMass
Definition: DialogAFView.h:77
afx_msg void OnBnClickedCheckViewTrees()
#define IDC_CHECK_PHYSICS_TIMING
tuple f
Definition: idal.py:89
float m_gravity
Definition: DialogAFView.h:99
#define IDC_CHECK_MD5_SKELETONONLY
afx_msg void OnBnClickedCheckViewConstraints()
afx_msg void OnBnClickedCheckViewBodies()
#define IDC_CHECK_PHYSICS_NOSELFCOLLISION
BOOL m_showSkeletonOnly
Definition: DialogAFView.h:87
#define FALSE
Definition: mprintf.c:70
BOOL m_showConstraints
Definition: DialogAFView.h:80
virtual bool GetCVarBool(const char *name) const =0
#define TRUE
Definition: mprintf.c:69
BOOL m_showSkeleton
Definition: DialogAFView.h:86
static toolTip_t toolTips[]
Definition: DialogAFView.h:101
BOOL m_showTrees
Definition: DialogAFView.h:85
#define IDC_CHECK_PHYSICS_SHOW_DRAG_SELECTION
#define IDC_CHECK_VIEW_BODYNAMES
afx_msg void OnBnClickedCheckLinesUsearrows()
#define IDC_CHECK_VIEW_TREES
afx_msg void OnBnClickedCheckViewConstraintnames()
#define IDC_CHECK_VIEW_VELOCITY
afx_msg void OnBnClickedCheckPhysicsNoselfcollision()
BOOL m_dragEntity
Definition: DialogAFView.h:95
afx_msg void OnBnClickedCheckViewBodynames()
BOOL m_showBodies
Definition: DialogAFView.h:74