File: Castle3D.T3DOrient.html

package info (click to toggle)
castle-game-engine 5.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 185,428 kB
  • sloc: pascal: 260,781; cpp: 1,363; objc: 713; makefile: 537; xml: 496; sh: 480; php: 4
file content (285 lines) | stat: -rw-r--r-- 20,249 bytes parent folder | download
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>Castle Game Engine: Castle3D: Class T3DOrient</title>
<meta name="generator" content="PasDoc 0.13.0">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="StyleSheet" type="text/css" href="pasdoc.css">
</head>
<body>
<table class="container"><tr><td class="navigation">
<h2>Castle Game Engine</h2><p><a href="introduction.html" class="navigation">Introduction</a></p><p><a href="AllUnits.html" class="navigation">Units</a></p><p><a href="ClassHierarchy.html" class="navigation">Class Hierarchy</a></p><p><a href="AllClasses.html" class="navigation">Classes, Interfaces, Objects and Records</a></p><p><a href="AllTypes.html" class="navigation">Types</a></p><p><a href="AllVariables.html" class="navigation">Variables</a></p><p><a href="AllConstants.html" class="navigation">Constants</a></p><p><a href="AllFunctions.html" class="navigation">Functions and Procedures</a></p><p><a href="AllIdentifiers.html" class="navigation">Identifiers</a></p></td><td class="content">
<a name="T3DOrient"></a><h1 class="cio">Class T3DOrient</h1>
<table class="sections wide_list">
<tr>
<td><a class="section" href="#PasDoc-Description">Description</a></td><td><a class="section" href="#PasDoc-Hierarchy">Hierarchy</a></td><td><a class="section" href="#PasDoc-Fields">Fields</a></td><td><a class="section" href="#PasDoc-Methods">Methods</a></td><td><a class="section" href="#PasDoc-Properties">Properties</a></td></tr></table>
<a name="PasDoc-Description"></a><h2 class="unit">Unit</h2>
<p class="unitlink">
<a  href="Castle3D.html">Castle3D</a></p>
<h2 class="declaration">Declaration</h2>
<p class="declaration">
<code>type T3DOrient = class(<a class="normal" href="Castle3D.T3DCustomTransform.html">T3DCustomTransform</a>)</code></p>
<h2 class="description">Description</h2>
<p>
Transform other 3D objects by changing their orientation.

<p>The rotation of objects depends on given Direction and Up vectors, see <a class="normal" href="Castle3D.T3DOrient.html#Orientation">Orientation</a> for details. The translation of objects is just taken from <a class="normal" href="Castle3D.T3DOrient.html#Position">Position</a>, and works just like normal <a class="normal" href="Castle3D.T3DTransform.html#Translation">T3DTransform.Translation</a>. There is no scaling of 3D objects, ever.</p>
<a name="PasDoc-Hierarchy"></a><h2 class="hierarchy">Hierarchy</h2>
<ul class="hierarchy"><li class="ancestor">TComponent</li>
<li class="ancestor"><a class="normal" href="Castle3D.T3D.html">T3D</a></li>
<li class="ancestor"><a class="normal" href="Castle3D.T3DList.html">T3DList</a></li>
<li class="ancestor"><a class="normal" href="Castle3D.T3DCustomTransform.html">T3DCustomTransform</a></li>
<li class="thisitem">T3DOrient</li></ul><h2 class="overview">Overview</h2>
<a name="PasDoc-Fields"></a><h3 class="summary">Fields</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code><b><a  href="Castle3D.T3DOrient.html#DefaultOrientation">DefaultOrientation</a></b>: <a  href="Castle3D.html#TOrientationType">TOrientationType</a>; static;</code></td>
</tr>
</table>
<a name="PasDoc-Methods"></a><h3 class="summary">Methods</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><code>procedure <b><a  href="Castle3D.T3DOrient.html#TransformMatricesMult">TransformMatricesMult</a></b>(var M, MInverse: <a  href="CastleVectors.html#TMatrix4Single">TMatrix4Single</a>); override;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><code>function <b><a  href="Castle3D.T3DOrient.html#OnlyTranslation">OnlyTranslation</a></b>: boolean; override;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><code>function <b><a  href="Castle3D.T3DOrient.html#GetTranslation">GetTranslation</a></b>: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a>; override;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>constructor <b><a  href="Castle3D.T3DOrient.html#Create">Create</a></b>(AOwner: TComponent); override;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>destructor <b><a  href="Castle3D.T3DOrient.html#Destroy">Destroy</a></b>; override;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="Castle3D.T3DOrient.html#SetView">SetView</a></b>(const APos, ADir, AUp: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a>; const AdjustUp: boolean = true);</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="Castle3D.T3DOrient.html#SetView">SetView</a></b>(const ADir, AUp: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a>; const AdjustUp: boolean = true);</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="Castle3D.T3DOrient.html#UpPrefer">UpPrefer</a></b>(const AUp: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a>);</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a  href="Castle3D.T3DOrient.html#Translate">Translate</a></b>(const T: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a>); override;</code></td>
</tr>
</table>
<a name="PasDoc-Properties"></a><h3 class="summary">Properties</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a  href="Castle3D.T3DOrient.html#Position">Position</a></b>: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a> read GetPosition write SetPosition;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a  href="Castle3D.T3DOrient.html#Direction">Direction</a></b>: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a> read GetDirection write SetDirection;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a  href="Castle3D.T3DOrient.html#Up">Up</a></b>: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a> read GetUp write SetUp;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a  href="Castle3D.T3DOrient.html#Orientation">Orientation</a></b>: <a  href="Castle3D.html#TOrientationType">TOrientationType</a> read FOrientation write FOrientation;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a  href="Castle3D.T3DOrient.html#Camera">Camera</a></b>: <a  href="CastleCameras.TWalkCamera.html">TWalkCamera</a> read FCamera;</code></td>
</tr>
</table>
<h2 class="description">Description</h2>
<h3 class="detail">Fields</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="DefaultOrientation"></a><code><b>DefaultOrientation</b>: <a  href="Castle3D.html#TOrientationType">TOrientationType</a>; static;</code></td>
</tr>
<tr><td colspan="2">
<p>
Default value of <a class="normal" href="Castle3D.T3DOrient.html#Orientation">T3DOrient.Orientation</a>, for new instances of <a class="normal" href="Castle3D.T3DOrient.html">T3DOrient</a> (creatures, items, player etc.).</p>
</td></tr>
</table>
<h3 class="detail">Methods</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><a name="TransformMatricesMult"></a><code>procedure <b>TransformMatricesMult</b>(var M, MInverse: <a  href="CastleVectors.html#TMatrix4Single">TMatrix4Single</a>); override;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><a name="OnlyTranslation"></a><code>function <b>OnlyTranslation</b>: boolean; override;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><a name="GetTranslation"></a><code>function <b>GetTranslation</b>: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a>; override;</code></td>
</tr>
<tr><td colspan="2">
<p>
<a class="normal" href="Castle3D.T3DOrient.html">T3DOrient</a> overrides <code>GetTranslation</code> to return Position, this will be used by <a class="normal" href="Castle3D.T3DCustomTransform.html#Middle">T3DCustomTransform.Middle</a>.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Create"></a><code>constructor <b>Create</b>(AOwner: TComponent); override;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Destroy"></a><code>destructor <b>Destroy</b>; override;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="SetView"></a><code>procedure <b>SetView</b>(const APos, ADir, AUp: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a>; const AdjustUp: boolean = true);</code></td>
</tr>
<tr><td colspan="2">
<p>
Set at once vectors: position, direction, up.

<p>ADir and AUp given here do not have to be normalized (they will be normalized if needed). They will be automatically fixed to be orthogonal, if necessary: when AdjustUp = <code>True</code> (the default) we will adjust the up vector (preserving the given direction value), otherwise we will adjust the direction (preserving the given up value).</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="SetView"></a><code>procedure <b>SetView</b>(const ADir, AUp: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a>; const AdjustUp: boolean = true);</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="UpPrefer"></a><code>procedure <b>UpPrefer</b>(const AUp: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a>);</code></td>
</tr>
<tr><td colspan="2">
<p>
Change up vector, keeping the direction unchanged. If necessary, the up vector provided here will be fixed to be orthogonal to direction.

<p>This is similar to assigning <a class="normal" href="Castle3D.T3DOrient.html#Up">Up</a> vector using it's property setter, but different behavior happens when we need to fix vectors to have direction orthogonal to up (which must be always true). In case of assigning <a class="normal" href="Castle3D.T3DOrient.html#Up">Up</a> by property setter, the <a class="normal" href="Castle3D.T3DOrient.html#Direction">Direction</a> vector is changed (if necessary, to be orthogonal to up). In case of this method, the up vector is changed (if necessary, to be orthogonal to direction).

<p>It's good to use this if you have a preferred up vector for creatures, but still preserving the direction vector has the highest priority.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Translate"></a><code>procedure <b>Translate</b>(const T: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a>); override;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<h3 class="detail">Properties</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Position"></a><code>property <b>Position</b>: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a> read GetPosition write SetPosition;</code></td>
</tr>
<tr><td colspan="2">
<p>
Position (translation) of this 3D object.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Direction"></a><code>property <b>Direction</b>: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a> read GetDirection write SetDirection;</code></td>
</tr>
<tr><td colspan="2">
<p>
Direction the creature is facing, and up vector.

<p>The <a class="normal" href="Castle3D.T3DOrient.html#Direction">Direction</a> and <a class="normal" href="Castle3D.T3DOrient.html#Up">Up</a> vectors should always be normalized (have length 1). When setting them by these properties, we will normalize them automatically.

<p>They must also always be orthogonal. When setting <a class="normal" href="Castle3D.T3DOrient.html#Direction">Direction</a>, <a class="normal" href="Castle3D.T3DOrient.html#Up">Up</a> will always be automatically adjusted to be orthogonal to <a class="normal" href="Castle3D.T3DOrient.html#Direction">Direction</a>. And vice versa &mdash; when setting <a class="normal" href="Castle3D.T3DOrient.html#Up">Up</a>, <a class="normal" href="Castle3D.T3DOrient.html#Direction">Direction</a> will be adjusted.

<p>Initially, they follow VRML/X3D standard vectors suitable for gravity along the Y axis. So direction is -Z (<a class="normal" href="CastleCameras.html#DefaultCameraDirection">DefaultCameraDirection</a>), up is +Y (<a class="normal" href="CastleCameras.html#DefaultCameraUp">DefaultCameraUp</a>).

<p></p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Up"></a><code>property <b>Up</b>: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a> read GetUp write SetUp;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Orientation"></a><code>property <b>Orientation</b>: <a  href="Castle3D.html#TOrientationType">TOrientationType</a> read FOrientation write FOrientation;</code></td>
</tr>
<tr><td colspan="2">
<p>
How the direction and up vectors determine transformation. See <a class="normal" href="Castle3D.html#TOrientationType">TOrientationType</a> for values documentation.

<p>The default value of this is determined by static variable <a class="normal" href="Castle3D.T3DOrient.html#DefaultOrientation">DefaultOrientation</a>, this is usually comfortable (because almost always you use the same Orientation throughout your game). By default it's otUpYDirectionMinusZ (matching default cameras of OpenGL and VRML/X3D).

<p>This value determines how you should model your 3D models, like the creatures, the items, and the player weapons. Generally, it applies to every 3D model that is used as a child of this <a class="normal" href="Castle3D.T3DOrient.html">T3DOrient</a> instance.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Camera"></a><code>property <b>Camera</b>: <a  href="CastleCameras.TWalkCamera.html">TWalkCamera</a> read FCamera;</code></td>
</tr>
<tr><td colspan="2">
<p>
Camera, with view vectors (position, direction and up) always synchronized with this <a class="normal" href="Castle3D.T3DOrient.html">T3DOrient</a> instance. You should not set Camera vectors (by <a class="normal" href="CastleCameras.TWalkCamera.html#Position">TWalkCamera.Position</a>, <a class="normal" href="CastleCameras.TWalkCamera.html#SetView">TWalkCamera.SetView</a> and such) directly, instead use this object's properties (<a class="normal" href="Castle3D.T3DOrient.html#Position">T3DOrient.Position</a>, <a class="normal" href="Castle3D.T3DOrient.html#SetView">T3DOrient.SetView</a>), as we will call proper <a class="normal" href="Castle3D.T3D.html#VisibleChangeHere">VisibleChangeHere</a> method.

<p>We don't deal with any other camera properties in <a class="normal" href="Castle3D.T3DOrient.html">T3DOrient</a>. If you want, you can ignore this camera (you will probably do this if you use <a class="normal" href="Castle3D.T3DOrient.html">T3DOrient</a> for creature like TCastleCreature; although camera may still have a fun usage then, for observing world from a creature view). Or you can use this camera, taking care of all it's settings, even asssigning this camera to TCastleSceneManager.Camera to allow user to directly control it (you will probably do this if you use <a class="normal" href="Castle3D.T3DOrient.html">T3DOrient</a> for player like <a class="normal" href="CastlePlayer.TPlayer.html">TPlayer</a>; in fact, <a class="normal" href="CastleLevels.TGameSceneManager.html#LoadLevel">TGameSceneManager.LoadLevel</a> does this automatically for you).</p>
</td></tr>
</table>
<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push(["trackPageView"]);
  _paq.push(["enableLinkTracking"]);

  (function() {
    var u=(("https:" == document.location.protocol) ? "https" : "http") + "://michalis.ii.uni.wroc.pl/piwik-castle-engine/";
    _paq.push(["setTrackerUrl", u+"piwik.php"]);
    _paq.push(["setSiteId", "1"]);
    var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
    g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
  })();
</script>
<!-- End Piwik Code -->

<noscript>
<!-- Piwik Image Tracker -->
<img src="http://michalis.ii.uni.wroc.pl/piwik-castle-engine/piwik.php?idsite=1&amp;rec=1" style="border:0" alt="" />
<!-- End Piwik -->
</noscript>
<hr noshade size="1"><span class="appinfo"><em>Generated by <a  href="http://pasdoc.sourceforge.net/">PasDoc 0.13.0</a> on 2015-06-15 04:43:08</em>
</span>
</td></tr></table></body></html>