2023-06-20 04:33:09 +00:00
|
|
|
#include "StarLightSource.hpp"
|
|
|
|
#include "StarDataStreamExtra.hpp"
|
|
|
|
|
|
|
|
namespace Star {
|
|
|
|
|
2024-03-25 20:31:33 +00:00
|
|
|
EnumMap<LightType> const LightTypeNames{
|
|
|
|
{LightType::Spread, "Spread"},
|
|
|
|
{LightType::Point, "Point"},
|
|
|
|
{LightType::PointAsSpread, "PointAsSpread"}
|
|
|
|
};
|
|
|
|
|
2023-06-20 04:33:09 +00:00
|
|
|
void LightSource::translate(Vec2F const& pos) {
|
|
|
|
position += pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
DataStream& operator<<(DataStream& ds, LightSource const& lightSource) {
|
|
|
|
ds.write(lightSource.position);
|
|
|
|
ds.write(lightSource.color);
|
2024-03-25 20:31:33 +00:00
|
|
|
ds.write(lightSource.type);
|
2023-06-20 04:33:09 +00:00
|
|
|
ds.write(lightSource.pointBeam);
|
|
|
|
ds.write(lightSource.beamAngle);
|
|
|
|
ds.write(lightSource.beamAmbience);
|
|
|
|
|
|
|
|
return ds;
|
|
|
|
}
|
|
|
|
|
|
|
|
DataStream& operator>>(DataStream& ds, LightSource& lightSource) {
|
|
|
|
ds.read(lightSource.position);
|
|
|
|
ds.read(lightSource.color);
|
2024-03-25 20:31:33 +00:00
|
|
|
ds.read(lightSource.type);
|
2023-06-20 04:33:09 +00:00
|
|
|
ds.read(lightSource.pointBeam);
|
|
|
|
ds.read(lightSource.beamAngle);
|
|
|
|
ds.read(lightSource.beamAmbience);
|
|
|
|
|
|
|
|
return ds;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|