|
@ -178,11 +178,11 @@ bool SettingsLoader::save(SurfaceManager & surfaceManager, string fileName){ |
|
|
xmlSettings->pushTag("surface", i); |
|
|
xmlSettings->pushTag("surface", i); |
|
|
xmlSettings->addTag("vertices"); |
|
|
xmlSettings->addTag("vertices"); |
|
|
xmlSettings->pushTag("vertices"); |
|
|
xmlSettings->pushTag("vertices"); |
|
|
vector <ofVec3f> * vertices = &surface->getVertices(); |
|
|
vector<Vec3> vertices = surface->getVertices(); |
|
|
for(int j = 0; j < vertices->size(); j++){ |
|
|
for(int j = 0; j < vertices.size(); j++){ |
|
|
xmlSettings->addTag("vertex"); |
|
|
xmlSettings->addTag("vertex"); |
|
|
xmlSettings->pushTag("vertex", j); |
|
|
xmlSettings->pushTag("vertex", j); |
|
|
ofVec3f * vertex = &(*vertices)[j]; |
|
|
Vec3 * vertex = &vertices[j]; |
|
|
xmlSettings->addValue("x", vertex->x); |
|
|
xmlSettings->addValue("x", vertex->x); |
|
|
xmlSettings->addValue("y", vertex->y); |
|
|
xmlSettings->addValue("y", vertex->y); |
|
|
|
|
|
|
|
@ -194,11 +194,11 @@ bool SettingsLoader::save(SurfaceManager & surfaceManager, string fileName){ |
|
|
|
|
|
|
|
|
xmlSettings->addTag("texCoords"); |
|
|
xmlSettings->addTag("texCoords"); |
|
|
xmlSettings->pushTag("texCoords"); |
|
|
xmlSettings->pushTag("texCoords"); |
|
|
vector <Vec2> * texCoords = &surface->getTexCoords(); |
|
|
vector<Vec2> texCoords = surface->getTexCoords(); |
|
|
for(int j = 0; j < texCoords->size(); j++){ |
|
|
for(int j = 0; j < texCoords.size(); j++){ |
|
|
xmlSettings->addTag("texCoord"); |
|
|
xmlSettings->addTag("texCoord"); |
|
|
xmlSettings->pushTag("texCoord", j); |
|
|
xmlSettings->pushTag("texCoord", j); |
|
|
Vec2 * texCoord = &(*texCoords)[j]; |
|
|
Vec2 * texCoord = &texCoords[j]; |
|
|
xmlSettings->addValue("x", texCoord->x); |
|
|
xmlSettings->addValue("x", texCoord->x); |
|
|
xmlSettings->addValue("y", texCoord->y); |
|
|
xmlSettings->addValue("y", texCoord->y); |
|
|
xmlSettings->popTag(); // texCoord
|
|
|
xmlSettings->popTag(); // texCoord
|
|
@ -252,29 +252,35 @@ bool SettingsLoader::create(string fileName){ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
BaseSurface * SettingsLoader::getTriangleSurface(ofxXmlSettings * xmlSettings){ |
|
|
BaseSurface * SettingsLoader::getTriangleSurface(ofxXmlSettings * xmlSettings){ |
|
|
vector <Vec2> vertices; |
|
|
vector <Vec3> vertices; |
|
|
|
|
|
|
|
|
if(xmlSettings->tagExists("vertices")){ |
|
|
if(xmlSettings->tagExists("vertices")){ |
|
|
xmlSettings->pushTag("vertices"); |
|
|
xmlSettings->pushTag("vertices"); |
|
|
|
|
|
|
|
|
if(xmlSettings->tagExists("vertex", 0)){ |
|
|
if(xmlSettings->tagExists("vertex", 0)){ |
|
|
xmlSettings->pushTag("vertex", 0); |
|
|
xmlSettings->pushTag("vertex", 0); |
|
|
vertices.push_back(Vec2(xmlSettings->getValue("x", 0.0f), |
|
|
vertices.push_back(Vec3( |
|
|
xmlSettings->getValue("y", 0.0f))); |
|
|
xmlSettings->getValue("x", 0.0f), |
|
|
|
|
|
xmlSettings->getValue("y", 0.0f), |
|
|
|
|
|
0.0f)); |
|
|
xmlSettings->popTag(); |
|
|
xmlSettings->popTag(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(xmlSettings->tagExists("vertex", 1)){ |
|
|
if(xmlSettings->tagExists("vertex", 1)){ |
|
|
xmlSettings->pushTag("vertex", 1); |
|
|
xmlSettings->pushTag("vertex", 1); |
|
|
vertices.push_back(Vec2(xmlSettings->getValue("x", 100.0f), |
|
|
vertices.push_back(Vec3( |
|
|
xmlSettings->getValue("y", 0.0f))); |
|
|
xmlSettings->getValue("x", 100.0f), |
|
|
|
|
|
xmlSettings->getValue("y", 0.0f), |
|
|
|
|
|
0.0f)); |
|
|
xmlSettings->popTag(); |
|
|
xmlSettings->popTag(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(xmlSettings->tagExists("vertex", 2)){ |
|
|
if(xmlSettings->tagExists("vertex", 2)){ |
|
|
xmlSettings->pushTag("vertex", 2); |
|
|
xmlSettings->pushTag("vertex", 2); |
|
|
vertices.push_back(Vec2(xmlSettings->getValue("x", 0.0f), |
|
|
vertices.push_back(Vec3( |
|
|
xmlSettings->getValue("y", 100.0f))); |
|
|
xmlSettings->getValue("x", 0.0f), |
|
|
|
|
|
xmlSettings->getValue("y", 100.0f), |
|
|
|
|
|
0.0f)); |
|
|
xmlSettings->popTag(); |
|
|
xmlSettings->popTag(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -321,36 +327,44 @@ BaseSurface * SettingsLoader::getTriangleSurface(ofxXmlSettings * xmlSettings){ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
BaseSurface * SettingsLoader::getQuadSurface(ofxXmlSettings * xmlSettings){ |
|
|
BaseSurface * SettingsLoader::getQuadSurface(ofxXmlSettings * xmlSettings){ |
|
|
vector <Vec2> vertices; |
|
|
vector<Vec3> vertices; |
|
|
|
|
|
|
|
|
if(xmlSettings->tagExists("vertices")){ |
|
|
if(xmlSettings->tagExists("vertices")){ |
|
|
xmlSettings->pushTag("vertices"); |
|
|
xmlSettings->pushTag("vertices"); |
|
|
|
|
|
|
|
|
if(xmlSettings->tagExists("vertex", 0)){ |
|
|
if(xmlSettings->tagExists("vertex", 0)){ |
|
|
xmlSettings->pushTag("vertex", 0); |
|
|
xmlSettings->pushTag("vertex", 0); |
|
|
vertices.push_back(Vec2(xmlSettings->getValue("x", 0.0f), |
|
|
vertices.push_back(Vec3( |
|
|
xmlSettings->getValue("y", 0.0f))); |
|
|
xmlSettings->getValue("x", 0.0f), |
|
|
|
|
|
xmlSettings->getValue("y", 0.0f), |
|
|
|
|
|
0.0f)); |
|
|
xmlSettings->popTag(); |
|
|
xmlSettings->popTag(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(xmlSettings->tagExists("vertex", 1)){ |
|
|
if(xmlSettings->tagExists("vertex", 1)){ |
|
|
xmlSettings->pushTag("vertex", 1); |
|
|
xmlSettings->pushTag("vertex", 1); |
|
|
vertices.push_back(Vec2(xmlSettings->getValue("x", 100.0f), |
|
|
vertices.push_back(Vec3( |
|
|
xmlSettings->getValue("y", 0.0f))); |
|
|
xmlSettings->getValue("x", 100.0f), |
|
|
|
|
|
xmlSettings->getValue("y", 0.0f), |
|
|
|
|
|
0.0f)); |
|
|
xmlSettings->popTag(); |
|
|
xmlSettings->popTag(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(xmlSettings->tagExists("vertex", 2)){ |
|
|
if(xmlSettings->tagExists("vertex", 2)){ |
|
|
xmlSettings->pushTag("vertex", 2); |
|
|
xmlSettings->pushTag("vertex", 2); |
|
|
vertices.push_back(Vec2(xmlSettings->getValue("x", 100.0f), |
|
|
vertices.push_back(Vec3( |
|
|
xmlSettings->getValue("y", 100.0f))); |
|
|
xmlSettings->getValue("x", 100.0f), |
|
|
|
|
|
xmlSettings->getValue("y", 100.0f), |
|
|
|
|
|
0.0f)); |
|
|
xmlSettings->popTag(); |
|
|
xmlSettings->popTag(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(xmlSettings->tagExists("vertex", 3)){ |
|
|
if(xmlSettings->tagExists("vertex", 3)){ |
|
|
xmlSettings->pushTag("vertex", 3); |
|
|
xmlSettings->pushTag("vertex", 3); |
|
|
vertices.push_back(Vec2(xmlSettings->getValue("x", 0.0f), |
|
|
vertices.push_back(Vec3( |
|
|
xmlSettings->getValue("y", 100.0f))); |
|
|
xmlSettings->getValue("x", 0.0f), |
|
|
|
|
|
xmlSettings->getValue("y", 100.0f), |
|
|
|
|
|
0.0f)); |
|
|
xmlSettings->popTag(); |
|
|
xmlSettings->popTag(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -415,7 +429,7 @@ BaseSurface * SettingsLoader::getQuadSurface(ofxXmlSettings * xmlSettings){ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
BaseSurface * SettingsLoader::getGridWarpSurface(ofxXmlSettings * xmlSettings){ |
|
|
BaseSurface * SettingsLoader::getGridWarpSurface(ofxXmlSettings * xmlSettings){ |
|
|
vector <Vec2> vertices; |
|
|
vector <Vec3> vertices; |
|
|
|
|
|
|
|
|
if(xmlSettings->tagExists("vertices")){ |
|
|
if(xmlSettings->tagExists("vertices")){ |
|
|
xmlSettings->pushTag("vertices"); |
|
|
xmlSettings->pushTag("vertices"); |
|
@ -424,8 +438,10 @@ BaseSurface * SettingsLoader::getGridWarpSurface(ofxXmlSettings * xmlSettings){ |
|
|
|
|
|
|
|
|
while(xmlSettings->tagExists("vertex", iv)){ |
|
|
while(xmlSettings->tagExists("vertex", iv)){ |
|
|
xmlSettings->pushTag("vertex", iv); |
|
|
xmlSettings->pushTag("vertex", iv); |
|
|
vertices.push_back(Vec2(xmlSettings->getValue("x", 0.0f), |
|
|
vertices.push_back(Vec3( |
|
|
xmlSettings->getValue("y", 0.0f))); |
|
|
xmlSettings->getValue("x", 0.0f), |
|
|
|
|
|
xmlSettings->getValue("y", 0.0f), |
|
|
|
|
|
0.0f)); |
|
|
xmlSettings->popTag(); |
|
|
xmlSettings->popTag(); |
|
|
++iv; |
|
|
++iv; |
|
|
} |
|
|
} |
|
@ -476,7 +492,7 @@ BaseSurface * SettingsLoader::getGridWarpSurface(ofxXmlSettings * xmlSettings){ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
BaseSurface * SettingsLoader::getHexagonSurface(ofxXmlSettings * xmlSettings){ |
|
|
BaseSurface * SettingsLoader::getHexagonSurface(ofxXmlSettings * xmlSettings){ |
|
|
vector <Vec2> vertices; |
|
|
vector <Vec3> vertices; |
|
|
|
|
|
|
|
|
if(xmlSettings->tagExists("vertices")){ |
|
|
if(xmlSettings->tagExists("vertices")){ |
|
|
xmlSettings->pushTag("vertices"); |
|
|
xmlSettings->pushTag("vertices"); |
|
@ -484,8 +500,10 @@ BaseSurface * SettingsLoader::getHexagonSurface(ofxXmlSettings * xmlSettings){ |
|
|
unsigned int v = 0; |
|
|
unsigned int v = 0; |
|
|
while(xmlSettings->tagExists("vertex", v)){ |
|
|
while(xmlSettings->tagExists("vertex", v)){ |
|
|
xmlSettings->pushTag("vertex", v); |
|
|
xmlSettings->pushTag("vertex", v); |
|
|
vertices.push_back(Vec2(xmlSettings->getValue("x", 0.0f), |
|
|
vertices.push_back(Vec3( |
|
|
xmlSettings->getValue("y", 0.0f))); |
|
|
xmlSettings->getValue("x", 0.0f), |
|
|
|
|
|
xmlSettings->getValue("y", 0.0f), |
|
|
|
|
|
0.0f)); |
|
|
xmlSettings->popTag(); // vertex
|
|
|
xmlSettings->popTag(); // vertex
|
|
|
v += 1; |
|
|
v += 1; |
|
|
} |
|
|
} |
|
|