void InputBinder::bind_texture_instance_to_input( const TextureInstanceContainer& texture_instances, const UniqueID assembly_uid, const char* entity_type, const char* entity_name, const char* param_value, InputArray::iterator& input) { const TextureInstance* texture_instance = texture_instances.get_by_name(param_value); assert(texture_instance); try { input.bind( new TextureSource( assembly_uid, *texture_instance)); } catch (const exception& e) { RENDERER_LOG_ERROR( "while defining %s \"%s\", failed to bind \"%s\" to input \"%s\" (%s).", entity_type, entity_name, param_value, input.name(), e.what()); ++m_error_count; } }
void InputBinder::bind_color_to_input( const ColorContainer& colors, const char* param_value, InputArray::iterator& input) { const ColorEntity* color_entity = colors.get_by_name(param_value); assert(color_entity); input.bind(new ColorSource(*color_entity)); }
bool InputBinder::try_bind_scalar_to_input( const string& param_value, InputArray::iterator& input) const { try { const double value = from_string<double>(param_value); input.bind(new ScalarSource(value)); return true; } catch (const ExceptionStringConversionError&) { return false; } }
void InputBinder::bind_texture_instance_to_input( const TextureContainer& textures, const TextureInstanceContainer& texture_instances, const UniqueID assembly_uid, const char* entity_type, const char* entity_name, const char* param_value, InputArray::iterator& input) { const TextureInstance* texture_instance = texture_instances.get_by_name(param_value); assert(texture_instance); const size_t texture_index = texture_instance->get_texture_index(); assert(texture_index != ~0); Texture* texture = textures.get_by_index(texture_index); assert(texture); try { input.bind( new TextureSource( assembly_uid, *texture_instance, texture->properties())); } catch (const exception& e) { RENDERER_LOG_ERROR( "while defining %s \"%s\", while binding \"%s\" to parameter \"%s\": %s.", entity_type, entity_name, param_value, input.name(), e.what()); ++m_error_count; } }