- Main Page
- Modules
- Classes
- Files
- Related Pages

- File List
- File Members

# src/drawstuff/drawstuff.h

Go to the documentation of this file.

    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 "version.h"
    00063
    00064 /* texture numbers */
    00065 #define DS_NONE   0 /* uses the current color instead of a texture */
    00066 #define DS_WOOD   1
    00067
    00068
    00074 typedef struct dsFunctions {
    00075   int version;          /* put DS_VERSION here */
    00076   /* version 1 data */
    00077   void (*start)();      /* called before sim loop starts */
    00078   void (*step) (int pause); /* called before every frame */
    00079   void (*command) (int cmd);    /* called if a command key is pressed */
    00080   void (*stop)();       /* called after sim loop exits */
    00081   /* version 2 data */
    00082   char *path_to_textures;   /* if nonzero, path to texture files */
    00083 } dsFunctions;
    00084
    00085
    00094 DS_API void dsSimulationLoop (int argc, char **argv,
    00095                int window_width, int window_height,
    00096                struct dsFunctions *fn);
    00097
    00104 DS_API void dsError (char *msg, ...);
    00105
    00112 DS_API void dsDebug (char *msg, ...);
    00113
    00119 DS_API void dsPrint (char *msg, ...);
    00120
    00129 DS_API void dsSetViewpoint (float xyz[3], float hpr[3]);
    00130
    00131
    00138 DS_API void dsGetViewpoint (float xyz[3], float hpr[3]);
    00139
    00148 DS_API void dsStop();
    00149
    00155 DS_API double dsElapsedTime();
    00156
    00161 DS_API double dsGetTime();
    00162
    00168 DS_API void dsSleep(int miliseconds);
    00169
    00180 DS_API void dsSetTexture (int texture_number);
    00181
    00189 DS_API void dsSetColor (float red, float green, float blue);
    00190
    00197 DS_API void dsSetColorAlpha (float red, float green, float blue, float alpha);
    00198
    00209 DS_API void dsDrawBox (const float pos[3], const float R[12], const float sides[3]);
    00210
    00218 DS_API void dsDrawSphere (const float pos[3], const float R[12], float radius);
    00219
    00230 DS_API void dsDrawTriangle (const float pos[3], const float R[12],
    00231              const float *v0, const float *v1, const float *v2, int solid);
    00232
    00237 DS_API void dsDrawCylinder (const float pos[3], const float R[12],
    00238              float length, float radius);
    00239
    00244 DS_API void dsDrawCapsule (const float pos[3], const float R[12],
    00245             float length, float radius);
    00246
    00251 DS_API void dsDrawLine (const float pos1[3], const float pos2[3]);
    00252
    00257 DS_API void dsDrawConvex(const float pos[3], const float R[12],
    00258           float *_planes,
    00259           unsigned int _planecount,
    00260           float *_points,
    00261           unsigned int _pointcount,
    00262           unsigned int *_polygons);
    00263
    00264  /* these drawing functions are identical to the ones above, except they take
    00265  * double arrays for `pos' and `R'.
    00266  */
    00267 DS_API void dsDrawBoxD (const double pos[3], const double R[12],
    00268          const double sides[3]);
    00269 DS_API void dsDrawSphereD (const double pos[3], const double R[12],
    00270             const float radius);
    00271 DS_API void dsDrawTriangleD (const double pos[3], const double R[12],
    00272               const double *v0, const double *v1, const double *v2, int solid);
    00273 DS_API void dsDrawCylinderD (const double pos[3], const double R[12],
    00274               float length, float radius);
    00275 DS_API void dsDrawCapsuleD (const double pos[3], const double R[12],
    00276              float length, float radius);
    00277 DS_API void dsDrawLineD (const double pos1[3], const double pos2[3]);
    00278 DS_API void dsDrawConvexD(const double pos[3], const double R[12],
    00279           double *_planes,
    00280           unsigned int _planecount,
    00281           double *_points,
    00282           unsigned int _pointcount,
    00283           unsigned int *_polygons);
    00284
    00292 DS_API void dsSetSphereQuality (int n);     /* default = 1 */
    00293 DS_API void dsSetCapsuleQuality (int n);        /* default = 3 */
    00294
    00295 // Backwards compatible API
    00296 #define dsDrawCappedCylinder dsDrawCapsule
    00297 #define dsDrawCappedCylinderD dsDrawCapsuleD
    00298 #define dsSetCappedCylinderQuality dsSetCapsuleQuality
    00299
    00300 /* closing bracket for extern "C" */
    00301 #ifdef __cplusplus
    00302 }
    00303 #endif
    00304
    00305 #endif
    00306