Camera position initialization

Issue #43 resolved
Shameek Ganguly created an issue

I noticed that irrespective of what you set the initial camera to in the config file, it goes to a default value if you try moving it slightly, which is pretty disturbing.

Tracked down the error to be in ChaiGlutHandlers.cpp where in initializing the global graphics ds, the initial position has been hardcoded. The following code snippet fixes it:

In ChaiGlutHandlers.cpp: initializeGlutForChai(): Line 99:

//set the initial camera position:
            chai_glob_ds->cam_sph_x_=(gr_parsed_ds->cam_pos_ - gr_parsed_ds->cam_lookat_).norm();
          chai_glob_ds->cam_sph_v_= 180/M_PI*(std::asin(gr_parsed_ds->cam_pos_[2]/chai_glob_ds->cam_sph_x_));
          chai_glob_ds->cam_sph_h_= 180/M_PI*(std::asin(gr_parsed_ds->cam_pos_[1]/(chai_glob_ds->cam_sph_x_*cCosDeg(chai_glob_ds->cam_sph_v_))));

Comments (1)

  1. Log in to comment