1
0
Fork 0
2018-soft-3d-renderer/include/light.h

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