OpenSimMirror/libraries/ode-0.9/docs/drawstuff_8h-source.html

167 lines
20 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Open Dynamics Engine: drawstuff.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.3 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<h1>drawstuff.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*************************************************************************</span>
<a name="l00002"></a>00002 <span class="comment"> * *</span>
<a name="l00003"></a>00003 <span class="comment"> * Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *</span>
<a name="l00004"></a>00004 <span class="comment"> * All rights reserved. Email: russ@q12.org Web: www.q12.org *</span>
<a name="l00005"></a>00005 <span class="comment"> * *</span>
<a name="l00006"></a>00006 <span class="comment"> * This library is free software; you can redistribute it and/or *</span>
<a name="l00007"></a>00007 <span class="comment"> * modify it under the terms of EITHER: *</span>
<a name="l00008"></a>00008 <span class="comment"> * (1) The GNU Lesser General Public License as published by the Free *</span>
<a name="l00009"></a>00009 <span class="comment"> * Software Foundation; either version 2.1 of the License, or (at *</span>
<a name="l00010"></a>00010 <span class="comment"> * your option) any later version. The text of the GNU Lesser *</span>
<a name="l00011"></a>00011 <span class="comment"> * General Public License is included with this library in the *</span>
<a name="l00012"></a>00012 <span class="comment"> * file LICENSE.TXT. *</span>
<a name="l00013"></a>00013 <span class="comment"> * (2) The BSD-style license that is included with this library in *</span>
<a name="l00014"></a>00014 <span class="comment"> * the file LICENSE-BSD.TXT. *</span>
<a name="l00015"></a>00015 <span class="comment"> * *</span>
<a name="l00016"></a>00016 <span class="comment"> * This library is distributed in the hope that it will be useful, *</span>
<a name="l00017"></a>00017 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of *</span>
<a name="l00018"></a>00018 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *</span>
<a name="l00019"></a>00019 <span class="comment"> * LICENSE.TXT and LICENSE-BSD.TXT for more details. *</span>
<a name="l00020"></a>00020 <span class="comment"> * *</span>
<a name="l00021"></a>00021 <span class="comment"> *************************************************************************/</span>
<a name="l00022"></a>00022
<a name="l00041"></a>00041 <span class="preprocessor">#ifndef __DRAWSTUFF_H__</span>
<a name="l00042"></a>00042 <span class="preprocessor"></span><span class="preprocessor">#define __DRAWSTUFF_H__</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span>
<a name="l00044"></a>00044 <span class="comment">/* Define a DLL export symbol for those platforms that need it */</span>
<a name="l00045"></a>00045 <span class="preprocessor">#if defined(ODE_PLATFORM_WINDOWS)</span>
<a name="l00046"></a>00046 <span class="preprocessor"></span><span class="preprocessor"> #if defined(DS_DLL)</span>
<a name="l00047"></a>00047 <span class="preprocessor"></span><span class="preprocessor"> #define DS_API __declspec(dllexport)</span>
<a name="l00048"></a>00048 <span class="preprocessor"></span><span class="preprocessor"> #elif !defined(DS_LIB)</span>
<a name="l00049"></a>00049 <span class="preprocessor"></span><span class="preprocessor"> #define DS_DLL_API __declspec(dllimport)</span>
<a name="l00050"></a>00050 <span class="preprocessor"></span><span class="preprocessor"> #endif</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span>
<a name="l00053"></a>00053 <span class="preprocessor">#if !defined(DS_API)</span>
<a name="l00054"></a>00054 <span class="preprocessor"></span><span class="preprocessor"> #define DS_API</span>
<a name="l00055"></a>00055 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00056"></a>00056 <span class="preprocessor"></span>
<a name="l00057"></a>00057 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00058"></a>00058 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
<a name="l00059"></a>00059 <span class="preprocessor">#endif</span>
<a name="l00060"></a>00060 <span class="preprocessor"></span>
<a name="l00061"></a>00061
<a name="l00062"></a>00062 <span class="preprocessor">#include &lt;drawstuff/version.h&gt;</span>
<a name="l00063"></a>00063
<a name="l00064"></a>00064
<a name="l00065"></a>00065 <span class="comment">/* texture numbers */</span>
<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>
<a name="l00067"></a>00067 <span class="preprocessor">#define DS_WOOD 1</span>
<a name="l00068"></a>00068 <span class="preprocessor"></span>
<a name="l00069"></a>00069
<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> {
<a name="l00076"></a>00076 <span class="keywordtype">int</span> version; <span class="comment">/* put DS_VERSION here */</span>
<a name="l00077"></a>00077 <span class="comment">/* version 1 data */</span>
<a name="l00078"></a>00078 void (*start)(); <span class="comment">/* called before sim loop starts */</span>
<a name="l00079"></a>00079 void (*step) (<span class="keywordtype">int</span> pause); <span class="comment">/* called before every frame */</span>
<a name="l00080"></a>00080 void (*command) (<span class="keywordtype">int</span> cmd); <span class="comment">/* called if a command key is pressed */</span>
<a name="l00081"></a>00081 void (*stop)(); <span class="comment">/* called after sim loop exits */</span>
<a name="l00082"></a>00082 <span class="comment">/* version 2 data */</span>
<a name="l00083"></a>00083 <span class="keywordtype">char</span> *path_to_textures; <span class="comment">/* if nonzero, path to texture files */</span>
<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>;
<a name="l00085"></a>00085
<a name="l00086"></a>00086
<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,
<a name="l00096"></a>00096 <span class="keywordtype">int</span> window_width, <span class="keywordtype">int</span> window_height,
<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);
<a name="l00098"></a>00098
<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, ...);
<a name="l00106"></a>00106
<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, ...);
<a name="l00114"></a>00114
<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, ...);
<a name="l00121"></a>00121
<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]);
<a name="l00131"></a>00131
<a name="l00132"></a>00132
<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]);
<a name="l00140"></a>00140
<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>();
<a name="l00150"></a>00150
<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>();
<a name="l00157"></a>00157
<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);
<a name="l00169"></a>00169
<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);
<a name="l00178"></a>00178
<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);
<a name="l00186"></a>00186
<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]);
<a name="l00198"></a>00198
<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);
<a name="l00207"></a>00207
<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],
<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);
<a name="l00220"></a>00220
<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],
<a name="l00226"></a>00226 <span class="keywordtype">float</span> length, <span class="keywordtype">float</span> radius);
<a name="l00227"></a>00227
<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],
<a name="l00233"></a>00233 <span class="keywordtype">float</span> length, <span class="keywordtype">float</span> radius);
<a name="l00234"></a>00234
<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]);
<a name="l00240"></a>00240
<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],
<a name="l00246"></a>00246 <span class="keywordtype">float</span> *_planes,
<a name="l00247"></a>00247 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> _planecount,
<a name="l00248"></a>00248 <span class="keywordtype">float</span> *_points,
<a name="l00249"></a>00249 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> _pointcount,
<a name="l00250"></a>00250 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *_polygons);
<a name="l00251"></a>00251
<a name="l00252"></a>00252 <span class="comment">/* these drawing functions are identical to the ones above, except they take</span>
<a name="l00253"></a>00253 <span class="comment"> * double arrays for `pos' and `R'.</span>
<a name="l00254"></a>00254 <span class="comment"> */</span>
<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],
<a name="l00256"></a>00256 <span class="keyword">const</span> <span class="keywordtype">double</span> sides[3]);
<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],
<a name="l00258"></a>00258 <span class="keyword">const</span> <span class="keywordtype">float</span> radius);
<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],
<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);
<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],
<a name="l00262"></a>00262 <span class="keywordtype">float</span> length, <span class="keywordtype">float</span> radius);
<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],
<a name="l00264"></a>00264 <span class="keywordtype">float</span> length, <span class="keywordtype">float</span> radius);
<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]);
<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],
<a name="l00267"></a>00267 <span class="keywordtype">double</span> *_planes,
<a name="l00268"></a>00268 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> _planecount,
<a name="l00269"></a>00269 <span class="keywordtype">double</span> *_points,
<a name="l00270"></a>00270 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> _pointcount,
<a name="l00271"></a>00271 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *_polygons);
<a name="l00272"></a>00272
<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>
<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>
<a name="l00282"></a>00282
<a name="l00283"></a>00283 <span class="comment">// Backwards compatible API</span>
<a name="l00284"></a>00284 <span class="preprocessor">#define dsDrawCappedCylinder dsDrawCapsule</span>
<a name="l00285"></a>00285 <span class="preprocessor"></span><span class="preprocessor">#define dsDrawCappedCylinderD dsDrawCapsuleD</span>
<a name="l00286"></a>00286 <span class="preprocessor"></span><span class="preprocessor">#define dsSetCappedCylinderQuality dsSetCapsuleQuality</span>
<a name="l00287"></a>00287 <span class="preprocessor"></span>
<a name="l00288"></a>00288 <span class="comment">/* closing bracket for extern "C" */</span>
<a name="l00289"></a>00289 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00290"></a>00290 <span class="preprocessor"></span>}
<a name="l00291"></a>00291 <span class="preprocessor">#endif</span>
<a name="l00292"></a>00292 <span class="preprocessor"></span>
<a name="l00293"></a>00293 <span class="preprocessor">#endif</span>
<a name="l00294"></a>00294 <span class="preprocessor"></span>
</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&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address>
</body>
</html>