diff --git a/include/thing.h b/include/thing.h index 8a78da2..a5a73d4 100644 --- a/include/thing.h +++ b/include/thing.h @@ -23,6 +23,7 @@ virtual void scale(float f); virtual void trace(bool s); virtual void setIterations(int i); + virtual ~Thing(); }; class View : public Thing { @@ -50,6 +51,7 @@ void show(); void hide(); void draw(); + void rotate(Vec r); }; #endif diff --git a/sources/main.cpp b/sources/main.cpp index a79a943..3879fd3 100755 --- a/sources/main.cpp +++ b/sources/main.cpp @@ -320,9 +320,9 @@ /* end cube */ /* begin import */ - char* modelfile = "obj/sample2.obj"; + //char* modelfile = "obj/sample2.obj"; //char* modelfile = "obj/sample.obj"; - //char* modelfile = "obj/untitled.obj"; + char* modelfile = "obj/untitled.obj"; //char* modelfile = "obj/teapot.obj"; Model* myModel = importModel(modelfile); printf("imported %s : %d faces\n", modelfile, myModel->numFaces()); @@ -454,6 +454,14 @@ userAnim->addThing((Thing*)rotatingCubes); + StaticAnimation* l1Anim = new StaticAnimation(); + l1Anim->init(); + anims.push_back((Animation*)l1Anim); + + l1Anim->addThing((Thing*)rotatingCubes); + l1Anim->setRot(Vec(1.5f,0,0)); + + //Vec l1_pos(-10.0f, -10.0f, -10.0f); cube->showNormals(); float delta = 0; while (!done) { diff --git a/sources/thing.cpp b/sources/thing.cpp index ccfd27e..af5d4e0 100644 --- a/sources/thing.cpp +++ b/sources/thing.cpp @@ -18,6 +18,7 @@ void Thing::show() { } void Thing::hide() { } void Thing::setIterations(int i) { } +Thing::~Thing() { } View::View() { rotation = new Vec(0.0f, 0.0f, 0.0f); @@ -85,3 +86,9 @@ things.at(i)->draw(); } } + +void ThingGroup::rotate ( Vec rot ) { + for ( std::vector::size_type i = 0; i < things.size(); i++ ) { + things.at(i)->rotate((Vec)rot); + } +}