2018-09-06 02:26:54 +00:00
|
|
|
#ifndef LIGHT_H
|
|
|
|
|
|
|
|
|
|
|
|
#include "color.h"
|
|
|
|
#include "vec.h"
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
|
|
|
|
// STRUCTURES
|
|
|
|
struct LightAmbient
|
|
|
|
{
|
|
|
|
inline ColorF32 ComputeColor(ColorF32 reflectivity)
|
|
|
|
{
|
|
|
|
ColorF32 result;
|
|
|
|
|
|
|
|
result = reflectivity * intensity;
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
float intensity;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct LightDiffuse
|
|
|
|
{
|
|
|
|
inline ColorF32 ComputeColor(ColorF32 reflectivity, Vector normal)
|
|
|
|
{
|
|
|
|
ColorF32 result;
|
|
|
|
|
|
|
|
float dot = Vector::Dot(normal, direction);
|
|
|
|
|
|
|
|
result = reflectivity * intensity * dot;
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
float intensity;
|
|
|
|
Vector direction;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct LightList
|
|
|
|
{
|
|
|
|
LightAmbient ambient;
|
2018-09-19 01:19:13 +00:00
|
|
|
LightDiffuse diffuse;
|
2018-09-06 02:26:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define LIGHT_H
|
|
|
|
#endif
|
|
|
|
|