2012-01-22 18:39:42 +00:00
|
|
|
#ifndef _PAYSAGES_LIGHTING_H_
|
|
|
|
#define _PAYSAGES_LIGHTING_H_
|
|
|
|
|
|
|
|
#include "shared/types.h"
|
2012-01-23 23:45:33 +00:00
|
|
|
#include "renderer.h"
|
2012-01-22 18:39:42 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-01-23 23:45:33 +00:00
|
|
|
#define LIGHTING_MAX_LIGHTS 10
|
2012-01-22 18:39:42 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2012-01-25 17:31:36 +00:00
|
|
|
Vector3 direction; /* Global direction of the light */
|
|
|
|
Color color; /* Main color of the light */
|
2012-01-26 18:20:19 +00:00
|
|
|
double reflection; /* Reflected factor of the light (for specular lighting) */
|
2012-01-25 17:31:36 +00:00
|
|
|
int filtered; /* Should the light be filtered (by atmosphere, water...) */
|
|
|
|
int masked; /* Should the light be masked (cast shadows..) */
|
|
|
|
double amplitude; /* Angle amplitude of the light source (for multi-sampling, pi / 2.0 for skydome) */
|
2012-01-22 18:39:42 +00:00
|
|
|
} LightDefinition;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int autosetfromsky;
|
|
|
|
int nblights;
|
2012-01-23 23:45:33 +00:00
|
|
|
LightDefinition lights[LIGHTING_MAX_LIGHTS];
|
2012-01-22 18:39:42 +00:00
|
|
|
int _nbautolights;
|
2012-01-23 23:45:33 +00:00
|
|
|
LightDefinition _autolights[LIGHTING_MAX_LIGHTS];
|
2012-01-22 18:39:42 +00:00
|
|
|
} LightingDefinition;
|
|
|
|
|
|
|
|
void lightingInit();
|
2012-01-24 13:16:20 +00:00
|
|
|
void lightingSave(FILE* f, LightingDefinition* definition);
|
|
|
|
void lightingLoad(FILE* f, LightingDefinition* definition);
|
2012-01-22 18:39:42 +00:00
|
|
|
|
|
|
|
LightingDefinition lightingCreateDefinition();
|
2012-01-23 23:45:33 +00:00
|
|
|
void lightingDeleteDefinition(LightingDefinition* definition);
|
|
|
|
void lightingCopyDefinition(LightingDefinition* source, LightingDefinition* destination);
|
2012-01-22 18:39:42 +00:00
|
|
|
void lightingValidateDefinition(LightingDefinition* definition);
|
|
|
|
|
|
|
|
int lightingGetLightCount(LightingDefinition* definition);
|
|
|
|
LightDefinition lightingGetLight(LightingDefinition* definition, int light);
|
|
|
|
int lightingAddLight(LightingDefinition* definition, LightDefinition light);
|
|
|
|
void lightingDeleteLight(LightingDefinition* definition, int light);
|
|
|
|
|
2012-01-23 23:45:33 +00:00
|
|
|
Color lightingApplyToSurface(LightingDefinition* definition, Renderer* renderer, Vector3 location, Vector3 normal, SurfaceMaterial material);
|
2012-01-22 18:39:42 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|