2013-01-19 22:42:50 +00:00
|
|
|
#ifndef _PAYSAGES_TOOLS_LIGHTING_H_
|
|
|
|
#define _PAYSAGES_TOOLS_LIGHTING_H_
|
|
|
|
|
|
|
|
#include "euclid.h"
|
|
|
|
#include "color.h"
|
|
|
|
#include "pack.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
Color base;
|
|
|
|
double reflection;
|
|
|
|
double shininess;
|
|
|
|
} SurfaceMaterial;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
Vector3 direction; /* Global direction of the light */
|
|
|
|
Color color; /* Main color of the light */
|
|
|
|
double reflection; /* Reflected factor of the light (for specular lighting) */
|
2013-01-20 15:07:45 +00:00
|
|
|
int altered; /* Should the light be filtered or masked (by atmosphere, water, ground, clouds...) */
|
2013-01-19 22:42:50 +00:00
|
|
|
} LightDefinition;
|
|
|
|
|
2013-01-22 20:50:37 +00:00
|
|
|
typedef int (*FuncLightingAlterLight)(void* data, LightDefinition* light, Vector3 at);
|
2013-01-19 22:42:50 +00:00
|
|
|
|
|
|
|
typedef struct LightingManager LightingManager;
|
|
|
|
typedef struct LightStatus LightStatus;
|
|
|
|
|
|
|
|
LightingManager* lightingManagerCreate();
|
|
|
|
void lightingManagerDelete(LightingManager* filter);
|
|
|
|
void lightingManagerRegisterFilter(LightingManager* filter, FuncLightingAlterLight callback, void* data);
|
2013-03-07 14:07:12 +00:00
|
|
|
void lightingManagerDisableSpecularity(LightingManager* manager);
|
2013-01-19 22:42:50 +00:00
|
|
|
|
|
|
|
LightStatus* lightingCreateStatus(LightingManager* manager, Vector3 location, Vector3 eye);
|
|
|
|
void lightingDeleteStatus(LightStatus* status);
|
|
|
|
void lightingPushLight(LightStatus* status, LightDefinition* light);
|
|
|
|
Color lightingApplyStatus(LightStatus* status, Vector3 normal, SurfaceMaterial* material);
|
2013-01-20 15:07:45 +00:00
|
|
|
Vector3 lightingGetStatusLocation(LightStatus* status);
|
2013-01-19 22:42:50 +00:00
|
|
|
|
|
|
|
Color lightingApplyOneLight(LightDefinition* light, Vector3 eye, Vector3 location, Vector3 normal, SurfaceMaterial* material);
|
|
|
|
|
|
|
|
void materialSave(PackStream* stream, SurfaceMaterial* material);
|
|
|
|
void materialLoad(PackStream* stream, SurfaceMaterial* material);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|