49 for (
size_t i = 0; i <
m_data->size(); ) {
50 auto l = ( *m_data )[i];
51 if ( l->getEntity() == SystemEntity::getInstance() ) {
m_data->remove( l ); }
55 for (
const auto& data : lightData ) {
60 switch ( data->getType() ) {
61 case LightData::DIRECTIONAL_LIGHT: {
64 thelight->setColor( data->m_color );
65 thelight->setDirection( data->m_dirlight.direction );
69 case LightData::POINT_LIGHT: {
70 auto thelight =
new PointLight( entity, componentName );
71 thelight->setColor( data->m_color );
72 thelight->setPosition( data->m_pointlight.position );
73 thelight->setAttenuation( data->m_pointlight.attenuation.constant,
74 data->m_pointlight.attenuation.linear,
75 data->m_pointlight.attenuation.quadratic );
79 case LightData::SPOT_LIGHT: {
80 auto thelight =
new SpotLight( entity, componentName );
81 thelight->setColor( data->m_color );
82 thelight->setPosition( data->m_spotlight.position );
83 thelight->setDirection( data->m_spotlight.direction );
84 thelight->setAttenuation( data->m_spotlight.attenuation.constant,
85 data->m_spotlight.attenuation.linear,
86 data->m_spotlight.attenuation.quadratic );
87 thelight->setInnerAngleInRadians( data->m_spotlight.innerAngle );
88 thelight->setOuterAngleInRadians( data->m_spotlight.outerAngle );
92 case LightData::AREA_LIGHT: {
95 auto thelight =
new PointLight( entity, componentName );
96 thelight->setColor( data->m_color );
97 thelight->setPosition( data->m_arealight.position );
98 thelight->setAttenuation( data->m_arealight.attenuation.constant,
99 data->m_arealight.attenuation.linear,
100 data->m_arealight.attenuation.quadratic );
109 if ( !comp )
continue;
113 LOG( logINFO ) <<
"LightManager : loaded " <<
count() <<
" lights.";