/*
	This file is part of Floculate.
	Copyright (C) 2008  Bill Whitacre

	Floculate is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	Floculate is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef DRAW_H
#define DRAW_H

#include <stdlib.h>
#include <math.h>
#include "../inc/rat_physics.h"

#if defined(__APPLE__)
#	include <OpenGL/gl.h>
#else
#	include <GL/gl.h>
#endif

#ifndef MATH_PI
#	ifndef M_PI
#		define MATH_PI 3.14159f
#	else
#		define MATH_PI M_PI
#	endif
#endif

#ifdef __cplusplus
extern "C" {
#endif

extern int rat_pretty_draw;

void rat_line_width(rat_real width);
void rat_point_size(rat_real size);
void rat_set_color(rat_real r,rat_real g,rat_real b,rat_real a);
void rat_get_color(rat_real *r,rat_real *g,rat_real *b,rat_real *a);

void rat_draw_point(rat_real x,rat_real y);
void rat_draw_points(rat_real *points,unsigned int numpts);
void rat_draw_line(rat_real x1,rat_real y1,rat_real x2,rat_real y2);
void rat_draw_lines(rat_real *points,unsigned int numpts);
void rat_draw_line_strip(rat_real *points,unsigned int numpts);
void rat_draw_line_loop(rat_real *points,unsigned int numpts);
void rat_draw_quads(rat_real *points,unsigned int numpts);
void rat_draw_triangles(rat_real *points,unsigned int numpts);
void rat_draw_triangle_fan(rat_real *points,unsigned int numpts);
void rat_draw_triangle_strip(rat_real *points,unsigned int numpts);

void rat_draw_rect(rat_real x1,rat_real y1,rat_real x2,rat_real y2,int fill);
void rat_draw_circle(rat_real x,rat_real y,rat_real radius,rat_real stepdivisor,int fill);
void rat_draw_elipse(rat_real x,rat_real y,rat_real rx,rat_real ry,rat_real stepdivisor,int fill);

void rat_draw_world(rat_world *world,int draw_bodymgr,int draw_arbiters,int draw_bboxes);
void rat_draw_body(rat_body *body,int pass);
void rat_draw_constraint(rat_constraint *constraint);
void rat_draw_spring(rat_spring *spring);
void rat_draw_arbiter(rat_arbiter *arbiter);
void rat_draw_quad_tree_matrix(rat_quad_tree_matrix *matrix);
void rat_draw_quad_tree(rat_quad_tree *tree);

#ifdef __cplusplus
}
#endif

#endif
