1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
2 | <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> |
---|
3 | <title>Open Dynamics Engine: drawstuff.h Source File</title> |
---|
4 | <link href="doxygen.css" rel="stylesheet" type="text/css"> |
---|
5 | <link href="tabs.css" rel="stylesheet" type="text/css"> |
---|
6 | </head><body> |
---|
7 | <!-- Generated by Doxygen 1.5.3 --> |
---|
8 | <div class="tabs"> |
---|
9 | <ul> |
---|
10 | <li><a href="index.html"><span>Main Page</span></a></li> |
---|
11 | <li><a href="modules.html"><span>Modules</span></a></li> |
---|
12 | <li><a href="annotated.html"><span>Data Structures</span></a></li> |
---|
13 | <li class="current"><a href="files.html"><span>Files</span></a></li> |
---|
14 | </ul> |
---|
15 | </div> |
---|
16 | <h1>drawstuff.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*************************************************************************</span> |
---|
17 | <a name="l00002"></a>00002 <span class="comment"> * *</span> |
---|
18 | <a name="l00003"></a>00003 <span class="comment"> * Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *</span> |
---|
19 | <a name="l00004"></a>00004 <span class="comment"> * All rights reserved. Email: russ@q12.org Web: www.q12.org *</span> |
---|
20 | <a name="l00005"></a>00005 <span class="comment"> * *</span> |
---|
21 | <a name="l00006"></a>00006 <span class="comment"> * This library is free software; you can redistribute it and/or *</span> |
---|
22 | <a name="l00007"></a>00007 <span class="comment"> * modify it under the terms of EITHER: *</span> |
---|
23 | <a name="l00008"></a>00008 <span class="comment"> * (1) The GNU Lesser General Public License as published by the Free *</span> |
---|
24 | <a name="l00009"></a>00009 <span class="comment"> * Software Foundation; either version 2.1 of the License, or (at *</span> |
---|
25 | <a name="l00010"></a>00010 <span class="comment"> * your option) any later version. The text of the GNU Lesser *</span> |
---|
26 | <a name="l00011"></a>00011 <span class="comment"> * General Public License is included with this library in the *</span> |
---|
27 | <a name="l00012"></a>00012 <span class="comment"> * file LICENSE.TXT. *</span> |
---|
28 | <a name="l00013"></a>00013 <span class="comment"> * (2) The BSD-style license that is included with this library in *</span> |
---|
29 | <a name="l00014"></a>00014 <span class="comment"> * the file LICENSE-BSD.TXT. *</span> |
---|
30 | <a name="l00015"></a>00015 <span class="comment"> * *</span> |
---|
31 | <a name="l00016"></a>00016 <span class="comment"> * This library is distributed in the hope that it will be useful, *</span> |
---|
32 | <a name="l00017"></a>00017 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of *</span> |
---|
33 | <a name="l00018"></a>00018 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *</span> |
---|
34 | <a name="l00019"></a>00019 <span class="comment"> * LICENSE.TXT and LICENSE-BSD.TXT for more details. *</span> |
---|
35 | <a name="l00020"></a>00020 <span class="comment"> * *</span> |
---|
36 | <a name="l00021"></a>00021 <span class="comment"> *************************************************************************/</span> |
---|
37 | <a name="l00022"></a>00022 |
---|
38 | <a name="l00041"></a>00041 <span class="preprocessor">#ifndef __DRAWSTUFF_H__</span> |
---|
39 | <a name="l00042"></a>00042 <span class="preprocessor"></span><span class="preprocessor">#define __DRAWSTUFF_H__</span> |
---|
40 | <a name="l00043"></a>00043 <span class="preprocessor"></span> |
---|
41 | <a name="l00044"></a>00044 <span class="comment">/* Define a DLL export symbol for those platforms that need it */</span> |
---|
42 | <a name="l00045"></a>00045 <span class="preprocessor">#if defined(ODE_PLATFORM_WINDOWS)</span> |
---|
43 | <a name="l00046"></a>00046 <span class="preprocessor"></span><span class="preprocessor"> #if defined(DS_DLL)</span> |
---|
44 | <a name="l00047"></a>00047 <span class="preprocessor"></span><span class="preprocessor"> #define DS_API __declspec(dllexport)</span> |
---|
45 | <a name="l00048"></a>00048 <span class="preprocessor"></span><span class="preprocessor"> #elif !defined(DS_LIB)</span> |
---|
46 | <a name="l00049"></a>00049 <span class="preprocessor"></span><span class="preprocessor"> #define DS_DLL_API __declspec(dllimport)</span> |
---|
47 | <a name="l00050"></a>00050 <span class="preprocessor"></span><span class="preprocessor"> #endif</span> |
---|
48 | <a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor">#endif</span> |
---|
49 | <a name="l00052"></a>00052 <span class="preprocessor"></span> |
---|
50 | <a name="l00053"></a>00053 <span class="preprocessor">#if !defined(DS_API)</span> |
---|
51 | <a name="l00054"></a>00054 <span class="preprocessor"></span><span class="preprocessor"> #define DS_API</span> |
---|
52 | <a name="l00055"></a>00055 <span class="preprocessor"></span><span class="preprocessor">#endif</span> |
---|
53 | <a name="l00056"></a>00056 <span class="preprocessor"></span> |
---|
54 | <a name="l00057"></a>00057 <span class="preprocessor">#ifdef __cplusplus</span> |
---|
55 | <a name="l00058"></a>00058 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> { |
---|
56 | <a name="l00059"></a>00059 <span class="preprocessor">#endif</span> |
---|
57 | <a name="l00060"></a>00060 <span class="preprocessor"></span> |
---|
58 | <a name="l00061"></a>00061 |
---|
59 | <a name="l00062"></a>00062 <span class="preprocessor">#include <drawstuff/version.h></span> |
---|
60 | <a name="l00063"></a>00063 |
---|
61 | <a name="l00064"></a>00064 |
---|
62 | <a name="l00065"></a>00065 <span class="comment">/* texture numbers */</span> |
---|
63 | <a name="l00066"></a>00066 <span class="preprocessor">#define DS_NONE 0 </span><span class="comment">/* uses the current color instead of a texture */</span> |
---|
64 | <a name="l00067"></a>00067 <span class="preprocessor">#define DS_WOOD 1</span> |
---|
65 | <a name="l00068"></a>00068 <span class="preprocessor"></span> |
---|
66 | <a name="l00069"></a>00069 |
---|
67 | <a name="l00075"></a><a class="code" href="structds_functions.html">00075</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structds_functions.html" title="Set of functions to be used as callbacks by the simulation loop.">dsFunctions</a> { |
---|
68 | <a name="l00076"></a>00076 <span class="keywordtype">int</span> version; <span class="comment">/* put DS_VERSION here */</span> |
---|
69 | <a name="l00077"></a>00077 <span class="comment">/* version 1 data */</span> |
---|
70 | <a name="l00078"></a>00078 void (*start)(); <span class="comment">/* called before sim loop starts */</span> |
---|
71 | <a name="l00079"></a>00079 void (*step) (<span class="keywordtype">int</span> pause); <span class="comment">/* called before every frame */</span> |
---|
72 | <a name="l00080"></a>00080 void (*command) (<span class="keywordtype">int</span> cmd); <span class="comment">/* called if a command key is pressed */</span> |
---|
73 | <a name="l00081"></a>00081 void (*stop)(); <span class="comment">/* called after sim loop exits */</span> |
---|
74 | <a name="l00082"></a>00082 <span class="comment">/* version 2 data */</span> |
---|
75 | <a name="l00083"></a>00083 <span class="keywordtype">char</span> *path_to_textures; <span class="comment">/* if nonzero, path to texture files */</span> |
---|
76 | <a name="l00084"></a>00084 } <a class="code" href="structds_functions.html" title="Set of functions to be used as callbacks by the simulation loop.">dsFunctions</a>; |
---|
77 | <a name="l00085"></a>00085 |
---|
78 | <a name="l00086"></a>00086 |
---|
79 | <a name="l00095"></a>00095 DS_API <span class="keywordtype">void</span> <a class="code" href="group__drawstuff.html#g28560ea1b64c1d83095bcdfce9caf9dc" title="Does the complete simulation.">dsSimulationLoop</a> (<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv, |
---|
80 | <a name="l00096"></a>00096 <span class="keywordtype">int</span> window_width, <span class="keywordtype">int</span> window_height, |
---|
81 | <a name="l00097"></a>00097 <span class="keyword">struct</span> <a class="code" href="structds_functions.html" title="Set of functions to be used as callbacks by the simulation loop.">dsFunctions</a> *fn); |
---|
82 | <a name="l00098"></a>00098 |
---|
83 | <a name="l00105"></a>00105 DS_API <span class="keywordtype">void</span> <a class="code" href="group__drawstuff.html#g7a2a69ac611d5dc6ffc8e43b0a743472" title="exit with error message.">dsError</a> (<span class="keywordtype">char</span> *msg, ...); |
---|
84 | <a name="l00106"></a>00106 |
---|
85 | <a name="l00113"></a>00113 DS_API <span class="keywordtype">void</span> <a class="code" href="group__drawstuff.html#ga84175b14c3c31daae08a9c88acc2b02" title="exit with error message and core dump.">dsDebug</a> (<span class="keywordtype">char</span> *msg, ...); |
---|
86 | <a name="l00114"></a>00114 |
---|
87 | <a name="l00120"></a>00120 DS_API <span class="keywordtype">void</span> <a class="code" href="group__drawstuff.html#gbca5fa4076aa9e45caa049f33e8cf168" title="print log message">dsPrint</a> (<span class="keywordtype">char</span> *msg, ...); |
---|
88 | <a name="l00121"></a>00121 |
---|
89 | <a name="l00130"></a>00130 DS_API <span class="keywordtype">void</span> <a class="code" href="group__drawstuff.html#g8e4ea933c31d207ec57949fbb3a75815" title="Sets the viewpoint.">dsSetViewpoint</a> (<span class="keywordtype">float</span> xyz[3], <span class="keywordtype">float</span> hpr[3]); |
---|
90 | <a name="l00131"></a>00131 |
---|
91 | <a name="l00132"></a>00132 |
---|
92 | <a name="l00139"></a>00139 DS_API <span class="keywordtype">void</span> <a class="code" href="group__drawstuff.html#gaa22f45ad00e0010a1440985ac51b18b" title="Gets the viewpoint.">dsGetViewpoint</a> (<span class="keywordtype">float</span> xyz[3], <span class="keywordtype">float</span> hpr[3]); |
---|
93 | <a name="l00140"></a>00140 |
---|
94 | <a name="l00149"></a>00149 DS_API <span class="keywordtype">void</span> <a class="code" href="group__drawstuff.html#g6c13a5a310b9e00c45150058e669ebad" title="Stop the simulation loop.">dsStop</a>(); |
---|
95 | <a name="l00150"></a>00150 |
---|
96 | <a name="l00156"></a>00156 DS_API <span class="keywordtype">double</span> <a class="code" href="group__drawstuff.html#g02f3f096703d49f5a9e497aec0b85f75" title="Get the elapsed time (on wall-clock).">dsElapsedTime</a>(); |
---|
97 | <a name="l00157"></a>00157 |
---|
98 | <a name="l00168"></a>00168 DS_API <span class="keywordtype">void</span> <a class="code" href="group__drawstuff.html#g8a3d6f8fecc8c7d5a206bed35f17ba7a" title="Toggle the rendering of textures.">dsSetTexture</a> (<span class="keywordtype">int</span> texture_number); |
---|
99 | <a name="l00169"></a>00169 |
---|
100 | <a name="l00177"></a>00177 DS_API <span class="keywordtype">void</span> <a class="code" href="group__drawstuff.html#g3221a0d1360621eaad7c54597671c092" title="Set the color with which geometry is drawn.">dsSetColor</a> (<span class="keywordtype">float</span> red, <span class="keywordtype">float</span> green, <span class="keywordtype">float</span> blue); |
---|
101 | <a name="l00178"></a>00178 |
---|
102 | <a name="l00185"></a>00185 DS_API <span class="keywordtype">void</span> <a class="code" href="group__drawstuff.html#g440940cfaef61775e37c33b055b832af" title="Set the color and transparency with which geometry is drawn.">dsSetColorAlpha</a> (<span class="keywordtype">float</span> red, <span class="keywordtype">float</span> green, <span class="keywordtype">float</span> blue, <span class="keywordtype">float</span> alpha); |
---|
103 | <a name="l00186"></a>00186 |
---|
104 | <a name="l00197"></a>00197 DS_API <span class="keywordtype">void</span> <a class="code" href="group__drawstuff.html#gfba4fde6b0b74f6cd422036dedd08836" title="Draw a box.">dsDrawBox</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> pos[3], <span class="keyword">const</span> <span class="keywordtype">float</span> R[12], <span class="keyword">const</span> <span class="keywordtype">float</span> sides[3]); |
---|
105 | <a name="l00198"></a>00198 |
---|
106 | <a name="l00206"></a>00206 DS_API <span class="keywordtype">void</span> <a class="code" href="group__drawstuff.html#g0802e7641f8028182b69fabc729a6704" title="Draw a sphere.">dsDrawSphere</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> pos[3], <span class="keyword">const</span> <span class="keywordtype">float</span> R[12], <span class="keywordtype">float</span> radius); |
---|
107 | <a name="l00207"></a>00207 |
---|
108 | <a name="l00218"></a>00218 DS_API <span class="keywordtype">void</span> <a class="code" href="group__drawstuff.html#gcfcbae15cee67eceb45cd96bf01484d4" title="Draw a triangle.">dsDrawTriangle</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> pos[3], <span class="keyword">const</span> <span class="keywordtype">float</span> R[12], |
---|
109 | <a name="l00219"></a>00219 <span class="keyword">const</span> <span class="keywordtype">float</span> *v0, <span class="keyword">const</span> <span class="keywordtype">float</span> *v1, <span class="keyword">const</span> <span class="keywordtype">float</span> *v2, <span class="keywordtype">int</span> solid); |
---|
110 | <a name="l00220"></a>00220 |
---|
111 | <a name="l00225"></a>00225 DS_API <span class="keywordtype">void</span> <a class="code" href="group__drawstuff.html#g0b09b41f1f6500b293678aa1691f1537" title="Draw a z-aligned cylinder.">dsDrawCylinder</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> pos[3], <span class="keyword">const</span> <span class="keywordtype">float</span> R[12], |
---|
112 | <a name="l00226"></a>00226 <span class="keywordtype">float</span> length, <span class="keywordtype">float</span> radius); |
---|
113 | <a name="l00227"></a>00227 |
---|
114 | <a name="l00232"></a>00232 DS_API <span class="keywordtype">void</span> <a class="code" href="group__drawstuff.html#gce8f6c8a9f2871dac2f5e7f159b96feb" title="Draw a z-aligned capsule.">dsDrawCapsule</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> pos[3], <span class="keyword">const</span> <span class="keywordtype">float</span> R[12], |
---|
115 | <a name="l00233"></a>00233 <span class="keywordtype">float</span> length, <span class="keywordtype">float</span> radius); |
---|
116 | <a name="l00234"></a>00234 |
---|
117 | <a name="l00239"></a>00239 DS_API <span class="keywordtype">void</span> <a class="code" href="group__drawstuff.html#g61b166a9b7c04063a27be982051f4af5" title="Draw a line.">dsDrawLine</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> pos1[3], <span class="keyword">const</span> <span class="keywordtype">float</span> pos2[3]); |
---|
118 | <a name="l00240"></a>00240 |
---|
119 | <a name="l00245"></a>00245 DS_API <span class="keywordtype">void</span> <a class="code" href="group__drawstuff.html#g4b8754994a4cca9d51fce16445f0d612" title="Draw a convex shape.">dsDrawConvex</a>(<span class="keyword">const</span> <span class="keywordtype">float</span> pos[3], <span class="keyword">const</span> <span class="keywordtype">float</span> R[12], |
---|
120 | <a name="l00246"></a>00246 <span class="keywordtype">float</span> *_planes, |
---|
121 | <a name="l00247"></a>00247 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> _planecount, |
---|
122 | <a name="l00248"></a>00248 <span class="keywordtype">float</span> *_points, |
---|
123 | <a name="l00249"></a>00249 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> _pointcount, |
---|
124 | <a name="l00250"></a>00250 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *_polygons); |
---|
125 | <a name="l00251"></a>00251 |
---|
126 | <a name="l00252"></a>00252 <span class="comment">/* these drawing functions are identical to the ones above, except they take</span> |
---|
127 | <a name="l00253"></a>00253 <span class="comment"> * double arrays for `pos' and `R'.</span> |
---|
128 | <a name="l00254"></a>00254 <span class="comment"> */</span> |
---|
129 | <a name="l00255"></a>00255 DS_API <span class="keywordtype">void</span> dsDrawBoxD (<span class="keyword">const</span> <span class="keywordtype">double</span> pos[3], <span class="keyword">const</span> <span class="keywordtype">double</span> R[12], |
---|
130 | <a name="l00256"></a>00256 <span class="keyword">const</span> <span class="keywordtype">double</span> sides[3]); |
---|
131 | <a name="l00257"></a>00257 DS_API <span class="keywordtype">void</span> dsDrawSphereD (<span class="keyword">const</span> <span class="keywordtype">double</span> pos[3], <span class="keyword">const</span> <span class="keywordtype">double</span> R[12], |
---|
132 | <a name="l00258"></a>00258 <span class="keyword">const</span> <span class="keywordtype">float</span> radius); |
---|
133 | <a name="l00259"></a>00259 DS_API <span class="keywordtype">void</span> dsDrawTriangleD (<span class="keyword">const</span> <span class="keywordtype">double</span> pos[3], <span class="keyword">const</span> <span class="keywordtype">double</span> R[12], |
---|
134 | <a name="l00260"></a>00260 <span class="keyword">const</span> <span class="keywordtype">double</span> *v0, <span class="keyword">const</span> <span class="keywordtype">double</span> *v1, <span class="keyword">const</span> <span class="keywordtype">double</span> *v2, <span class="keywordtype">int</span> solid); |
---|
135 | <a name="l00261"></a>00261 DS_API <span class="keywordtype">void</span> dsDrawCylinderD (<span class="keyword">const</span> <span class="keywordtype">double</span> pos[3], <span class="keyword">const</span> <span class="keywordtype">double</span> R[12], |
---|
136 | <a name="l00262"></a>00262 <span class="keywordtype">float</span> length, <span class="keywordtype">float</span> radius); |
---|
137 | <a name="l00263"></a>00263 DS_API <span class="keywordtype">void</span> dsDrawCapsuleD (<span class="keyword">const</span> <span class="keywordtype">double</span> pos[3], <span class="keyword">const</span> <span class="keywordtype">double</span> R[12], |
---|
138 | <a name="l00264"></a>00264 <span class="keywordtype">float</span> length, <span class="keywordtype">float</span> radius); |
---|
139 | <a name="l00265"></a>00265 DS_API <span class="keywordtype">void</span> dsDrawLineD (<span class="keyword">const</span> <span class="keywordtype">double</span> pos1[3], <span class="keyword">const</span> <span class="keywordtype">double</span> pos2[3]); |
---|
140 | <a name="l00266"></a>00266 DS_API <span class="keywordtype">void</span> dsDrawConvexD(<span class="keyword">const</span> <span class="keywordtype">double</span> pos[3], <span class="keyword">const</span> <span class="keywordtype">double</span> R[12], |
---|
141 | <a name="l00267"></a>00267 <span class="keywordtype">double</span> *_planes, |
---|
142 | <a name="l00268"></a>00268 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> _planecount, |
---|
143 | <a name="l00269"></a>00269 <span class="keywordtype">double</span> *_points, |
---|
144 | <a name="l00270"></a>00270 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> _pointcount, |
---|
145 | <a name="l00271"></a>00271 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *_polygons); |
---|
146 | <a name="l00272"></a>00272 |
---|
147 | <a name="l00280"></a>00280 DS_API <span class="keywordtype">void</span> <a class="code" href="group__drawstuff.html#g211aa83d5c5d102cdda303cc7aeb2fd5" title="Set the quality with which curved objects are rendered.">dsSetSphereQuality</a> (<span class="keywordtype">int</span> n); <span class="comment">/* default = 1 */</span> |
---|
148 | <a name="l00281"></a>00281 DS_API <span class="keywordtype">void</span> dsSetCapsuleQuality (<span class="keywordtype">int</span> n); <span class="comment">/* default = 3 */</span> |
---|
149 | <a name="l00282"></a>00282 |
---|
150 | <a name="l00283"></a>00283 <span class="comment">// Backwards compatible API</span> |
---|
151 | <a name="l00284"></a>00284 <span class="preprocessor">#define dsDrawCappedCylinder dsDrawCapsule</span> |
---|
152 | <a name="l00285"></a>00285 <span class="preprocessor"></span><span class="preprocessor">#define dsDrawCappedCylinderD dsDrawCapsuleD</span> |
---|
153 | <a name="l00286"></a>00286 <span class="preprocessor"></span><span class="preprocessor">#define dsSetCappedCylinderQuality dsSetCapsuleQuality</span> |
---|
154 | <a name="l00287"></a>00287 <span class="preprocessor"></span> |
---|
155 | <a name="l00288"></a>00288 <span class="comment">/* closing bracket for extern "C" */</span> |
---|
156 | <a name="l00289"></a>00289 <span class="preprocessor">#ifdef __cplusplus</span> |
---|
157 | <a name="l00290"></a>00290 <span class="preprocessor"></span>} |
---|
158 | <a name="l00291"></a>00291 <span class="preprocessor">#endif</span> |
---|
159 | <a name="l00292"></a>00292 <span class="preprocessor"></span> |
---|
160 | <a name="l00293"></a>00293 <span class="preprocessor">#endif</span> |
---|
161 | <a name="l00294"></a>00294 <span class="preprocessor"></span> |
---|
162 | </pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Fri Oct 12 08:36:51 2007 for Open Dynamics Engine by |
---|
163 | <a href="http://www.doxygen.org/index.html"> |
---|
164 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> |
---|
165 | </body> |
---|
166 | </html> |
---|