stuff
This commit is contained in:
parent
1006b231f0
commit
0c0cfef186
28 changed files with 220 additions and 331 deletions
44
game/inc/suic_lighting.h
Normal file
44
game/inc/suic_lighting.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#pragma once
|
||||
#include "suic_math.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* Lighting system API.
|
||||
* Supports directional lighting, shadows, ambient occlusion, and Phong shading.
|
||||
*/
|
||||
|
||||
typedef struct SuicColor {
|
||||
uint8_t r, g, b, a;
|
||||
} SuicColor;
|
||||
|
||||
typedef struct SuicDirectionalLight {
|
||||
SuicVec3 direction;
|
||||
SuicVec3 color;
|
||||
float intensity;
|
||||
float ambientIntensity;
|
||||
float shadowBias;
|
||||
float shadowIntensity;
|
||||
} SuicDirectionalLight;
|
||||
|
||||
/* Light creation */
|
||||
SuicDirectionalLight suic_light_create(float dir_x, float dir_y, float dir_z,
|
||||
float intensity, float ambient);
|
||||
SuicDirectionalLight suic_light_create_default(void);
|
||||
|
||||
/* Basic lighting */
|
||||
SuicColor suic_light_apply(SuicColor base, SuicVec3 normal, SuicDirectionalLight* light);
|
||||
|
||||
/* Lighting with shadows */
|
||||
SuicColor suic_light_apply_shadows(SuicColor base, SuicVec3 normal, SuicVec3 worldPos,
|
||||
SuicDirectionalLight* light);
|
||||
|
||||
/* Phong lighting (with specular) */
|
||||
SuicColor suic_light_apply_phong(SuicColor base, SuicVec3 normal, SuicVec3 worldPos,
|
||||
SuicVec3 camPos, SuicDirectionalLight* light);
|
||||
|
||||
/* Shadow calculations */
|
||||
float suic_shadow_factor(SuicVec3 worldPos, SuicVec3 lightDir, float maxDist);
|
||||
float suic_shadow_temporal(SuicVec3 worldPos, float timePhase);
|
||||
|
||||
/* Ambient occlusion */
|
||||
float suic_ao_calculate(SuicVec3 worldPos, SuicVec3 normal);
|
||||
Loading…
Add table
Add a link
Reference in a new issue