bool psEffectObjMesh::Load(iDocumentNode *node, iLoaderContext * ldr_context) { globalStringSet = csQueryRegistryTagInterface<iStringSet> (psCSSetup::object_reg, "crystalspace.shared.stringset"); // get the attributes name.Clear(); materialName.Clear(); factName.Clear(); csRef<iDocumentAttributeIterator> attribIter = node->GetAttributes(); while (attribIter->HasNext()) { csRef<iDocumentAttribute> attr = attribIter->Next(); csString attrName = attr->GetName(); attrName.Downcase(); if (attrName == "name") name = attr->GetValue(); else if (attrName == "material") materialName = attr->GetValue(); else if (attrName == "fact") factName = attr->GetValue(); } if (name.IsEmpty()) { csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "Eulora_effects", "Attempting to create an effect obj with no name.\n"); return false; } if (!psEffectObj::Load(node, ldr_context)) return false; return PostSetup(ldr_context); }
bool psEffectObjParticles::Load(iDocumentNode* node, iLoaderContext* ldr_context) { // get the attributes name.Clear(); materialName.Clear(); factName.Clear(); csRef<iDocumentAttributeIterator> attribIter = node->GetAttributes(); while(attribIter->HasNext()) { csRef<iDocumentAttribute> attr = attribIter->Next(); csString attrName = attr->GetName(); attrName.Downcase(); if(attrName == "name") name = attr->GetValue(); else if(attrName == "material") materialName = attr->GetValue(); else if(attrName == "fact") factName = attr->GetValue(); } if(name.IsEmpty()) { csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "planeshift_effects", "Attempting to create an effect obj with no name.\n"); return false; } if(!psEffectObj::Load(node, ldr_context)) return false; return PostSetup(ldr_context); }
void TransportLayerIce::SetParameters(RefPtr<NrIceMediaStream> stream, int component) { // Stream could be null in the case of some badly written js that causes // us to be in an ICE restart case, but not have valid streams due to // not calling PeerConnectionMedia::EnsureTransports if // PeerConnectionImpl::SetSignalingState_m thinks the conditions were // not correct. We also solved a case where an incoming answer was // incorrectly beginning an ICE restart when the offer did not indicate one. if (!stream) { MOZ_ASSERT(false); return; } // If SetParameters is called and we already have a stream_, this means // we're handling an ICE restart. We need to hold the old stream until // we know the new stream is working. if (stream_ && !old_stream_ && (stream_ != stream)) { // Here we leave the old stream's signals connected until we don't need // it anymore. They will be disconnected if ice restart is successful. old_stream_ = stream_; MOZ_MTLOG(ML_INFO, LAYER_INFO << "SetParameters save old stream(" << old_stream_->name() << ")"); } stream_ = stream; component_ = component; PostSetup(); }
bool psEffectObjSound::Load(iDocumentNode *node, iLoaderContext* ldr_context) { if (!psEffectObj::Load(node, ldr_context)) return false; // get the attributes name.Clear(); soundName.Clear(); minDistSquared = 25.0f; maxDistSquared = 100000.0f; loop = true; csRef<iDocumentAttributeIterator> attribIter = node->GetAttributes(); while (attribIter->HasNext()) { csRef<iDocumentAttribute> attr = attribIter->Next(); csString attrName = attr->GetName(); attrName.Downcase(); if (attrName == "name") name = attr->GetValue(); else if (attrName == "resource") soundName = attr->GetValue(); else if (attrName == "loop") loop = attr->GetValueAsBool(); } if (!loop && killTime <= 0) { csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "planeshift_effects", "Can't have a looping sound effect without a death.\n"); return false; } csRef<iDocumentNode> dataNode; // min distance dataNode = node->GetNode("mindist"); if (dataNode) { minDistSquared = dataNode->GetContentsValueAsFloat(); minDistSquared *= minDistSquared; } // max distance dataNode = node->GetNode("maxdist"); if (dataNode) { maxDistSquared = dataNode->GetContentsValueAsFloat(); maxDistSquared *= maxDistSquared; } if (name.IsEmpty()) { csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "planeshift_effects", "Attempting to create an effect obj with no name.\n"); return false; } return PostSetup(); }
bool psEffectObjSpire::Load(iDocumentNode* node, iLoaderContext* ldr_context) { // get the attributes name.Clear(); materialName.Clear(); shape = SPI_CIRCLE; segments = 5; csRef<iDocumentAttributeIterator> attribIter = node->GetAttributes(); while(attribIter->HasNext()) { csRef<iDocumentAttribute> attr = attribIter->Next(); csString attrName = attr->GetName(); attrName.Downcase(); if(attrName == "name") name = attr->GetValue(); else if(attrName == "material") materialName = attr->GetValue(); else if(attrName == "shape") { csString sshape = attr->GetValue(); sshape.Downcase(); if(sshape == "circle") shape = SPI_CIRCLE; else if(sshape == "cylinder") shape = SPI_CYLINDER; else if(sshape == "asterix") shape = SPI_ASTERIX; else if(sshape == "star") shape = SPI_STAR; else if(sshape == "layered") shape = SPI_LAYERED; } else if(attrName == "segments") segments = attr->GetValueAsInt(); } if(name.IsEmpty()) { csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "planeshift_effects", "Attempting to create an effect obj with no name.\n"); return false; } if(materialName.IsEmpty()) { csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "planeshift_effects", "Attempting to create an effect obj without a material.\n"); return false; } if(!psEffectObj::Load(node, ldr_context)) return false; return PostSetup(); }
bool psEffectObjLabel::Load(iDocumentNode *node, iLoaderContext* ldr_context) { // get the attributes name.Clear(); materialName.Clear(); sizeFileName.Clear(); csRef<iDocumentAttributeIterator> attribIter = node->GetAttributes(); while (attribIter->HasNext()) { csRef<iDocumentAttribute> attr = attribIter->Next(); csString attrName = attr->GetName(); attrName.Downcase(); if (attrName == "name") name = attr->GetValue(); else if (attrName == "material") materialName = attr->GetValue(); else if (attrName == "sizefile") sizeFileName = attr->GetValue(); else if (attrName == "labelwidth") labelwidth = attr->GetValueAsFloat(); } if (name.IsEmpty()) { csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "Eulora_effects", "Attempting to create an effect obj with no name.\n"); return false; } if (materialName.IsEmpty()) { csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "Eulora_effects", "Attempting to create an effect obj with no material.\n"); return false; } if (!sizeFileName.IsEmpty()) { LoadGlyphs(sizeFileName); } if (!psEffectObj::Load(node, ldr_context)) { return false; } return PostSetup(); }
bool psEffectObjSimpMesh::Load(iDocumentNode *node, iLoaderContext* ldr_context) { // get the attributes name.Clear(); materialName.Clear(); fileName.Clear(); csRef<iDocumentAttributeIterator> attribIter = node->GetAttributes(); while (attribIter->HasNext()) { csRef<iDocumentAttribute> attr = attribIter->Next(); csString attrName = attr->GetName(); attrName.Downcase(); if (attrName == "name") name = attr->GetValue(); else if (attrName == "material") materialName = attr->GetValue(); else if (attrName == "file") fileName = csString("/this/art/effects/") + attr->GetValue(); else if (attrName == "mesh") meshName = attr->GetValue(); } if (name.IsEmpty()) { csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "Eulora_effects", "Attempting to create an effect obj with no name.\n"); return false; } csRef<iVFS> vfs = csQueryRegistry<iVFS> (psCSSetup::object_reg); assert(vfs); if (!vfs->Exists(fileName)) { csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "Eulora_effects", "Attempting to create an effect obj without specifying an existing mesh file.\n"); return false; } if (!psEffectObj::Load(node, ldr_context)) return false; return PostSetup(); }
bool psEffectObjDecal::Load(iDocumentNode *node, iLoaderContext* ldr_context) { if (!decalMgr) { csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "planeshift_effects", "No decal plugin.\n"); return false; } // get the attributes name.Clear(); materialName.Clear(); float polygonNormalThreshold = -0.05f; float decalOffset = 0.02f; csVector2 minTexCoord(0,0); csVector2 maxTexCoord(1,1); bool hasTopClip = true; float topClipScale = 0.5f; bool hasBottomClip = true; float bottomClipScale = 0.5f; float perpendicularFaceThreshold = 0.05f; float perpendicularFaceOffset = 0.01f; csRef<iDocumentAttributeIterator> attribIter = node->GetAttributes(); while (attribIter->HasNext()) { csRef<iDocumentAttribute> attr = attribIter->Next(); csString attrName = attr->GetName(); attrName.Downcase(); if (attrName == "name") name = attr->GetValue(); else if (attrName == "material") materialName = attr->GetValue(); else if (attrName == "polygonnormalthreshold") polygonNormalThreshold = attr->GetValueAsFloat(); else if (attrName == "decaloffset") decalOffset = attr->GetValueAsFloat(); } csRef<iDocumentNode> dataNode = node->GetNode("texCoords"); if (dataNode) { minTexCoord.Set(dataNode->GetAttributeValueAsFloat("minU"), dataNode->GetAttributeValueAsFloat("minV")); maxTexCoord.Set(dataNode->GetAttributeValueAsFloat("maxU"), dataNode->GetAttributeValueAsFloat("maxV")); } dataNode = node->GetNode("topClip"); if (dataNode) { hasTopClip = dataNode->GetAttributeValueAsBool("enabled"); topClipScale = dataNode->GetAttributeValueAsFloat("scaleDist"); } dataNode = node->GetNode("bottomClip"); if (dataNode) { hasBottomClip = dataNode->GetAttributeValueAsBool("enabled"); bottomClipScale = dataNode->GetAttributeValueAsFloat("scaleDist"); } dataNode = node->GetNode("perpendicularFace"); if (dataNode) { perpendicularFaceThreshold = dataNode->GetAttributeValueAsFloat("threshold"); perpendicularFaceOffset = dataNode->GetAttributeValueAsFloat("offset"); } if (name.IsEmpty()) { csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "planeshift_effects", "Attempting to create an effect obj with no name.\n"); return false; } // load material csRef<iMaterialWrapper> mat = effectsCollection->FindMaterial(materialName); if (!mat) { csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "planeshift_effects", "Attempting to create an effect obj with no name.\n"); return false; } // create decal template decalTemplate = decalMgr->CreateDecalTemplate(mat); decalTemplate->SetPolygonNormalThreshold(polygonNormalThreshold); decalTemplate->SetDecalOffset(decalOffset); decalTemplate->SetTopClipping(hasTopClip, topClipScale); decalTemplate->SetBottomClipping(hasBottomClip, bottomClipScale); decalTemplate->SetTexCoords(minTexCoord, maxTexCoord); decalTemplate->SetPerpendicularFaceThreshold(perpendicularFaceThreshold); decalTemplate->SetPerpendicularFaceOffset(perpendicularFaceOffset); if (!psEffectObj::Load(node, ldr_context)) return false; return PostSetup(); }