void LightComponent::refresh() { observe_properties(false); gl::LightPtr light = m_lights.empty() ? gl::LightPtr() : m_lights[*m_light_index]; if(!light) return; *m_draw_light_dummies = m_draw_dummy_flags[*m_light_index]; *m_light_type = light->type(); *m_enabled = light->enabled(); *m_intensity = light->intensity(); *m_radius = light->radius(); *m_cast_shadows = light->cast_shadow(); *m_position_x = light->position().x; *m_position_y = light->position().y; *m_position_z = light->position().z; *m_direction = light->lookAt(); *m_diffuse = light->diffuse(); *m_ambient = light->ambient(); *m_att_constant = light->attenuation().constant; *m_att_quadratic = light->attenuation().quadratic; *m_spot_cutoff = light->spot_cutoff(); *m_spot_exponent = light->spot_exponent(); observe_properties(true); }
void LightComponent::set_lights(const std::vector<gl::LightPtr> &l, bool copy_settings) { m_lights.assign(l.begin(), l.end()); m_light_index->set_range(0, l.size() - 1); m_draw_dummy_flags.resize(m_lights.size(), false); if(copy_settings) { observe_properties(); m_light_index->set(*m_light_index); } }
void Component::observe_properties(bool b) { observe_properties(m_propertyList, b); }