drawstuff.h

00001 /*************************************************************************
00002  *                                                                       *
00003  * Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith.       *
00004  * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
00005  *                                                                       *
00006  * This library is free software; you can redistribute it and/or         *
00007  * modify it under the terms of EITHER:                                  *
00008  *   (1) The GNU Lesser General Public License as published by the Free  *
00009  *       Software Foundation; either version 2.1 of the License, or (at  *
00010  *       your option) any later version. The text of the GNU Lesser      *
00011  *       General Public License is included with this library in the     *
00012  *       file LICENSE.TXT.                                               *
00013  *   (2) The BSD-style license that is included with this library in     *
00014  *       the file LICENSE-BSD.TXT.                                       *
00015  *                                                                       *
00016  * This library is distributed in the hope that it will be useful,       *
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
00019  * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
00020  *                                                                       *
00021  *************************************************************************/
00022 
00041 #ifndef __DRAWSTUFF_H__
00042 #define __DRAWSTUFF_H__
00043 
00044 /* Define a DLL export symbol for those platforms that need it */
00045 #if defined(ODE_PLATFORM_WINDOWS)
00046   #if defined(DS_DLL)
00047     #define DS_API __declspec(dllexport)
00048   #elif !defined(DS_LIB)
00049     #define DS_DLL_API __declspec(dllimport)
00050   #endif
00051 #endif
00052     
00053 #if !defined(DS_API)
00054   #define DS_API
00055 #endif
00056 
00057 #ifdef __cplusplus
00058 extern "C" {
00059 #endif
00060 
00061 
00062 #include <drawstuff/version.h>
00063 
00064 
00065 /* texture numbers */
00066 #define DS_NONE   0  /* uses the current color instead of a texture */
00067 #define DS_WOOD   1
00068 
00069 
00075 typedef struct dsFunctions {
00076   int version;       /* put DS_VERSION here */
00077   /* version 1 data */
00078   void (*start)();      /* called before sim loop starts */
00079   void (*step) (int pause);   /* called before every frame */
00080   void (*command) (int cmd);  /* called if a command key is pressed */
00081   void (*stop)();    /* called after sim loop exits */
00082   /* version 2 data */
00083   char *path_to_textures;  /* if nonzero, path to texture files */
00084 } dsFunctions;
00085 
00086 
00095 DS_API void dsSimulationLoop (int argc, char **argv,
00096              int window_width, int window_height,
00097              struct dsFunctions *fn);
00098 
00105 DS_API void dsError (char *msg, ...);
00106 
00113 DS_API void dsDebug (char *msg, ...);
00114 
00120 DS_API void dsPrint (char *msg, ...);
00121 
00130 DS_API void dsSetViewpoint (float xyz[3], float hpr[3]);
00131 
00132 
00139 DS_API void dsGetViewpoint (float xyz[3], float hpr[3]);
00140 
00149 DS_API void dsStop();
00150 
00156 DS_API double dsElapsedTime();
00157 
00168 DS_API void dsSetTexture (int texture_number);
00169 
00177 DS_API void dsSetColor (float red, float green, float blue);
00178 
00185 DS_API void dsSetColorAlpha (float red, float green, float blue, float alpha);
00186 
00197 DS_API void dsDrawBox (const float pos[3], const float R[12], const float sides[3]);
00198 
00206 DS_API void dsDrawSphere (const float pos[3], const float R[12], float radius);
00207 
00218 DS_API void dsDrawTriangle (const float pos[3], const float R[12],
00219            const float *v0, const float *v1, const float *v2, int solid);
00220 
00225 DS_API void dsDrawCylinder (const float pos[3], const float R[12],
00226            float length, float radius);
00227 
00232 DS_API void dsDrawCapsule (const float pos[3], const float R[12],
00233           float length, float radius);
00234 
00239 DS_API void dsDrawLine (const float pos1[3], const float pos2[3]);
00240 
00245 DS_API void dsDrawConvex(const float pos[3], const float R[12],
00246         float *_planes,
00247         unsigned int _planecount,
00248         float *_points,
00249         unsigned int _pointcount,
00250         unsigned int *_polygons);
00251 
00252  /* these drawing functions are identical to the ones above, except they take
00253  * double arrays for `pos' and `R'.
00254  */
00255 DS_API void dsDrawBoxD (const double pos[3], const double R[12],
00256        const double sides[3]);
00257 DS_API void dsDrawSphereD (const double pos[3], const double R[12],
00258           const float radius);
00259 DS_API void dsDrawTriangleD (const double pos[3], const double R[12],
00260             const double *v0, const double *v1, const double *v2, int solid);
00261 DS_API void dsDrawCylinderD (const double pos[3], const double R[12],
00262             float length, float radius);
00263 DS_API void dsDrawCapsuleD (const double pos[3], const double R[12],
00264            float length, float radius);
00265 DS_API void dsDrawLineD (const double pos1[3], const double pos2[3]);
00266 DS_API void dsDrawConvexD(const double pos[3], const double R[12],
00267         double *_planes,
00268         unsigned int _planecount,
00269         double *_points,
00270         unsigned int _pointcount,
00271         unsigned int *_polygons);
00272 
00280 DS_API void dsSetSphereQuality (int n);      /* default = 1 */
00281 DS_API void dsSetCapsuleQuality (int n);     /* default = 3 */
00282 
00283 // Backwards compatible API
00284 #define dsDrawCappedCylinder dsDrawCapsule
00285 #define dsDrawCappedCylinderD dsDrawCapsuleD
00286 #define dsSetCappedCylinderQuality dsSetCapsuleQuality
00287 
00288 /* closing bracket for extern "C" */
00289 #ifdef __cplusplus
00290 }
00291 #endif
00292 
00293 #endif
00294 

Generated on Fri Oct 12 08:36:51 2007 for Open Dynamics Engine by  doxygen 1.5.3