aboutsummaryrefslogtreecommitdiffstats
path: root/sgl_doxygen/html/SkCamera_8h-source.html
blob: ab2cc8e6dbabb8f85a3e75195fc884218dfca5c0 (plain)
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>SGL: SkCamera.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.0 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
<div class="nav">
<a class="el" href="dir_000000.html">include</a>&nbsp;/&nbsp;<a class="el" href="dir_000001.html">skia</a></div>
<h1>SkCamera.h</h1><div class="fragment"><pre class="fragment">00001 <span class="preprocessor">#ifndef SkCamera_DEFINED</span>
00002 <span class="preprocessor"></span><span class="preprocessor">#define SkCamera_DEFINED</span>
00003 <span class="preprocessor"></span>
00004 <span class="preprocessor">#include "SkMatrix.h"</span>
00005 <span class="preprocessor">#include "Sk64.h"</span>
00006 
00007 <span class="preprocessor">#ifdef SK_SCALAR_IS_FIXED</span>
00008 <span class="preprocessor"></span>        <span class="keyword">typedef</span> SkFract SkUnitScalar;
00009 <span class="preprocessor">        #define SK_UnitScalar1                  SK_Fract1</span>
00010 <span class="preprocessor"></span><span class="preprocessor">        #define SkUnitScalarMul(a, b)   SkFractMul(a, b)</span>
00011 <span class="preprocessor"></span><span class="preprocessor">        #define SkUnitScalarDiv(a, b)   SkFractDiv(a, b)</span>
00012 <span class="preprocessor"></span><span class="preprocessor">#else</span>
00013 <span class="preprocessor"></span>        <span class="keyword">typedef</span> <span class="keywordtype">float</span>   SkUnitScalar;
00014 <span class="preprocessor">        #define SK_UnitScalar1                  SK_Scalar1</span>
00015 <span class="preprocessor"></span><span class="preprocessor">        #define SkUnitScalarMul(a, b)   SkScalarMul(a, b)</span>
00016 <span class="preprocessor"></span><span class="preprocessor">        #define SkUnitScalarDiv(a, b)   SkScalarDiv(a, b)</span>
00017 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00018 <span class="preprocessor"></span>
00019 <span class="comment">//      Taken from Rob Johnson's most excellent QuickDraw GX library</span>
00020 
00021 <span class="keyword">struct </span>SkUnit3D {
00022         SkUnitScalar    fX, fY, fZ;
00023 
00024         <span class="keywordtype">void</span> set(SkUnitScalar x, SkUnitScalar y, SkUnitScalar z)
00025         {
00026                 fX = x; fY = y; fZ = z;
00027         }
00028         <span class="keyword">static</span> SkUnitScalar Dot(<span class="keyword">const</span> SkUnit3D&amp;, <span class="keyword">const</span> SkUnit3D&amp;);
00029         <span class="keyword">static</span> <span class="keywordtype">void</span> Cross(<span class="keyword">const</span> SkUnit3D&amp;, <span class="keyword">const</span> SkUnit3D&amp;, SkUnit3D* cross);
00030 };
00031 
00032 <span class="keyword">struct </span>SkPoint3D {
00033         SkScalar        fX, fY, fZ;
00034 
00035         <span class="keywordtype">void</span> set(SkScalar x, SkScalar y, SkScalar z)
00036         {
00037                 fX = x; fY = y; fZ = z;
00038         }
00039         SkScalar        normalize(SkUnit3D*) <span class="keyword">const</span>;
00040 };
00041 
00042 <span class="keyword">class </span>SkPatch3D {
00043 <span class="keyword">public</span>:
00044         SkPatch3D();
00045 
00046         <span class="keywordtype">void</span>    reset();
00047         <span class="keywordtype">void</span>    rotate(SkScalar radX, SkScalar radY, SkScalar radZ);
00048         <span class="keywordtype">void</span>    rotateDegrees(SkScalar degX, SkScalar degY, SkScalar degZ)
00049         {
00050                 this-&gt;rotate(SkDegreesToRadians(degX),
00051                                          SkDegreesToRadians(degY),
00052                                          SkDegreesToRadians(degZ));
00053         }
00054 
00055         <span class="comment">// dot a unit vector with the patch's normal</span>
00056         SkScalar        dotWith(SkScalar dx, SkScalar dy, SkScalar dz) <span class="keyword">const</span>;
00057 
00058         SkPoint3D       fU, fV, fOrigin;
00059 <span class="keyword">private</span>:
00060         <span class="keyword">friend</span> <span class="keyword">class </span>SkCamera3D;
00061 };
00062 
00063 <span class="keyword">class </span>SkCamera3D {
00064 <span class="keyword">public</span>:
00065         SkCamera3D();
00066 
00067         <span class="keywordtype">void</span> update();
00068         <span class="keywordtype">void</span> computeMatrix(<span class="keyword">const</span> SkPatch3D&amp;, SkMatrix* matrix) <span class="keyword">const</span>;
00069 
00070         SkPoint3D       fLocation;
00071         SkPoint3D       fAxis;
00072         SkPoint3D       fZenith;
00073         SkPoint3D       fObserver;
00074 
00075 <span class="keyword">private</span>:
00076         SkMatrix        fOrientation;
00077 };
00078 
00079 <span class="preprocessor">#endif</span>
00080 <span class="preprocessor"></span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Tue May 9 14:35:23 2006 for SGL by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.0 </small></address>
</body>
</html>