Browse Source

Add nesting to `SettingsLoader::getQuadSurface`

master
Krisjanis Rijnieks 10 years ago
parent
commit
f6f91bf498
  1. 22
      src/Application/SettingsLoader.cpp

22
src/Application/SettingsLoader.cpp

@ -236,53 +236,71 @@ BaseSurface * SettingsLoader::getTriangleSurface(ofxXmlSettings * xmlSettings){
BaseSurface * SettingsLoader::getQuadSurface(ofxXmlSettings * xmlSettings){ BaseSurface * SettingsLoader::getQuadSurface(ofxXmlSettings * xmlSettings){
vector <ofVec2f> vertices; vector <ofVec2f> vertices;
if(xmlSettings->tagExists("vertex", 0)){
xmlSettings->pushTag("vertex", 0); xmlSettings->pushTag("vertex", 0);
vertices.push_back(ofVec2f(xmlSettings->getValue("x", 0.0f), vertices.push_back(ofVec2f(xmlSettings->getValue("x", 0.0f),
xmlSettings->getValue("y", 0.0f))); xmlSettings->getValue("y", 0.0f)));
xmlSettings->popTag(); xmlSettings->popTag();
}
if(xmlSettings->tagExists("vertex", 1)){
xmlSettings->pushTag("vertex", 1); xmlSettings->pushTag("vertex", 1);
vertices.push_back(ofVec2f(xmlSettings->getValue("x", 100.0f), vertices.push_back(ofVec2f(xmlSettings->getValue("x", 100.0f),
xmlSettings->getValue("y", 0.0f))); xmlSettings->getValue("y", 0.0f)));
xmlSettings->popTag(); xmlSettings->popTag();
}
if(xmlSettings->tagExists("vertex", 2)){
xmlSettings->pushTag("vertex", 2); xmlSettings->pushTag("vertex", 2);
vertices.push_back(ofVec2f(xmlSettings->getValue("x", 100.0f), vertices.push_back(ofVec2f(xmlSettings->getValue("x", 100.0f),
xmlSettings->getValue("y", 100.0f))); xmlSettings->getValue("y", 100.0f)));
xmlSettings->popTag(); xmlSettings->popTag();
}
if(xmlSettings->tagExists("vertex", 3)){
xmlSettings->pushTag("vertex", 3); xmlSettings->pushTag("vertex", 3);
vertices.push_back(ofVec2f(xmlSettings->getValue("x", 0.0f), vertices.push_back(ofVec2f(xmlSettings->getValue("x", 0.0f),
xmlSettings->getValue("y", 100.0f))); xmlSettings->getValue("y", 100.0f)));
xmlSettings->popTag(); xmlSettings->popTag();
}
xmlSettings->popTag(); // vertices xmlSettings->popTag(); // vertices
xmlSettings->pushTag("texCoords");
vector <ofVec2f> texCoords; vector <ofVec2f> texCoords;
if(xmlSettings->tagExists("texCoords")){
xmlSettings->pushTag("texCoords");
if(xmlSettings->tagExists("texCoord", 0)){
xmlSettings->pushTag("texCoord", 0); xmlSettings->pushTag("texCoord", 0);
texCoords.push_back(ofVec2f(xmlSettings->getValue("x", 0.0f), texCoords.push_back(ofVec2f(xmlSettings->getValue("x", 0.0f),
xmlSettings->getValue("y", 0.0f))); xmlSettings->getValue("y", 0.0f)));
xmlSettings->popTag(); xmlSettings->popTag();
}
if(xmlSettings->tagExists("texCoord", 1)){
xmlSettings->pushTag("texCoord", 1); xmlSettings->pushTag("texCoord", 1);
texCoords.push_back(ofVec2f(xmlSettings->getValue("x", 1.0f), texCoords.push_back(ofVec2f(xmlSettings->getValue("x", 1.0f),
xmlSettings->getValue("y", 0.0f))); xmlSettings->getValue("y", 0.0f)));
xmlSettings->popTag(); xmlSettings->popTag();
}
if(xmlSettings->tagExists("texCoord", 2)){
xmlSettings->pushTag("texCoord", 2); xmlSettings->pushTag("texCoord", 2);
texCoords.push_back(ofVec2f(xmlSettings->getValue("x", 1.0f), texCoords.push_back(ofVec2f(xmlSettings->getValue("x", 1.0f),
xmlSettings->getValue("y", 1.0f))); xmlSettings->getValue("y", 1.0f)));
xmlSettings->popTag(); xmlSettings->popTag();
}
if(xmlSettings->tagExists("texCoord", 3)){
xmlSettings->pushTag("texCoord", 3); xmlSettings->pushTag("texCoord", 3);
texCoords.push_back(ofVec2f(xmlSettings->getValue("x", 0.0f), texCoords.push_back(ofVec2f(xmlSettings->getValue("x", 0.0f),
xmlSettings->getValue("y", 1.0f))); xmlSettings->getValue("y", 1.0f)));
xmlSettings->popTag(); xmlSettings->popTag();
}
xmlSettings->popTag(); // texCoords xmlSettings->popTag(); // texCoords
}
// Create and add quad surface // Create and add quad surface
BaseSurface * quadSurface = BaseSurface * quadSurface =

Loading…
Cancel
Save