summaryrefslogtreecommitdiff
path: root/gaunt01/src/morphmesh.cpp
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2012-04-05 14:00:51 +0100
committerTim Redfern <tim@eclectronics.org>2012-04-05 14:00:51 +0100
commitf65006daf4979d82d67fd8c8a234d3913088821d (patch)
tree104d30c316ca295cd4bad1110c7f341640112738 /gaunt01/src/morphmesh.cpp
parent0c2a97dcc0fb370938dc0d2d3a27053c2c9cb31e (diff)
starting to implement bird
Diffstat (limited to 'gaunt01/src/morphmesh.cpp')
-rw-r--r--gaunt01/src/morphmesh.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/gaunt01/src/morphmesh.cpp b/gaunt01/src/morphmesh.cpp
index 64bc24e..475f93b 100644
--- a/gaunt01/src/morphmesh.cpp
+++ b/gaunt01/src/morphmesh.cpp
@@ -4,11 +4,11 @@ morphmesh::morphmesh()
{
loaded=false;
}
-
+
morphmesh::morphmesh(string filename)
{
morphmesh();
- loadfile(filename);
+ loadMesh(filename);
}
morphmesh::~morphmesh()
@@ -47,7 +47,7 @@ void morphmesh::draw(const vector<int>& targets, const vector<float>& weights){
ofMesh::draw();
}
-bool morphmesh::loadfile(string filename){
+bool morphmesh::loadMesh(string filename){
loaded=false;
ofxXmlSettings XML;
if( !XML.loadFile(filename) ){
@@ -60,7 +60,7 @@ bool morphmesh::loadfile(string filename){
XML.pushTag("Mesh",i);
if (XML.pushTag("AttributeList")) {
vector<ofVec3f> verts;
-
+
string vertstring=XML.getAttribute("Attribute","Data","none",0);
stringstream ss(vertstring);
istream_iterator<string> begin(ss);
@@ -70,10 +70,10 @@ bool morphmesh::loadfile(string filename){
verts.push_back(ofVec3f(ofToFloat(vstrings[j]),ofToFloat(vstrings[j+1]),ofToFloat(vstrings[j+2])));
}
morphs.push_back(verts);
-
+
if (i==0) {
addVertices(verts);
-
+
vector<ofVec3f> norms;
string normstring=XML.getAttribute("Attribute","Data","none",1);
stringstream ns(normstring);
@@ -84,7 +84,7 @@ bool morphmesh::loadfile(string filename){
norms.push_back(ofVec3f(ofToFloat(nstrings[j]),ofToFloat(nstrings[j+1]),ofToFloat(nstrings[j+2])));
}
addNormals(norms);
-
+
vector<ofVec2f> texcords;
string texstring=XML.getAttribute("Attribute","Data","none",2);
stringstream ts(texstring);
@@ -95,9 +95,9 @@ bool morphmesh::loadfile(string filename){
texcords.push_back(ofVec2f(ofToFloat(tstrings[j]),ofToFloat(tstrings[j+1])));
}
addTexCoords(texcords);
-
+
XML.popTag();
-
+
if (XML.pushTag("IndexList")) {
vector<ofIndexType> faces;
string facestring=XML.getAttribute("Index","Data","none",0);
@@ -130,4 +130,4 @@ bool morphmesh::loadfile(string filename){
bool morphmesh::isLoaded()
{
return loaded;
-} \ No newline at end of file
+}