From 1d7efc8eba12b05ad96af2c6e68ba037b2138140 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Mon, 9 Apr 2012 22:02:25 +0100 Subject: sequence blending almost there --- morpher/src/testApp.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'morpher/src/testApp.cpp') diff --git a/morpher/src/testApp.cpp b/morpher/src/testApp.cpp index 04ecd26..31dffb4 100644 --- a/morpher/src/testApp.cpp +++ b/morpher/src/testApp.cpp @@ -4,7 +4,12 @@ void testApp::setup(){ //mesh.loadfile("Bird-test1.xml"); if (mesh.loadMesh("Bird-test.xml")) printf("mesh loaded with %i vertices, %i face indices, %i targets\n",mesh.getNumVertices(),mesh.getNumIndices(),mesh.getNumTargets()); - else printf("XML not parsed\n"); + else printf("mesh XML file not parsed\n"); + + if (mesh.loadSeqs("Bird-anim-test.xml")) printf("animation loaded with %i sequences\n",mesh.getNumSequences()); + else printf("animation XML file not parsed\n"); + + mesh.sequences["flap"].start(); texture.loadImage("texture2.jpg"); @@ -27,14 +32,10 @@ void testApp::update(){ void testApp::draw(){ //calculate morph targets float segment=(sin(ofGetElapsedTimef())*0.5)+0.5; - vector targets; - vector weights; - targets.push_back("bird 2"); - weights.push_back(segment); - targets.push_back("bird"); - weights.push_back(1.0-segment); - //printf("drawing %f %f\n",segment,1.0-segment); - + vector testweight; + testweight.push_back(morphWeight("bird 2",segment)); + testweight.push_back(morphWeight("bird",1.0-segment)); + ofBackground(0,0,0); bindTexture(texture); ofPushMatrix(); @@ -43,7 +44,8 @@ void testApp::draw(){ ofRotate(yr,1,0,0); ofRotate(180,1,0,0); ofScale(2.0,2.0,2.0); - mesh.draw(targets,weights); + //mesh.draw(testweight); + mesh.drawAnimated(); ofPopMatrix(); unbindTexture(texture); -- cgit v1.2.3