Skip to content

Commit

Permalink
reset camera with O (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShinP00r authored and fenollp committed Nov 18, 2018
1 parent bd96115 commit 5100323
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ The actual file being represented below [is data/BigPictureBG.tga](http://www.do

```shell
./configure -d RELEASE && cd build && make
./voidstar --move --spin ../data/*
./voidstar --move ../data/*
# Press H and L to switch between files
# Use A W S D Z X and your mouse to move in the 3D space
# Press F for full screen
# Use the arrows to slide and enlarge the sliding window
# Press M to slide the window to the end and SPACE to spin the shape
# Press M to slide the window to the end
# SPACE to toggle spinning the shape
# Press O to reset the camera position
# ESC to quit
```

Expand Down
4 changes: 2 additions & 2 deletions src/Arguments.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ usage(const char* prgname) {
<< " -w, --sliding Length of sliding window" << std::endl
<< " -s, --slide-step Amount of points slid" << std::endl
<< " -m, --move Move sliding window forward" << std::endl
<< " -n, --spin Spin shape on itself" << std::endl
<< " -n, --spin Don't spin shape on itself" << std::endl
<< std::endl
<< " -b, --begin begin offset for the range" << std::endl
<< " -e, --end end offset for the range" << std::endl
Expand Down Expand Up @@ -96,7 +96,7 @@ parseArgs(int argc, char *argv[]) {
args->move_window = true;
break;
case 'n':
args->spin_shape = true;
args->spin_shape = false;
break;
case 's':
args->sliding_step = std::stoul(optarg);
Expand Down
10 changes: 7 additions & 3 deletions src/Scene3D.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ Scene3D::load(std::shared_ptr<Algorithm> algorithm) {
std::cout << "#indices: " << Manager::size2str(indices_.size()) << std::endl;
load_buffers();

camera_.setPosition(glm::vec3(0, 0, 4));
camera_.setNearAndFarPlanes(0.1, 100.);
// camera_.setPosition(glm::vec3(0, -0.1, 3));
// camera_.lookAt(glm::vec3(0,0,4));
// camera_.setNearAndFarPlanes(0.1, 100.);
}

bool
Expand All @@ -115,7 +116,10 @@ Scene3D::update(std::shared_ptr<Manager> manager, float elapsedTime) {
camera_.offsetPosition(elapsedTime * move_speed_ * -glm::vec3(0,1,0));
else if (events->keyDown('X'))
camera_.offsetPosition(elapsedTime * move_speed_ * glm::vec3(0,1,0));

if (events->keyPressed('O')) {
camera_.setPosition(glm::vec3(0, -0.1, 3.8));
camera_.lookAt(glm::vec3(0,0,4));
}
if (events->keyPressed(' '))
manager->args()->spin_shape = !manager->args()->spin_shape;
if (events->keyPressed('M'))
Expand Down
4 changes: 2 additions & 2 deletions src/include/Arguments.hh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ struct Arguments {
range_begin(0), range_end(0),
fullscreen(false),
keep_chrome(false),
sliding_window_length(2*1024), sliding_step(1024), move_window(false),
spin_shape(false)
sliding_window_length(37*1024), sliding_step(1024), move_window(false),
spin_shape(true)
{}

std::vector<std::string> paths;
Expand Down

0 comments on commit 5100323

Please sign in to comment.