aboutsummaryrefslogtreecommitdiffstats
path: root/dev/MinGfx/docs/html/classmingfx_1_1_craft_cam.html
blob: 7e45b5e724222f16209ece2eaa89e77d105c9a04 (plain) (blame)
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
<!-- HTML header for doxygen 1.8.9.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<title>MinGfx Toolkit: mingfx::CraftCam Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">MinGfx Toolkit
   &#160;<span id="projectnumber">1.0</span>
   </div>
   <div id="projectbrief">A minimal library for writing cross-platform (Windows, OSX, linux) graphics programs.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacemingfx.html">mingfx</a></li><li class="navelem"><a class="el" href="classmingfx_1_1_craft_cam.html">CraftCam</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classmingfx_1_1_craft_cam-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">mingfx::CraftCam Class Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>This implements a user interface for controlling the camera with the mouse. </p>
<p>This interface is appropriate for "first person" camera control, as in games like Minecraft.</p>
<p>Use the arrow keys or A,S,W,Z keys to move around in the virtual world. UP/DOWN and W/Z move forward and back. LEFT/RIGHT or A/S rotate your body to face left or right. You can rotate and tilt your head to look left/right/up/down by moving the mouse. In Minecraft, that movement happens whenever you move the mouse, regardless of whether you are holding down a mouse button, but in some games you want to hold the camera still while you use the mouse to draw on the screen or do something else. It's possible to use this interface both ways by calling the MouseMove() function either every time the mouse moves, or only when the mouse is in a dragging mode.</p>
<p>Example usage: </p><div class="fragment"><div class="line"><span class="comment">// Create a global or member variable in your MyGraphicsApp class:</span></div>
<div class="line"><a class="code" href="classmingfx_1_1_craft_cam.html#ae0b0e8d75ffc69c6373a13f1f9c2f171">CraftCam</a> cam_;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="comment">// If you want to always rotate the view with the mouse, use this:</span></div>
<div class="line"><span class="keywordtype">void</span> MyGraphicsApp::OnMouseMove(<span class="keyword">const</span> Point2 &amp;pos, <span class="keyword">const</span> Vector2 &amp;delta) {</div>
<div class="line">   Vector2 delta_ndc = PixelsToNormalizedDeviceCoords(pos);</div>
<div class="line">   cam_.OnMouseMove(delta_ndc);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Alternatively, if you want to only rotate the view when the mouse button is</span></div>
<div class="line"><span class="comment">// held down, use this instead.  Call cam_.OnMouseMove() in either one function</span></div>
<div class="line"><span class="comment">// or the other, but not both!</span></div>
<div class="line"><span class="comment">// void MyGraphicsApp::OnLeftMouseDrag(const Point2 &amp;pos, const Vector2 &amp;delta) {</span></div>
<div class="line"><span class="comment">//     Vector2 delta_ndc = PixelsToNormalizedDeviceCoords(pos);</span></div>
<div class="line"><span class="comment">//     cam_.OnMouseMove(delta_ndc);</span></div>
<div class="line"><span class="comment">// }</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// This tells the camera to simulate walking based on the keyboard keys currently</span></div>
<div class="line"><span class="comment">// pressed.  You need to pass a pointer to the underlying GLFW window created by</span></div>
<div class="line"><span class="comment">// GraphicsApp.</span></div>
<div class="line"><span class="keywordtype">void</span> MyGraphicsApp::UpdateSimulation(<span class="keywordtype">double</span> dt)  {</div>
<div class="line">    cam_.UpdateSimulation(dt, window());</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> MyGraphicsApp::InitOpenGL() {</div>
<div class="line">    cam_.set_view_matrix(Matrix4::lookAt(Point3(0,2,2), Point3(0,2,0), Vector3(0,1,0)););</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> MyGraphicsApp::DrawOpenGL() {</div>
<div class="line">    <span class="comment">// draw your scene using the view matrix from the camera</span></div>
<div class="line">    Matrix4 proj_matrix = Matrix4::perspective(60, aspect_ratio(), 1, 200);</div>
<div class="line">    Matrix4 <a class="code" href="classmingfx_1_1_craft_cam.html#acccdadc08d8d8a0b7b9426f18209ff36">view_matrix</a> = cam_.view_matrix();</div>
<div class="line">    Matrix4 model_matrix = Matrix4::RotateY(to_radians(45.0));</div>
<div class="line">    quick_shapes.DrawCube(model_matrix, view_matirx, proj_matrix, Color(1,1,1));</div>
<div class="line">}</div>
<div class="ttc" id="aclassmingfx_1_1_craft_cam_html_acccdadc08d8d8a0b7b9426f18209ff36"><div class="ttname"><a href="classmingfx_1_1_craft_cam.html#acccdadc08d8d8a0b7b9426f18209ff36">mingfx::CraftCam::view_matrix</a></div><div class="ttdeci">Matrix4 view_matrix()</div><div class="ttdoc">Access the camera view matrix created by the CraftCam interactions via this method and use it to draw...</div></div>
<div class="ttc" id="aclassmingfx_1_1_craft_cam_html_ae0b0e8d75ffc69c6373a13f1f9c2f171"><div class="ttname"><a href="classmingfx_1_1_craft_cam.html#ae0b0e8d75ffc69c6373a13f1f9c2f171">mingfx::CraftCam::CraftCam</a></div><div class="ttdeci">CraftCam()</div><div class="ttdoc">Creates a CraftCam object with an initial view matrix = identity.</div></div>
</div><!-- fragment --> 
<p class="definition">Definition at line <a class="el" href="craft__cam_8h_source.html#l00079">79</a> of file <a class="el" href="craft__cam_8h_source.html">craft_cam.h</a>.</p>
</div>
<p><code>#include &lt;<a class="el" href="craft__cam_8h_source.html">craft_cam.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ae0b0e8d75ffc69c6373a13f1f9c2f171"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_craft_cam.html#ae0b0e8d75ffc69c6373a13f1f9c2f171">CraftCam</a> ()</td></tr>
<tr class="memdesc:ae0b0e8d75ffc69c6373a13f1f9c2f171"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a <a class="el" href="classmingfx_1_1_craft_cam.html" title="This implements a user interface for controlling the camera with the mouse.">CraftCam</a> object with an initial view matrix = identity.  <a href="classmingfx_1_1_craft_cam.html#ae0b0e8d75ffc69c6373a13f1f9c2f171">More...</a><br /></td></tr>
<tr class="separator:ae0b0e8d75ffc69c6373a13f1f9c2f171"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab9e1864b5859c22d27ba809b1ba7a51f"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_craft_cam.html#ab9e1864b5859c22d27ba809b1ba7a51f">CraftCam</a> (const <a class="el" href="classmingfx_1_1_matrix4.html">Matrix4</a> &amp;initial_view_matrix)</td></tr>
<tr class="memdesc:ab9e1864b5859c22d27ba809b1ba7a51f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a <a class="el" href="classmingfx_1_1_craft_cam.html" title="This implements a user interface for controlling the camera with the mouse.">CraftCam</a> object with the supplied initial view matrix.  <a href="classmingfx_1_1_craft_cam.html#ab9e1864b5859c22d27ba809b1ba7a51f">More...</a><br /></td></tr>
<tr class="separator:ab9e1864b5859c22d27ba809b1ba7a51f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a85ef9bebdd1595be1288bc104245f4ff"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_craft_cam.html#a85ef9bebdd1595be1288bc104245f4ff">~CraftCam</a> ()</td></tr>
<tr class="separator:a85ef9bebdd1595be1288bc104245f4ff"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2b7808e489933b117583cf709fa46bc7"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_craft_cam.html#a2b7808e489933b117583cf709fa46bc7">UpdateSimulation</a> (double dt, GLFWwindow *window_ptr)</td></tr>
<tr class="memdesc:a2b7808e489933b117583cf709fa46bc7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Call this from your app's <a class="el" href="classmingfx_1_1_craft_cam.html#a2b7808e489933b117583cf709fa46bc7" title="Call this from your app&#39;s UpdateSimulation() method. This tells the camera to simulate walking based ...">UpdateSimulation()</a> method. This tells the camera to simulate walking based on the keyboard keys currently pressed. You need to pass a pointer to the underlying GLFW window created by <a class="el" href="classmingfx_1_1_graphics_app.html" title="This is the main application base class for the MinGfx Toolkit.">GraphicsApp</a>. Example:  <a href="classmingfx_1_1_craft_cam.html#a2b7808e489933b117583cf709fa46bc7">More...</a><br /></td></tr>
<tr class="separator:a2b7808e489933b117583cf709fa46bc7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8366e9d8e9bb3b048d1dd14af2f76311"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_craft_cam.html#a8366e9d8e9bb3b048d1dd14af2f76311">OnMouseMove</a> (const <a class="el" href="classmingfx_1_1_vector2.html">Vector2</a> &amp;normalized_mouse_delta)</td></tr>
<tr class="memdesc:a8366e9d8e9bb3b048d1dd14af2f76311"><td class="mdescLeft">&#160;</td><td class="mdescRight">Call this from your app's <a class="el" href="classmingfx_1_1_craft_cam.html#a8366e9d8e9bb3b048d1dd14af2f76311" title="Call this from your app&#39;s OnMouseMove() or On*MouseDrag() method. Use OnMouseMove() if you want to al...">OnMouseMove()</a> or On*MouseDrag() method. Use <a class="el" href="classmingfx_1_1_craft_cam.html#a8366e9d8e9bb3b048d1dd14af2f76311" title="Call this from your app&#39;s OnMouseMove() or On*MouseDrag() method. Use OnMouseMove() if you want to al...">OnMouseMove()</a> if you want to always rotate the view with the mouse. Remember to convert the mouse coordinates (usually reported by window managers in pixels) into normalized device coordinates:  <a href="classmingfx_1_1_craft_cam.html#a8366e9d8e9bb3b048d1dd14af2f76311">More...</a><br /></td></tr>
<tr class="separator:a8366e9d8e9bb3b048d1dd14af2f76311"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acccdadc08d8d8a0b7b9426f18209ff36"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmingfx_1_1_matrix4.html">Matrix4</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_craft_cam.html#acccdadc08d8d8a0b7b9426f18209ff36">view_matrix</a> ()</td></tr>
<tr class="memdesc:acccdadc08d8d8a0b7b9426f18209ff36"><td class="mdescLeft">&#160;</td><td class="mdescRight">Access the camera view matrix created by the <a class="el" href="classmingfx_1_1_craft_cam.html" title="This implements a user interface for controlling the camera with the mouse.">CraftCam</a> interactions via this method and use it to draw the geometry in your scence. For example, within <a class="el" href="classmingfx_1_1_graphics_app.html#a5a858fd10651f7617491f37b49dbf8ca" title="Override this to draw graphics using raw OpenGL 2D or 3D graphics calls.">GraphicsApp::DrawUsingOpenGL()</a>, you might have:  <a href="classmingfx_1_1_craft_cam.html#acccdadc08d8d8a0b7b9426f18209ff36">More...</a><br /></td></tr>
<tr class="separator:acccdadc08d8d8a0b7b9426f18209ff36"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a82a8e20596247e2986e5929c1ef7f150"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmingfx_1_1_point3.html">Point3</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_craft_cam.html#a82a8e20596247e2986e5929c1ef7f150">eye</a> ()</td></tr>
<tr class="memdesc:a82a8e20596247e2986e5929c1ef7f150"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the "eye" point (i.e., focal point) of the camera in world space coordinates.  <a href="classmingfx_1_1_craft_cam.html#a82a8e20596247e2986e5929c1ef7f150">More...</a><br /></td></tr>
<tr class="separator:a82a8e20596247e2986e5929c1ef7f150"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2c7546bccfbf986eb9cd0a2784f74859"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmingfx_1_1_vector3.html">Vector3</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_craft_cam.html#a2c7546bccfbf986eb9cd0a2784f74859">look</a> ()</td></tr>
<tr class="memdesc:a2c7546bccfbf986eb9cd0a2784f74859"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the look direction (i.e., -Z axis of the camera matrix) in world space coordinates.  <a href="classmingfx_1_1_craft_cam.html#a2c7546bccfbf986eb9cd0a2784f74859">More...</a><br /></td></tr>
<tr class="separator:a2c7546bccfbf986eb9cd0a2784f74859"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae3d9c7ea9307dbbadaa4b6e2f9933a7b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_craft_cam.html#ae3d9c7ea9307dbbadaa4b6e2f9933a7b">UpdateHeight</a> (float new_y_value)</td></tr>
<tr class="memdesc:ae3d9c7ea9307dbbadaa4b6e2f9933a7b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the y value of the camera (i.e., the height). If you want to set the entire view matrix, then use <a class="el" href="classmingfx_1_1_craft_cam.html#a79a194be8675a0a968f14fe3dcd79da8" title="This is not required, but you may use this if you wish to set an initial view matrix or reset the vie...">set_view_matrix()</a>, but if you just want to update the height, e.g., while walking around a bumpy terrain, then use this.  <a href="classmingfx_1_1_craft_cam.html#ae3d9c7ea9307dbbadaa4b6e2f9933a7b">More...</a><br /></td></tr>
<tr class="separator:ae3d9c7ea9307dbbadaa4b6e2f9933a7b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a79a194be8675a0a968f14fe3dcd79da8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_craft_cam.html#a79a194be8675a0a968f14fe3dcd79da8">set_view_matrix</a> (<a class="el" href="classmingfx_1_1_matrix4.html">Matrix4</a> <a class="el" href="classmingfx_1_1_craft_cam.html#acccdadc08d8d8a0b7b9426f18209ff36">view_matrix</a>)</td></tr>
<tr class="memdesc:a79a194be8675a0a968f14fe3dcd79da8"><td class="mdescLeft">&#160;</td><td class="mdescRight">This is not required, but you may use this if you wish to set an initial view matrix or reset the view matrix.  <a href="classmingfx_1_1_craft_cam.html#a79a194be8675a0a968f14fe3dcd79da8">More...</a><br /></td></tr>
<tr class="separator:a79a194be8675a0a968f14fe3dcd79da8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a93567af7acbae2939d57cfd8a72bcef2"><td class="memItemLeft" align="right" valign="top">float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_craft_cam.html#a93567af7acbae2939d57cfd8a72bcef2">translation_scale</a> ()</td></tr>
<tr class="memdesc:a93567af7acbae2939d57cfd8a72bcef2"><td class="mdescLeft">&#160;</td><td class="mdescRight">This is the scale factor used to speed up / slow down forward/backward translation when walking for the UP / DOWN keys. It defaults to 1.0, smaller values will make the camera walk slower, larger values will speed it up.  <a href="classmingfx_1_1_craft_cam.html#a93567af7acbae2939d57cfd8a72bcef2">More...</a><br /></td></tr>
<tr class="separator:a93567af7acbae2939d57cfd8a72bcef2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a151fde09d08001ee2a615f25ec1acea7"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_craft_cam.html#a151fde09d08001ee2a615f25ec1acea7">set_translation_scale</a> (float s)</td></tr>
<tr class="memdesc:a151fde09d08001ee2a615f25ec1acea7"><td class="mdescLeft">&#160;</td><td class="mdescRight">This is the scale factor used to speed up / slow down forward/backward translation when walking for the UP / DOWN keys. It defaults to 1.0, smaller values will make the camera walk slower, larger values will speed it up.  <a href="classmingfx_1_1_craft_cam.html#a151fde09d08001ee2a615f25ec1acea7">More...</a><br /></td></tr>
<tr class="separator:a151fde09d08001ee2a615f25ec1acea7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9fe22cc3b933b12674a5b8f1b5c834ac"><td class="memItemLeft" align="right" valign="top">float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_craft_cam.html#a9fe22cc3b933b12674a5b8f1b5c834ac">rotation_scale</a> ()</td></tr>
<tr class="memdesc:a9fe22cc3b933b12674a5b8f1b5c834ac"><td class="mdescLeft">&#160;</td><td class="mdescRight">This is the scale factor used to speed up / slow down left/right rotation when walking for the LEFT / RIGHT keys. It defaults to 1.0, smaller values will make the camera turn slower, larger values will speed it up.  <a href="classmingfx_1_1_craft_cam.html#a9fe22cc3b933b12674a5b8f1b5c834ac">More...</a><br /></td></tr>
<tr class="separator:a9fe22cc3b933b12674a5b8f1b5c834ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a352f5a42f6e88d2e599bd5acb42e5831"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_craft_cam.html#a352f5a42f6e88d2e599bd5acb42e5831">set_rotation_scale</a> (float s)</td></tr>
<tr class="memdesc:a352f5a42f6e88d2e599bd5acb42e5831"><td class="mdescLeft">&#160;</td><td class="mdescRight">This is the scale factor used to speed up / slow down left/right rotation when walking for the LEFT / RIGHT keys. It defaults to 1.0, smaller values will make the camera turn slower, larger values will speed it up.  <a href="classmingfx_1_1_craft_cam.html#a352f5a42f6e88d2e599bd5acb42e5831">More...</a><br /></td></tr>
<tr class="separator:a352f5a42f6e88d2e599bd5acb42e5831"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a96ba4a36029ca8234576cbf2791c5ccb"><td class="memItemLeft" align="right" valign="top">float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_craft_cam.html#a96ba4a36029ca8234576cbf2791c5ccb">look_scale</a> ()</td></tr>
<tr class="memdesc:a96ba4a36029ca8234576cbf2791c5ccb"><td class="mdescLeft">&#160;</td><td class="mdescRight">This is the scale factor used to speed up / slow down looking around when moving the head with the mouse. It defaults to 1.0, smaller values will make the camera turn slower, larger values will speed it up.  <a href="classmingfx_1_1_craft_cam.html#a96ba4a36029ca8234576cbf2791c5ccb">More...</a><br /></td></tr>
<tr class="separator:a96ba4a36029ca8234576cbf2791c5ccb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a15092ae5de6920546e3ce79aeb196f44"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_craft_cam.html#a15092ae5de6920546e3ce79aeb196f44">set_look_scale</a> (float s)</td></tr>
<tr class="memdesc:a15092ae5de6920546e3ce79aeb196f44"><td class="mdescLeft">&#160;</td><td class="mdescRight">This is the scale factor used to speed up / slow down looking around when moving the head with the mouse. It defaults to 1.0, smaller values will make the camera turn slower, larger values will speed it up.  <a href="classmingfx_1_1_craft_cam.html#a15092ae5de6920546e3ce79aeb196f44">More...</a><br /></td></tr>
<tr class="separator:a15092ae5de6920546e3ce79aeb196f44"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="ae0b0e8d75ffc69c6373a13f1f9c2f171"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae0b0e8d75ffc69c6373a13f1f9c2f171">&#9670;&nbsp;</a></span>CraftCam() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">mingfx::CraftCam::CraftCam </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Creates a <a class="el" href="classmingfx_1_1_craft_cam.html" title="This implements a user interface for controlling the camera with the mouse.">CraftCam</a> object with an initial view matrix = identity. </p>

</div>
</div>
<a id="ab9e1864b5859c22d27ba809b1ba7a51f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab9e1864b5859c22d27ba809b1ba7a51f">&#9670;&nbsp;</a></span>CraftCam() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">mingfx::CraftCam::CraftCam </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classmingfx_1_1_matrix4.html">Matrix4</a> &amp;&#160;</td>
          <td class="paramname"><em>initial_view_matrix</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Creates a <a class="el" href="classmingfx_1_1_craft_cam.html" title="This implements a user interface for controlling the camera with the mouse.">CraftCam</a> object with the supplied initial view matrix. </p>

</div>
</div>
<a id="a85ef9bebdd1595be1288bc104245f4ff"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a85ef9bebdd1595be1288bc104245f4ff">&#9670;&nbsp;</a></span>~CraftCam()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual mingfx::CraftCam::~CraftCam </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a82a8e20596247e2986e5929c1ef7f150"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a82a8e20596247e2986e5929c1ef7f150">&#9670;&nbsp;</a></span>eye()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classmingfx_1_1_point3.html">Point3</a> mingfx::CraftCam::eye </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the "eye" point (i.e., focal point) of the camera in world space coordinates. </p>

</div>
</div>
<a id="a2c7546bccfbf986eb9cd0a2784f74859"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2c7546bccfbf986eb9cd0a2784f74859">&#9670;&nbsp;</a></span>look()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classmingfx_1_1_vector3.html">Vector3</a> mingfx::CraftCam::look </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the look direction (i.e., -Z axis of the camera matrix) in world space coordinates. </p>

</div>
</div>
<a id="a96ba4a36029ca8234576cbf2791c5ccb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a96ba4a36029ca8234576cbf2791c5ccb">&#9670;&nbsp;</a></span>look_scale()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">float mingfx::CraftCam::look_scale </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This is the scale factor used to speed up / slow down looking around when moving the head with the mouse. It defaults to 1.0, smaller values will make the camera turn slower, larger values will speed it up. </p>

</div>
</div>
<a id="a8366e9d8e9bb3b048d1dd14af2f76311"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8366e9d8e9bb3b048d1dd14af2f76311">&#9670;&nbsp;</a></span>OnMouseMove()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void mingfx::CraftCam::OnMouseMove </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classmingfx_1_1_vector2.html">Vector2</a> &amp;&#160;</td>
          <td class="paramname"><em>normalized_mouse_delta</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Call this from your app's <a class="el" href="classmingfx_1_1_craft_cam.html#a8366e9d8e9bb3b048d1dd14af2f76311" title="Call this from your app&#39;s OnMouseMove() or On*MouseDrag() method. Use OnMouseMove() if you want to al...">OnMouseMove()</a> or On*MouseDrag() method. Use <a class="el" href="classmingfx_1_1_craft_cam.html#a8366e9d8e9bb3b048d1dd14af2f76311" title="Call this from your app&#39;s OnMouseMove() or On*MouseDrag() method. Use OnMouseMove() if you want to al...">OnMouseMove()</a> if you want to always rotate the view with the mouse. Remember to convert the mouse coordinates (usually reported by window managers in pixels) into normalized device coordinates: </p>
<div class="fragment"><div class="line"><span class="keywordtype">void</span> MyGraphicsApp::OnMouseMove(<span class="keyword">const</span> Point2 &amp;pos, <span class="keyword">const</span> Vector2 &amp;delta) {</div>
<div class="line">    Vector2 delta_ndc = PixelsToNormalizedDeviceCoords(pos);</div>
<div class="line">    cam_.OnMouseMove(delta_ndc);</div>
<div class="line">}</div>
</div><!-- fragment --><p> Alternatively, if you want to only rotate the view when the mouse button is held down, use On*MouseDrag() instead: </p><div class="fragment"><div class="line"><span class="keywordtype">void</span> MyGraphicsApp::OnLeftMouseDrag(<span class="keyword">const</span> Point2 &amp;pos, <span class="keyword">const</span> Vector2 &amp;delta) {</div>
<div class="line">    Vector2 delta_ndc = PixelsToNormalizedDeviceCoords(pos);</div>
<div class="line">    cam_.OnMouseMove(delta_ndc);</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a id="a9fe22cc3b933b12674a5b8f1b5c834ac"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9fe22cc3b933b12674a5b8f1b5c834ac">&#9670;&nbsp;</a></span>rotation_scale()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">float mingfx::CraftCam::rotation_scale </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This is the scale factor used to speed up / slow down left/right rotation when walking for the LEFT / RIGHT keys. It defaults to 1.0, smaller values will make the camera turn slower, larger values will speed it up. </p>

</div>
</div>
<a id="a15092ae5de6920546e3ce79aeb196f44"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a15092ae5de6920546e3ce79aeb196f44">&#9670;&nbsp;</a></span>set_look_scale()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void mingfx::CraftCam::set_look_scale </td>
          <td>(</td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>s</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This is the scale factor used to speed up / slow down looking around when moving the head with the mouse. It defaults to 1.0, smaller values will make the camera turn slower, larger values will speed it up. </p>

</div>
</div>
<a id="a352f5a42f6e88d2e599bd5acb42e5831"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a352f5a42f6e88d2e599bd5acb42e5831">&#9670;&nbsp;</a></span>set_rotation_scale()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void mingfx::CraftCam::set_rotation_scale </td>
          <td>(</td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>s</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This is the scale factor used to speed up / slow down left/right rotation when walking for the LEFT / RIGHT keys. It defaults to 1.0, smaller values will make the camera turn slower, larger values will speed it up. </p>

</div>
</div>
<a id="a151fde09d08001ee2a615f25ec1acea7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a151fde09d08001ee2a615f25ec1acea7">&#9670;&nbsp;</a></span>set_translation_scale()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void mingfx::CraftCam::set_translation_scale </td>
          <td>(</td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>s</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This is the scale factor used to speed up / slow down forward/backward translation when walking for the UP / DOWN keys. It defaults to 1.0, smaller values will make the camera walk slower, larger values will speed it up. </p>

</div>
</div>
<a id="a79a194be8675a0a968f14fe3dcd79da8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a79a194be8675a0a968f14fe3dcd79da8">&#9670;&nbsp;</a></span>set_view_matrix()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void mingfx::CraftCam::set_view_matrix </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classmingfx_1_1_matrix4.html">Matrix4</a>&#160;</td>
          <td class="paramname"><em>view_matrix</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This is not required, but you may use this if you wish to set an initial view matrix or reset the view matrix. </p>

</div>
</div>
<a id="a93567af7acbae2939d57cfd8a72bcef2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a93567af7acbae2939d57cfd8a72bcef2">&#9670;&nbsp;</a></span>translation_scale()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">float mingfx::CraftCam::translation_scale </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This is the scale factor used to speed up / slow down forward/backward translation when walking for the UP / DOWN keys. It defaults to 1.0, smaller values will make the camera walk slower, larger values will speed it up. </p>

</div>
</div>
<a id="ae3d9c7ea9307dbbadaa4b6e2f9933a7b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae3d9c7ea9307dbbadaa4b6e2f9933a7b">&#9670;&nbsp;</a></span>UpdateHeight()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void mingfx::CraftCam::UpdateHeight </td>
          <td>(</td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>new_y_value</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets the y value of the camera (i.e., the height). If you want to set the entire view matrix, then use <a class="el" href="classmingfx_1_1_craft_cam.html#a79a194be8675a0a968f14fe3dcd79da8" title="This is not required, but you may use this if you wish to set an initial view matrix or reset the vie...">set_view_matrix()</a>, but if you just want to update the height, e.g., while walking around a bumpy terrain, then use this. </p>

</div>
</div>
<a id="a2b7808e489933b117583cf709fa46bc7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2b7808e489933b117583cf709fa46bc7">&#9670;&nbsp;</a></span>UpdateSimulation()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void mingfx::CraftCam::UpdateSimulation </td>
          <td>(</td>
          <td class="paramtype">double&#160;</td>
          <td class="paramname"><em>dt</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">GLFWwindow *&#160;</td>
          <td class="paramname"><em>window_ptr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Call this from your app's <a class="el" href="classmingfx_1_1_craft_cam.html#a2b7808e489933b117583cf709fa46bc7" title="Call this from your app&#39;s UpdateSimulation() method. This tells the camera to simulate walking based ...">UpdateSimulation()</a> method. This tells the camera to simulate walking based on the keyboard keys currently pressed. You need to pass a pointer to the underlying GLFW window created by <a class="el" href="classmingfx_1_1_graphics_app.html" title="This is the main application base class for the MinGfx Toolkit.">GraphicsApp</a>. Example: </p>
<div class="fragment"><div class="line"><span class="keywordtype">void</span> MyGraphicsApp::UpdateSimulation(<span class="keywordtype">double</span> dt)  {</div>
<div class="line">    cam_.UpdateSimulation(dt, window());</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a id="acccdadc08d8d8a0b7b9426f18209ff36"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acccdadc08d8d8a0b7b9426f18209ff36">&#9670;&nbsp;</a></span>view_matrix()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classmingfx_1_1_matrix4.html">Matrix4</a> mingfx::CraftCam::view_matrix </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Access the camera view matrix created by the <a class="el" href="classmingfx_1_1_craft_cam.html" title="This implements a user interface for controlling the camera with the mouse.">CraftCam</a> interactions via this method and use it to draw the geometry in your scence. For example, within <a class="el" href="classmingfx_1_1_graphics_app.html#a5a858fd10651f7617491f37b49dbf8ca" title="Override this to draw graphics using raw OpenGL 2D or 3D graphics calls.">GraphicsApp::DrawUsingOpenGL()</a>, you might have: </p>
<div class="fragment"><div class="line">Matrix4 P = <a class="code" href="classmingfx_1_1_matrix4.html#a0e34aee86758a0397074590b87712c5e">Matrix4::Perspective</a>(30, aspect_ratio(), 1, 20);</div>
<div class="line">Matrix4 V = cam.view_matrix();</div>
<div class="line">Matrix4 M = Matrix4::RotateY(<a class="code" href="classmingfx_1_1_gfx_math.html#a1336de2695bc3bb750b23fb0ea211637">GfxMath::ToRadians</a>(45.0));</div>
<div class="line">quick_shapes.DrawCube(M, V, P, Color(1,1,1));</div>
<div class="ttc" id="aclassmingfx_1_1_gfx_math_html_a1336de2695bc3bb750b23fb0ea211637"><div class="ttname"><a href="classmingfx_1_1_gfx_math.html#a1336de2695bc3bb750b23fb0ea211637">mingfx::GfxMath::ToRadians</a></div><div class="ttdeci">static float ToRadians(float degrees)</div></div>
<div class="ttc" id="aclassmingfx_1_1_matrix4_html_a0e34aee86758a0397074590b87712c5e"><div class="ttname"><a href="classmingfx_1_1_matrix4.html#a0e34aee86758a0397074590b87712c5e">mingfx::Matrix4::Perspective</a></div><div class="ttdeci">static Matrix4 Perspective(float fov_y_in_degrees, float aspect_ratio, float near_plane_dist, float far_plane_dist)</div><div class="ttdoc">Returns a perspective projection matrix equivalent to the one gluPerspective creates.</div></div>
</div><!-- fragment --> 
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>src/<a class="el" href="craft__cam_8h_source.html">craft_cam.h</a></li>
</ul>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.9.1-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.9.1
</small></address>
</body>
</html>