- // TODO: carry excess time over to next node? This is how it was done in camera.cpp:
- /*
- if(auto_t - elapsed_time >= 0) {
- translation += current_dir * elapsed_time;
- auto_t -= elapsed_time;
- } else {
- // do the rest of the old movement
- translation += current_dir * auto_t;
- elapsed_time -= auto_t;
- auto_t = 0;
-
- // construct path for next point
- if(auto_idx+1 >= scrollpoints.size()) {
- keep_in_bounds(translation);
- return;
- }
- Vector distance = scrollpoints[auto_idx+1].position
- - scrollpoints[auto_idx].position;
- current_dir = distance.unit() * scrollpoints[auto_idx].speed;
- auto_t = distance.norm() / scrollpoints[auto_idx].speed;
-
- // do movement for the remaining time
- translation += current_dir * elapsed_time;
- auto_t -= elapsed_time;
- auto_idx++;
- }
- */
-
- // advance to next node at scheduled time
- if (timeToGo <= 0) {
- position = pathNodes[destinationNode].position;
-
- // set destinationNode to next node
- if (forward) {
- destinationNode++;
- if (destinationNode >= (int)pathNodes.size()) {
- if (circular) {
- destinationNode = 0;
- } else {
- destinationNode = (int)pathNodes.size()-1;
- }
- }
- } else {
- destinationNode--;
- if (destinationNode < 0) {
- if (circular) {
- destinationNode = (int)pathNodes.size()-1;
- } else {
- destinationNode = 0;
- }
+ mode = CIRCULAR;
+ while(iter.next()) {
+ if(iter.item() == "mode") {
+ std::string mode_string;
+ if(!iter.value()->get(mode_string))
+ throw std::runtime_error("Pathmode not a string");
+
+ if(mode_string == "oneshot")
+ mode = ONE_SHOT;
+ else if(mode_string == "pingpong")
+ mode = PING_PONG;
+ else if(mode_string == "circular")
+ mode = CIRCULAR;
+ else {
+ std::ostringstream msg;
+ msg << "Unknown pathmode '" << mode_string << "' found";
+ throw std::runtime_error(msg.str());