2011-12-10 13:25:22 +00:00
|
|
|
#ifndef _PAYSAGES_TYPES_H_
|
|
|
|
#define _PAYSAGES_TYPES_H_
|
|
|
|
|
2012-01-29 17:39:56 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2011-12-23 22:58:50 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2011-12-10 13:25:22 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
double x;
|
|
|
|
double y;
|
|
|
|
double z;
|
|
|
|
} Vector3;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
double a;
|
|
|
|
double b;
|
|
|
|
double c;
|
|
|
|
double d;
|
|
|
|
double e;
|
|
|
|
double f;
|
|
|
|
double g;
|
|
|
|
double h;
|
|
|
|
double i;
|
|
|
|
double j;
|
|
|
|
double k;
|
|
|
|
double l;
|
|
|
|
double m;
|
|
|
|
double n;
|
|
|
|
double o;
|
|
|
|
double p;
|
|
|
|
} Matrix4;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
double r;
|
|
|
|
double g;
|
|
|
|
double b;
|
|
|
|
double a;
|
|
|
|
} Color;
|
|
|
|
|
|
|
|
#define MAX_COLORGRADATION_PARTS 10
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
double start;
|
|
|
|
Color col;
|
|
|
|
} _ColorGradationPart;
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int nbparts;
|
|
|
|
_ColorGradationPart parts[MAX_COLORGRADATION_PARTS];
|
|
|
|
} ColorGradation;
|
|
|
|
|
|
|
|
struct RenderFragment;
|
2012-01-24 13:16:20 +00:00
|
|
|
struct Renderer;
|
2011-12-10 13:25:22 +00:00
|
|
|
|
2012-01-24 13:16:20 +00:00
|
|
|
typedef int(*f_RenderFragmentCallback)(struct RenderFragment*, struct Renderer* renderer, void* data);
|
2011-12-10 13:25:22 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
Vector3 location;
|
|
|
|
Vector3 normal;
|
|
|
|
Color color;
|
|
|
|
f_RenderFragmentCallback callback;
|
2012-01-24 13:16:20 +00:00
|
|
|
void* callback_data;
|
2011-12-10 13:25:22 +00:00
|
|
|
} Vertex;
|
|
|
|
|
|
|
|
typedef struct RenderFragment
|
|
|
|
{
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
double z;
|
|
|
|
Vertex vertex;
|
|
|
|
} RenderFragment;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
} RenderContext;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int length;
|
|
|
|
int alloc_length;
|
|
|
|
int item_size;
|
|
|
|
int dirty;
|
|
|
|
void* data;
|
|
|
|
} Array;
|
|
|
|
|
2012-01-24 13:16:20 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
Color base;
|
|
|
|
double reflection;
|
|
|
|
double shininess;
|
|
|
|
} SurfaceMaterial;
|
|
|
|
|
2011-12-23 22:58:50 +00:00
|
|
|
typedef struct Zone Zone;
|
2011-12-10 13:25:22 +00:00
|
|
|
|
2012-01-29 21:45:58 +00:00
|
|
|
typedef void (*RenderCallbackStart)(int width, int height, Color background);
|
|
|
|
typedef void (*RenderCallbackDraw)(int x, int y, Color col);
|
|
|
|
typedef void (*RenderCallbackUpdate)(double progress);
|
|
|
|
|
|
|
|
typedef struct RenderArea RenderArea;
|
2011-12-10 13:25:22 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int hit;
|
|
|
|
Color hit_color;
|
|
|
|
Vector3 hit_location;
|
|
|
|
} RayCastingResult;
|
|
|
|
typedef RayCastingResult (*RayCastingFunction)(Vector3 start, Vector3 direction);
|
|
|
|
|
2012-01-29 17:53:12 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
double min_height;
|
|
|
|
double max_height;
|
|
|
|
double base_height;
|
|
|
|
} HeightInfo;
|
|
|
|
|
2012-01-31 11:20:52 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
Vector3 location;
|
|
|
|
double yaw;
|
|
|
|
double pitch;
|
|
|
|
double roll;
|
|
|
|
|
|
|
|
Vector3 target;
|
|
|
|
Vector3 forward;
|
|
|
|
Vector3 right;
|
|
|
|
Vector3 up;
|
|
|
|
|
|
|
|
double width;
|
|
|
|
double height;
|
|
|
|
double yfov;
|
|
|
|
double xratio;
|
|
|
|
double znear;
|
|
|
|
double zfar;
|
|
|
|
|
|
|
|
Matrix4 project;
|
|
|
|
Matrix4 unproject;
|
|
|
|
} CameraDefinition;
|
|
|
|
|
2011-12-23 22:58:50 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-12-10 13:25:22 +00:00
|
|
|
#endif
|