void deserialize(const char* attrName, const BoundSetter<T>& setValue, const Context& dc) { pugi::xml_node attrib = parent.find_child(FindAttribute(attrName)); if(!attrib) { SPK_LOG_WARNING("XMLLoader::load(std::istream&) - Missing attribute '" << attrName << "'. Default value will be used"); } if(!dc.isStructuredAttribute()) loadValue(attrib, setValue); else { // Find item node pugi::xml_node item = attrib.child("item"); unsigned int id = dc.structured.id; while(id > 0) { item = item.next_sibling("item"); id--; } // Find field node pugi::xml_node field = item.find_child(FindAttribute(dc.structured.fieldName)); if(!field) { SPK_LOG_WARNING("XMLLoader::load(std::istream&) - Missing field '" << dc.structured.fieldName << "' in attribute '" << attrName << "'. Default value will be used"); } loadValue(field, setValue); } }
void GLRenderer::setBlendMode(BlendMode blendMode) { switch(blendMode) { case BLEND_MODE_NONE : srcBlending = GL_ONE; destBlending = GL_ZERO; blendingEnabled = false; break; case BLEND_MODE_ADD : srcBlending = GL_SRC_ALPHA; destBlending = GL_ONE; blendingEnabled = true; break; case BLEND_MODE_ALPHA : srcBlending = GL_SRC_ALPHA; destBlending = GL_ONE_MINUS_SRC_ALPHA; blendingEnabled = true; break; default : SPK_LOG_WARNING("GLRenderer::setBlendMode(BlendMode) - Unsupported blending mode. Nothing happens"); break; } }
void ActionSet::addAction(const Ref<Action>& action) { if (action && action != this) actions.push_back(action); else SPK_LOG_WARNING("ActionSet::addAction(const Ref<Action>&) - Cannot add this action to the action set (Either NULL or the action set itself)"); }
void RandomForce::setPeriods(float minPeriod,float maxPeriod) { if (minPeriod <= 0.0f || maxPeriod <= 0.0f) { SPK_LOG_WARNING("RandomForce::setPeriods(float,float) - Periods must be greater to 0, nothing is set"); return; } if (minPeriod > maxPeriod) { SPK_LOG_WARNING("RandomForce::setPeriods(float,float) - min periods is greater than max periods, values are swapped"); std::swap(minPeriod,maxPeriod); } this->minPeriod = minPeriod; this->maxPeriod = maxPeriod; }
void Vortex::setEyeRadius(float eyeRadius) { if (eyeRadius < 0.0f) { eyeRadius = -eyeRadius; SPK_LOG_WARNING("Vortex::setEyeRadius(float) - The eye radius cannot be negative. It is inverted"); } this->eyeRadius = eyeRadius; }
void Collider::setElasticity(float elasticity) { if (elasticity < 0.0f) { SPK_LOG_WARNING("Collider::setElasticity(float) - The elasticity cannot be negative, 1.0f is set") elasticity = 1.0f; } this->elasticity = elasticity; }
void PointMass::setOffset(float offset) { if (offset <= 0.0f) { SPK_LOG_WARNING("PointMass::setOffset(float) - Offset must be superior to 0. Offset is set to 0.01f"); offset = 0.01f; } this->offset = offset; }
void ActionSet::removeAction(const Ref<Action>& action) { for (std::vector<Ref<Action> >::iterator it = actions.begin(); it != actions.end(); ++it) if (*it == action) { actions.erase(it); return; } SPK_LOG_WARNING("ActionSet::removeAction(const Ref<Action>&) - The action was not found in the action set and cannot be removed"); }
void Emitter::setForce(float min,float max) { if (min <= max) { forceMin = min; forceMax = max; } else { SPK_LOG_WARNING("Emitter::setForce(float,float) - min is higher than max - Values are swapped"); forceMin = max; forceMax = min; } }
void Emitter::setTank(int minTank,int maxTank) { SPK_ASSERT(minTank >= 0 == maxTank >= 0,"Emitter::setTank(int,int) : min and max tank values must be of the same sign"); if (minTank < 0 || maxTank < 0) minTank = maxTank = -1; if (minTank > maxTank) { SPK_LOG_WARNING("Emitter::setTank(int,int) : min tank is greater than max tank. Values are swapped"); std::swap(minTank,maxTank); } this->minTank = minTank; this->maxTank = maxTank; resetTank(); SPK_ASSERT(flow >= 0.0f || currentTank >= 0,"Emitter::setTank(int,int) : the flow and tank of an emitter cannot be both negative"); }
void SpawnParticlesAction::setNb(unsigned int min,unsigned int max) { if (min <= max) { this->minNb = minNb; this->maxNb = maxNb; } else { SPK_LOG_WARNING("SpawnParticlesAction::setNb(unsigned int,unsigned int) - min is higher than max - Values are swapped"); this->minNb = maxNb; this->maxNb = minNb; } }
void Group::setLifeTime(float minLifeTime,float maxLifeTime) { SPK_ASSERT(minLifeTime > 0.0f && maxLifeTime > 0.0f,"Group::setLifeTime(float,float) - Life times must not be set to negative values"); if (minLifeTime <= maxLifeTime) { this->minLifeTime = minLifeTime; this->maxLifeTime = maxLifeTime; } else { SPK_LOG_WARNING("Group::setEnergy(float,float) - minEnergy is higher than maxEnergy - Values are swapped"); this->minLifeTime = maxLifeTime; this->maxLifeTime = minLifeTime; } }
void XMLLoader::processConnection(unsigned int id, LoadContext& context) { unsigned int senderRef = context.connections[id].attribute("sender").as_int(); unsigned int receiverRef = context.connections[id].attribute("receiver").as_int(); Ref<SPKObject> sender = context.getObject<SPKObject>(senderRef); Ref<SPKObject> receiver = context.getObject<SPKObject>(receiverRef); std::string control = context.connections[id].attribute("control").value(); std::string attribute = context.connections[id].attribute("attribute").value(); std::string field = context.connections[id].attribute("field").value(); unsigned int fieldId = context.connections[id].attribute("fieldId").as_int(); ConnectionStatus status = connect(sender, control, receiver, attribute, fieldId, field); if(status == CONNECTION_STATUS_OK_FIELD_NOT_NEEDED) { SPK_LOG_WARNING("XMLLoader::load(std::istream&) - Connection succeeded, but field is not needed: [" << senderRef << "]::" << control << " -> [" << receiverRef << "]::" << attribute << " (\"" << field << "\"," << fieldId << ")"); } else if(status != CONNECTION_STATUS_OK) { SPK_LOG_ERROR("XMLLoader::load(std::istream&) - Connection failed: [" << senderRef << "]::" << control << " -> [" << receiverRef << "]::" << attribute << " (\"" << field << "\"," << fieldId << ") : error " << status); } }
void DX9LineTrailRenderer::enableBlending(bool blendingEnabled) { if (!blendingEnabled) SPK_LOG_WARNING("DX9LineTrailRenderer::enableBlending(bool) - The blending cannot be disables for this renderer"); DX9Renderer::enableBlending(true); }