34
39
<div class="refnamediv"><table width="100%"><tr>
36
41
<h2><span class="refentrytitle"><a name="cogl-Matrices.top_of_page"></a>Matrices</span></h2>
37
<p>Matrices — Fuctions for initializing and manipulating 4x4
42
<p>Matrices — Fuctions for initializing and manipulating 4x4 matrices</p>
40
44
<td valign="top" align="right"></td>
41
45
</tr></table></div>
42
46
<div class="refsynopsisdiv" title="Synopsis">
43
47
<a name="cogl-Matrices.synopsis"></a><h2>Synopsis</h2>
44
<pre class="synopsis">
45
<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix">CoglMatrix</a>;
46
void <a class="link" href="cogl-Matrices.html#cogl-matrix-init-identity" title="cogl_matrix_init_identity ()">cogl_matrix_init_identity</a> (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix">CoglMatrix</a> *matrix);
47
void <a class="link" href="cogl-Matrices.html#cogl-matrix-frustum" title="cogl_matrix_frustum ()">cogl_matrix_frustum</a> (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix">CoglMatrix</a> *matrix,
54
void <a class="link" href="cogl-Matrices.html#cogl-matrix-ortho" title="cogl_matrix_ortho ()">cogl_matrix_ortho</a> (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix">CoglMatrix</a> *matrix,
61
void <a class="link" href="cogl-Matrices.html#cogl-matrix-perspective" title="cogl_matrix_perspective ()">cogl_matrix_perspective</a> (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix">CoglMatrix</a> *matrix,
66
void <a class="link" href="cogl-Matrices.html#cogl-matrix-transform-point" title="cogl_matrix_transform_point ()">cogl_matrix_transform_point</a> (const <a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix">CoglMatrix</a> *matrix,
71
void <a class="link" href="cogl-Matrices.html#cogl-matrix-multiply" title="cogl_matrix_multiply ()">cogl_matrix_multiply</a> (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix">CoglMatrix</a> *result,
72
const <a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix">CoglMatrix</a> *a,
73
const <a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix">CoglMatrix</a> *b);
74
void <a class="link" href="cogl-Matrices.html#cogl-matrix-rotate" title="cogl_matrix_rotate ()">cogl_matrix_rotate</a> (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix">CoglMatrix</a> *matrix,
79
void <a class="link" href="cogl-Matrices.html#cogl-matrix-translate" title="cogl_matrix_translate ()">cogl_matrix_translate</a> (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix">CoglMatrix</a> *matrix,
83
void <a class="link" href="cogl-Matrices.html#cogl-matrix-scale" title="cogl_matrix_scale ()">cogl_matrix_scale</a> (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix">CoglMatrix</a> *matrix,
87
void <a class="link" href="cogl-Matrices.html#cogl-matrix-init-from-array" title="cogl_matrix_init_from_array ()">cogl_matrix_init_from_array</a> (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix">CoglMatrix</a> *matrix,
89
const float * <a class="link" href="cogl-Matrices.html#cogl-matrix-get-array" title="cogl_matrix_get_array ()">cogl_matrix_get_array</a> (const <a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix">CoglMatrix</a> *matrix);
48
<pre class="synopsis"> <a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix">CoglMatrix</a>;
49
<span class="returnvalue">void</span> <a class="link" href="cogl-Matrices.html#cogl-matrix-init-identity" title="cogl_matrix_init_identity ()">cogl_matrix_init_identity</a> (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *matrix);
50
<span class="returnvalue">void</span> <a class="link" href="cogl-Matrices.html#cogl-matrix-frustum" title="cogl_matrix_frustum ()">cogl_matrix_frustum</a> (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *matrix,
51
<span class="returnvalue">float</span> left,
52
<span class="returnvalue">float</span> right,
53
<span class="returnvalue">float</span> bottom,
54
<span class="returnvalue">float</span> top,
55
<span class="returnvalue">float</span> z_near,
56
<span class="returnvalue">float</span> z_far);
57
<span class="returnvalue">void</span> <a class="link" href="cogl-Matrices.html#cogl-matrix-ortho" title="cogl_matrix_ortho ()">cogl_matrix_ortho</a> (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *matrix,
58
<span class="returnvalue">float</span> left,
59
<span class="returnvalue">float</span> right,
60
<span class="returnvalue">float</span> bottom,
61
<span class="returnvalue">float</span> top,
62
<span class="returnvalue">float</span> z_near,
63
<span class="returnvalue">float</span> z_far);
64
<span class="returnvalue">void</span> <a class="link" href="cogl-Matrices.html#cogl-matrix-perspective" title="cogl_matrix_perspective ()">cogl_matrix_perspective</a> (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *matrix,
65
<span class="returnvalue">float</span> fov_y,
66
<span class="returnvalue">float</span> aspect,
67
<span class="returnvalue">float</span> z_near,
68
<span class="returnvalue">float</span> z_far);
69
<span class="returnvalue">void</span> <a class="link" href="cogl-Matrices.html#cogl-matrix-transform-point" title="cogl_matrix_transform_point ()">cogl_matrix_transform_point</a> (const <a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *matrix,
70
<span class="returnvalue">float</span> *x,
71
<span class="returnvalue">float</span> *y,
72
<span class="returnvalue">float</span> *z,
73
<span class="returnvalue">float</span> *w);
74
<span class="returnvalue">void</span> <a class="link" href="cogl-Matrices.html#cogl-matrix-multiply" title="cogl_matrix_multiply ()">cogl_matrix_multiply</a> (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *result,
75
const <a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *a,
76
const <a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *b);
77
<span class="returnvalue">void</span> <a class="link" href="cogl-Matrices.html#cogl-matrix-rotate" title="cogl_matrix_rotate ()">cogl_matrix_rotate</a> (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *matrix,
78
<span class="returnvalue">float</span> angle,
79
<span class="returnvalue">float</span> x,
80
<span class="returnvalue">float</span> y,
81
<span class="returnvalue">float</span> z);
82
<span class="returnvalue">void</span> <a class="link" href="cogl-Matrices.html#cogl-matrix-translate" title="cogl_matrix_translate ()">cogl_matrix_translate</a> (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *matrix,
83
<span class="returnvalue">float</span> x,
84
<span class="returnvalue">float</span> y,
85
<span class="returnvalue">float</span> z);
86
<span class="returnvalue">void</span> <a class="link" href="cogl-Matrices.html#cogl-matrix-scale" title="cogl_matrix_scale ()">cogl_matrix_scale</a> (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *matrix,
87
<span class="returnvalue">float</span> sx,
88
<span class="returnvalue">float</span> sy,
89
<span class="returnvalue">float</span> sz);
90
<span class="returnvalue">void</span> <a class="link" href="cogl-Matrices.html#cogl-matrix-init-from-array" title="cogl_matrix_init_from_array ()">cogl_matrix_init_from_array</a> (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *matrix,
91
const <span class="returnvalue">float</span> *array);
92
const <span class="returnvalue">float</span> * <a class="link" href="cogl-Matrices.html#cogl-matrix-get-array" title="cogl_matrix_get_array ()">cogl_matrix_get_array</a> (const <a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *matrix);
93
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="cogl-Matrices.html#cogl-matrix-get-inverse" title="cogl_matrix_get_inverse ()">cogl_matrix_get_inverse</a> (const <a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *matrix,
94
<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *inverse);
92
97
<div class="refsect1" title="Description">
139
142
allows Cogl to annotate the matrices internally. Violation of this will give
140
143
undefined results. If you need to initialize a matrix with a constant other
141
144
than the identity matrix you can use <a class="link" href="cogl-Matrices.html#cogl-matrix-init-from-array" title="cogl_matrix_init_from_array ()"><code class="function">cogl_matrix_init_from_array()</code></a>.</div>
146
147
<div class="refsect2" title="cogl_matrix_init_identity ()">
147
148
<a name="cogl-matrix-init-identity"></a><h3>cogl_matrix_init_identity ()</h3>
148
<pre class="programlisting">void cogl_matrix_init_identity (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix">CoglMatrix</a> *matrix);</pre>
149
<pre class="programlisting"><span class="returnvalue">void</span> cogl_matrix_init_identity (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *matrix);</pre>
150
151
Resets matrix to the identity matrix:
152
<pre class="programlisting">
153
.xx=1; .xy=0; .xz=0; .xw=0;
154
.yx=0; .yy=1; .yz=0; .yw=0;
155
.zx=0; .zy=0; .zz=1; .zw=0;
156
.wx=0; .wy=0; .wz=0; .ww=1;
155
<div class="informalexample"><pre class="programlisting">
156
.xx=1; .xy=0; .xz=0; .xw=0;
157
.yx=0; .yy=1; .yz=0; .yw=0;
158
.zx=0; .zy=0; .zz=1; .zw=0;
159
.wx=0; .wy=0; .wz=0; .ww=1;
160
161
<div class="variablelist"><table border="0">
161
162
<col align="left" valign="top">
282
279
<div class="refsect2" title="cogl_matrix_perspective ()">
283
280
<a name="cogl-matrix-perspective"></a><h3>cogl_matrix_perspective ()</h3>
284
<pre class="programlisting">void cogl_matrix_perspective (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix">CoglMatrix</a> *matrix,
290
Multiplies the matrix by the described perspective matrix
293
Note: you should be careful not to have to great a <em class="parameter"><code>z_far</code></em> / <em class="parameter"><code>z_near</code></em> ratio
281
<pre class="programlisting"><span class="returnvalue">void</span> cogl_matrix_perspective (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *matrix,
282
<span class="returnvalue">float</span> fov_y,
283
<span class="returnvalue">float</span> aspect,
284
<span class="returnvalue">float</span> z_near,
285
<span class="returnvalue">float</span> z_far);</pre>
287
Multiplies <em class="parameter"><code>matrix</code></em> by the described perspective matrix
291
<div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
292
<h3 class="title">Note</h3>You should be careful not to have to great a <em class="parameter"><code>z_far</code></em> / <em class="parameter"><code>z_near</code></em> ratio
294
293
since that will reduce the effectiveness of depth testing since there wont
295
be enough precision to identify the depth of objects near to each other.</p>
294
be enough precision to identify the depth of objects near to each
298
296
<div class="variablelist"><table border="0">
299
297
<col align="left" valign="top">
452
440
<div class="refsect2" title="cogl_matrix_translate ()">
453
441
<a name="cogl-matrix-translate"></a><h3>cogl_matrix_translate ()</h3>
454
<pre class="programlisting">void cogl_matrix_translate (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix">CoglMatrix</a> *matrix,
442
<pre class="programlisting"><span class="returnvalue">void</span> cogl_matrix_translate (<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *matrix,
443
<span class="returnvalue">float</span> x,
444
<span class="returnvalue">float</span> y,
445
<span class="returnvalue">float</span> z);</pre>
447
Multiplies <em class="parameter"><code>matrix</code></em> with a transform matrix that translates along
448
the X, Y and Z axis.</p>
460
449
<div class="variablelist"><table border="0">
461
450
<col align="left" valign="top">
464
453
<td><p><span class="term"><em class="parameter"><code>matrix</code></em> :</span></p></td>
454
<td> A 4x4 transformation matrix
469
458
<td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td>
459
<td> The X translation you want to apply
474
463
<td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td>
464
<td> The Y translation you want to apply
479
468
<td><p><span class="term"><em class="parameter"><code>z</code></em> :</span></p></td>
469
<td> The Z translation you want to apply
557
<div class="refsect2" title="cogl_matrix_get_inverse ()">
558
<a name="cogl-matrix-get-inverse"></a><h3>cogl_matrix_get_inverse ()</h3>
559
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> cogl_matrix_get_inverse (const <a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *matrix,
560
<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="returnvalue">CoglMatrix</span></a> *inverse);</pre>
562
Gets the inverse transform of a given matrix and uses it to initialize
563
a new <a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="type">CoglMatrix</span></a>.
567
<div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
568
<h3 class="title">Note</h3>Although the first parameter is annotated as const to indicate
569
that the transform it represents isn't modified this function may
570
technically save a copy of the inverse transform within the given
571
<a class="link" href="cogl-Matrices.html#CoglMatrix" title="CoglMatrix"><span class="type">CoglMatrix</span></a> so that subsequent requests for the inverse transform may
572
avoid costly inversion calculations.</div>
573
<div class="variablelist"><table border="0">
574
<col align="left" valign="top">
577
<td><p><span class="term"><em class="parameter"><code>matrix</code></em> :</span></p></td>
578
<td> A 4x4 transformation matrix
582
<td><p><span class="term"><em class="parameter"><code>inverse</code></em> :</span></p></td>
583
<td> The destination for a 4x4 inverse transformation matrix. <a href="http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=out"><span class="acronym">out</span></a>. </td>
586
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
587
<td> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the inverse was successfully calculated or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>
588
for degenerate transformations that can't be inverted (in this case the
589
<em class="parameter"><code>inverse</code></em> matrix will simply be initialized with the identity matrix)
595
<p class="since">Since 1.2</p>
576
599
<div class="footer">
578
Generated by GTK-Doc V1.11</div>
601
Generated by GTK-Doc V1.13</div>
b'\\ No newline at end of file'