52 lines
726 B
C++
52 lines
726 B
C++
#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;
|
|
LightDiffuse *diffuse;
|
|
int diffuseCount;
|
|
};
|
|
|
|
|
|
#define LIGHT_H
|
|
#endif
|
|
|