2012-01-23 23:45:33 +00:00
|
|
|
#ifndef _PAYSAGES_RENDERER_H_
|
|
|
|
#define _PAYSAGES_RENDERER_H_
|
|
|
|
|
|
|
|
#include "shared/types.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct Renderer Renderer;
|
|
|
|
|
|
|
|
struct Renderer
|
|
|
|
{
|
2012-01-29 21:45:58 +00:00
|
|
|
/* Render base configuration */
|
2012-01-23 23:45:33 +00:00
|
|
|
int render_quality;
|
2012-01-29 21:45:58 +00:00
|
|
|
int render_width;
|
|
|
|
int render_height;
|
2012-01-31 11:20:52 +00:00
|
|
|
CameraDefinition render_camera;
|
2012-01-23 23:45:33 +00:00
|
|
|
Vector3 camera_location;
|
|
|
|
|
2012-01-24 13:16:20 +00:00
|
|
|
/* Render related */
|
2012-01-29 21:45:58 +00:00
|
|
|
RenderArea* render_area;
|
|
|
|
double render_progress;
|
|
|
|
int render_interrupt;
|
|
|
|
int is_rendering;
|
2012-01-24 13:16:20 +00:00
|
|
|
double (*getPrecision)(Renderer* renderer, Vector3 location);
|
|
|
|
Vector3 (*projectPoint)(Renderer* renderer, Vector3 point);
|
|
|
|
Vector3 (*unprojectPoint)(Renderer* renderer, Vector3 point);
|
2012-01-29 21:45:58 +00:00
|
|
|
int (*addRenderProgress)(Renderer* renderer, double progress);
|
|
|
|
void (*pushTriangle)(Renderer* renderer, Vertex* v1, Vertex* v2, Vertex* v3);
|
|
|
|
void (*pushQuad)(Renderer* renderer, Vertex* v1, Vertex* v2, Vertex* v3, Vertex* v4);
|
2012-01-24 13:16:20 +00:00
|
|
|
|
|
|
|
/* Scenery related */
|
|
|
|
RayCastingResult (*rayWalking)(Renderer* renderer, Vector3 location, Vector3 direction, int terrain, int water, int sky, int clouds);
|
|
|
|
double (*getTerrainHeight)(Renderer* renderer, double x, double z);
|
2012-01-29 17:53:12 +00:00
|
|
|
HeightInfo (*getWaterHeightInfo)(Renderer* renderer);
|
2012-01-24 13:16:20 +00:00
|
|
|
Color (*applyTextures)(Renderer* renderer, Vector3 location, double precision);
|
|
|
|
Color (*applyAtmosphere)(Renderer* renderer, Vector3 location, Color base);
|
|
|
|
Color (*applyClouds)(Renderer* renderer, Color base, Vector3 start, Vector3 end);
|
|
|
|
|
2012-01-23 23:45:33 +00:00
|
|
|
/* Lighting related */
|
|
|
|
Color (*filterLight)(Renderer* renderer, Color light_color, Vector3 at_location, Vector3 light_location, Vector3 direction_to_light);
|
2012-01-25 17:31:36 +00:00
|
|
|
Color (*maskLight)(Renderer* renderer, Color light_color, Vector3 at_location, Vector3 light_location, Vector3 direction_to_light);
|
2012-01-24 13:16:20 +00:00
|
|
|
Color (*applyLightingToSurface)(Renderer* renderer, Vector3 location, Vector3 normal, SurfaceMaterial material);
|
2012-01-23 23:45:33 +00:00
|
|
|
|
|
|
|
/* Custom data */
|
|
|
|
void* customData[10];
|
|
|
|
};
|
|
|
|
|
2012-01-29 21:45:58 +00:00
|
|
|
Renderer rendererCreate();
|
|
|
|
void rendererDelete(Renderer* renderer);
|
|
|
|
void rendererSetPreviewCallbacks(Renderer* renderer, RenderCallbackStart start, RenderCallbackDraw draw, RenderCallbackUpdate update);
|
|
|
|
void rendererStart(Renderer* renderer, int width, int height, int quality);
|
|
|
|
void rendererInterrupt(Renderer* renderer);
|
2012-01-23 23:45:33 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|