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

- File List
- File Members

# src/drawstuff/drawstuff.cpp File Reference

`#include <ode/config.h>`
`#include <GL/gl.h>`
`#include <GL/glu.h>`
`#include "drawstuff.h"`
`#include "internal.h"`

## Classes
class | Image
class | Texture
## Defines
#define | DEFAULT_PATH_TO_TEXTURES "./textures/"
#define | M_PI (3.14159265358979323846)
#define | RAD_TO_DEG (180.0/M_PI)
#define | DEG_TO_RAD (M_PI/180.0)
#define | LIGHTX (1.0f)
#define | LIGHTY (0.4f)
#define | SHADOW_INTENSITY (0.65f)
#define | GROUND_R (0.5f)
#define | GROUND_G (0.5f)
#define | GROUND_B (0.3f)
#define | dCROSS(a, op, b, c)
#define | ICX 0.525731112119133606f
#define | ICZ 0.850650808352039932f
## Typedefs
typedef unsigned char | byte
## Functions
float | dDOT (const float *a, const float *b)
static void | normalizeVector3 (float v[3])
static void | skipWhiteSpace (char *filename, FILE *f)
static int | readNumber (char *filename, FILE *f)
static void | setCamera (float x, float y, float z, float h, float p, float r)
static void | setColor (float r, float g, float b, float alpha)
static void | setTransform (const float pos[3], const float R[12])
static void | setTransformD (const double pos[3], const double R[12])
static void | setShadowTransform ()
static void | drawConvex (float *_planes, unsigned int _planecount, float *_points, unsigned int _pointcount, unsigned int *_polygons)
static void | drawConvexD (double *_planes, unsigned int _planecount, double *_points, unsigned int _pointcount, unsigned int *_polygons)
static void | drawBox (const float sides[3])
static void | drawPatch (float p1[3], float p2[3], float p3[3], int level)
static void | drawSphere ()
static void | drawSphereShadow (float px, float py, float pz, float radius)
static void | drawTriangle (const float *v0, const float *v1, const float *v2, int solid)
static void | drawTriangleD (const double *v0, const double *v1, const double *v2, int solid)
static void | drawCapsule (float l, float r)
static void | drawCylinder (float l, float r, float zoffset)
static void | initMotionModel ()
static void | wrapCameraAngles ()
void | dsMotion (int mode, int deltax, int deltay)
void | dsStartGraphics (int width, int height, dsFunctions *fn)
void | dsStopGraphics ()
static void | drawSky (float view_xyz[3])
static void | drawGround ()
static void | drawPyramidGrid ()
void | dsDrawFrame (int width, int height, dsFunctions *fn, int pause)
int | dsGetShadows ()
void | dsSetShadows (int a)
int | dsGetTextures ()
void | dsSetTextures (int a)
static void | setupDrawingMode ()
static void | setShadowDrawingMode ()
void | dsSimulationLoop (int argc, char **argv, int window_width, int window_height, dsFunctions *fn)
| Does the complete simulation. This function starts running the simulation, and only exits when the simulation is done. Function pointers should be provided for the callbacks.
void | dsSetViewpoint (float xyz[3], float hpr[3])
| Sets the viewpoint.
void | dsGetViewpoint (float xyz[3], float hpr[3])
| Gets the viewpoint.
void | dsSetTexture (int texture_number)
| Toggle the rendering of textures. It changes the way objects are drawn. these changes will apply to all further dsDrawXXX() functions.
void | dsSetColor (float red, float green, float blue)
| Set the color with which geometry is drawn.
void | dsSetColorAlpha (float red, float green, float blue, float alpha)
| Set the color and transparency with which geometry is drawn.
void | dsDrawBox (const float pos[3], const float R[12], const float sides[3])
| Draw a box.
void | dsDrawConvex (const float pos[3], const float R[12], float *_planes, unsigned int _planecount, float *_points, unsigned int _pointcount, unsigned int *_polygons)
| Draw a convex shape.
void | dsDrawSphere (const float pos[3], const float R[12], float radius)
| Draw a sphere.
void | dsDrawTriangle (const float pos[3], const float R[12], const float *v0, const float *v1, const float *v2, int solid)
| Draw a triangle.
void | dsDrawCylinder (const float pos[3], const float R[12], float length, float radius)
| Draw a z-aligned cylinder.
void | dsDrawCapsule (const float pos[3], const float R[12], float length, float radius)
| Draw a z-aligned capsule.
void | dsDrawLine (const float pos1[3], const float pos2[3])
| Draw a line.
void | dsDrawBoxD (const double pos[3], const double R[12], const double sides[3])
void | dsDrawConvexD (const double pos[3], const double R[12], double *_planes, unsigned int _planecount, double *_points, unsigned int _pointcount, unsigned int *_polygons)
void | dsDrawSphereD (const double pos[3], const double R[12], float radius)
void | dsDrawTriangleD (const double pos[3], const double R[12], const double *v0, const double *v1, const double *v2, int solid)
void | dsDrawCylinderD (const double pos[3], const double R[12], float length, float radius)
void | dsDrawCapsuleD (const double pos[3], const double R[12], float length, float radius)
void | dsDrawLineD (const double _pos1[3], const double _pos2[3])
void | dsSetSphereQuality (int n)
| Set the quality with which curved objects are rendered. Higher numbers are higher quality, but slower to draw. This must be set before the first objects are drawn to be effective. Default sphere quality is 1, default capsule quality is 3.
void | dsSetCapsuleQuality (int n)
## Variables
const float | ground_scale = 1.0f/1.0f
const float | ground_ofsx = 0.5
const float | ground_ofsy = 0.5
const float | sky_scale = 1.0f/4.0f
const float | sky_height = 1.0f
static float | color [4] = {0,0,0,0}
static int | tnum = 0
static int | sphere_quality = 1
static int | capped_cylinder_quality = 3
static float | view_xyz [3]
static float | view_hpr [3]
static int | current_state = 0
static int | use_textures = 1
static int | use_shadows = 1
static Texture * | sky_texture = 0
static Texture * | ground_texture = 0
static Texture * | wood_texture = 0

## Define Documentation

#define dCROSS | ( | a,
|  | op,
|  | b,
|  | c |  | ) |

Value:

    (a)[0] op ((b)[1]*(c)[2] - (b)[2]*(c)[1]); \
      (a)[1] op ((b)[2]*(c)[0] - (b)[0]*(c)[2]); \
      (a)[2] op ((b)[0]*(c)[1] - (b)[1]*(c)[0]);

#define DEFAULT_PATH_TO_TEXTURES "./textures/"

#define DEG_TO_RAD (M_PI/180.0)

#define GROUND_B (0.3f)

#define GROUND_G (0.5f)

#define GROUND_R (0.5f)

#define ICX 0.525731112119133606f

#define ICZ 0.850650808352039932f

#define LIGHTX (1.0f)

#define LIGHTY (0.4f)

#define M_PI (3.14159265358979323846)

#define RAD_TO_DEG (180.0/M_PI)

#define SHADOW_INTENSITY (0.65f)

## Typedef Documentation

typedef unsigned char byte

## Function Documentation

float dDOT | ( | const float * | a,
|  | const float * | b |
| ) |  |  | `[inline]`

static void drawBox | ( | const float | sides[3] | ) | `[static]`

static void drawCapsule | ( | float | l,
|  | float | r |
| ) |  |  | `[static]`

static void drawConvex | ( | float * | _planes,
|  | unsigned int | _planecount,
|  | float * | _points,
|  | unsigned int | _pointcount,
|  | unsigned int * | _polygons |
| ) |  |  | `[static]`

static void drawConvexD | ( | double * | _planes,
|  | unsigned int | _planecount,
|  | double * | _points,
|  | unsigned int | _pointcount,
|  | unsigned int * | _polygons |
| ) |  |  | `[static]`

static void drawCylinder | ( | float | l,
|  | float | r,
|  | float | zoffset |
| ) |  |  | `[static]`

static void drawGround | ( |  | ) | `[static]`

static void drawPatch | ( | float | p1[3],
|  | float | p2[3],
|  | float | p3[3],
|  | int | level |
| ) |  |  | `[static]`

static void drawPyramidGrid | ( |  | ) | `[static]`

static void drawSky | ( | float | view_xyz[3] | ) | `[static]`

static void drawSphere | ( |  | ) | `[static]`

static void drawSphereShadow | ( | float | px,
|  | float | py,
|  | float | pz,
|  | float | radius |
| ) |  |  | `[static]`

static void drawTriangle | ( | const float * | v0,
|  | const float * | v1,
|  | const float * | v2,
|  | int | solid |
| ) |  |  | `[static]`

static void drawTriangleD | ( | const double * | v0,
|  | const double * | v1,
|  | const double * | v2,
|  | int | solid |
| ) |  |  | `[static]`

void dsDrawBoxD | ( | const double | pos[3],
|  | const double | R[12],
|  | const double | sides[3] |
| ) |  |  |

void dsDrawCapsuleD | ( | const double | pos[3],
|  | const double | R[12],
|  | float | length,
|  | float | radius |
| ) |  |  |

void dsDrawConvexD | ( | const double | pos[3],
|  | const double | R[12],
|  | double * | _planes,
|  | unsigned int | _planecount,
|  | double * | _points,
|  | unsigned int | _pointcount,
|  | unsigned int * | _polygons |
| ) |  |  |

void dsDrawCylinderD | ( | const double | pos[3],
|  | const double | R[12],
|  | float | length,
|  | float | radius |
| ) |  |  |

void dsDrawFrame | ( | int | width,
|  | int | height,
|  | dsFunctions * | fn,
|  | int | pause |
| ) |  |  |

void dsDrawLineD | ( | const double | _pos1[3],
|  | const double | _pos2[3] |
| ) |  |  |

void dsDrawSphereD | ( | const double | pos[3],
|  | const double | R[12],
|  | float | radius |
| ) |  |  |

void dsDrawTriangleD | ( | const double | pos[3],
|  | const double | R[12],
|  | const double * | v0,
|  | const double * | v1,
|  | const double * | v2,
|  | int | solid |
| ) |  |  |

int dsGetShadows | ( |  | ) |

int dsGetTextures | ( |  | ) |

void dsMotion | ( | int | mode,
|  | int | deltax,
|  | int | deltay |
| ) |  |  |

void dsSetCapsuleQuality | ( | int | n | ) |

void dsSetShadows | ( | int | a | ) |

void dsSetTextures | ( | int | a | ) |

void dsStartGraphics | ( | int | width,
|  | int | height,
|  | dsFunctions * | fn |
| ) |  |  |

void dsStopGraphics | ( |  | ) |

static void initMotionModel | ( |  | ) | `[static]`

static void normalizeVector3 | ( | float | v[3] | ) | `[static]`

static int readNumber | ( | char * | filename,
|  | FILE * | f |
| ) |  |  | `[static]`

static void setCamera | ( | float | x,
|  | float | y,
|  | float | z,
|  | float | h,
|  | float | p,
|  | float | r |
| ) |  |  | `[static]`

static void setColor | ( | float | r,
|  | float | g,
|  | float | b,
|  | float | alpha |
| ) |  |  | `[static]`

static void setShadowDrawingMode | ( |  | ) | `[static]`

static void setShadowTransform | ( |  | ) | `[static]`

static void setTransform | ( | const float | pos[3],
|  | const float | R[12] |
| ) |  |  | `[static]`

static void setTransformD | ( | const double | pos[3],
|  | const double | R[12] |
| ) |  |  | `[static]`

static void setupDrawingMode | ( |  | ) | `[static]`

static void skipWhiteSpace | ( | char * | filename,
|  | FILE * | f |
| ) |  |  | `[static]`

static void wrapCameraAngles | ( |  | ) | `[static]`

## Variable Documentation

int capped_cylinder_quality = 3`[static]`

float color[4] = {0,0,0,0}`[static]`

int current_state = 0`[static]`

const float ground_ofsx = 0.5

const float ground_ofsy = 0.5

const float ground_scale = 1.0f/1.0f

Texture* ground_texture = 0`[static]`

const float sky_height = 1.0f

const float sky_scale = 1.0f/4.0f

Texture* sky_texture = 0`[static]`

int sphere_quality = 1`[static]`

int tnum = 0`[static]`

int use_shadows = 1`[static]`

int use_textures = 1`[static]`

float view_hpr[3]`[static]`

float view_xyz[3]`[static]`

Texture* wood_texture = 0`[static]`