osb/source/game/StarLightSource.hpp

37 lines
1015 B
C++
Raw Normal View History

#pragma once
2023-06-20 04:33:09 +00:00
#include "StarVector.hpp"
#include "StarDataStream.hpp"
#include "StarBiMap.hpp"
2023-06-20 04:33:09 +00:00
namespace Star {
enum class LightType : uint8_t {
Spread = 0,
Point = 1,
PointAsSpread = 2 // Point with spread-like range
};
extern EnumMap<LightType> const LightTypeNames;
2023-06-20 04:33:09 +00:00
struct LightSource {
Vec2F position;
2024-03-19 14:53:34 +00:00
Vec3F color;
LightType type;
2023-06-20 04:33:09 +00:00
// pointBeam of 0.0 means light has no beam component, as pointBeam goes up,
// the dropoff from the beamAngle becomes faster and faster.
float pointBeam;
// The angle of the beam component of the light in radians
float beamAngle;
// beamAmbience provides a floor to the dropoff for beamed lights, so that
// even where the beam is not pointing there will still be some light. 0.0
// means no ambient floor, 1.0 effectively turns off beaming.
float beamAmbience;
void translate(Vec2F const& pos);
};
DataStream& operator<<(DataStream& ds, LightSource const& lightSource);
DataStream& operator>>(DataStream& ds, LightSource& lightSource);
}