Changeset 1215 for trunk/packages/vizservers/nanovis/NvCamera.cpp
- Timestamp:
- Nov 13, 2008, 3:24:00 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/NvCamera.cpp
r953 r1215 20 20 21 21 NvCamera::NvCamera(int startx, int starty, int w, int h, 22 double loc_x, double loc_y, doubleloc_z,23 double target_x, double target_y, doubletarget_z,24 int angle_x, int angle_y, int angle_z):25 location (Vector3(loc_x, loc_y, loc_z)),26 target (Vector3(target_x, target_y, target_z)),27 angle (Vector3(angle_x, angle_y, angle_z)),28 width (w),29 height (h),30 startX (startx),31 startY (starty)22 float loc_x, float loc_y, float loc_z, 23 float target_x, float target_y, float target_z, 24 float angle_x, float angle_y, float angle_z): 25 location_(Vector3(loc_x, loc_y, loc_z)), 26 target_(Vector3(target_x, target_y, target_z)), 27 angle_(Vector3(angle_x, angle_y, angle_z)), 28 width_(w), 29 height_(h), 30 startX_(startx), 31 startY_(starty) 32 32 { 33 33 /*empty*/ 34 34 } 35 35 36 NvCamera::~NvCamera()37 {38 /*empty*/39 }40 41 void42 NvCamera::move(double loc_x, double loc_y, double loc_z)43 {44 location = Vector3(loc_x, loc_y, loc_z);45 }46 47 void48 NvCamera::aim(double target_x, double target_y, double target_z)49 {50 target = Vector3(target_x, target_y, target_z);51 }52 53 void54 NvCamera::rotate(double angle_x, double angle_y, double angle_z)55 {56 angle = Vector3(angle_x, angle_y, angle_z);57 }58 36 59 37 void … … 61 39 { 62 40 //fprintf(stderr, "camera: %d, %d\n", width, height); 63 glViewport(startX , startY, width, height);41 glViewport(startX_, startY_, width_, height_); 64 42 glMatrixMode(GL_PROJECTION); 65 43 glLoadIdentity(); 66 gluPerspective(30, (GLdouble)(width - startX)/(GLdouble)(height - startY), 67 0.1, 50.0); 44 gluPerspective(30, 45 (GLdouble)(width_ - startX_)/(GLdouble)(height_ - startY_), 46 0.1, 50.0); 68 47 69 48 glMatrixMode(GL_MODELVIEW); 70 49 glLoadIdentity(); 71 50 72 gluLookAt(location .x, location.y, location.z,73 target .x, target.y, target.z,51 gluLookAt(location_.x, location_.y, location_.z, 52 target_.x, target_.y, target_.z, 74 53 0., 1., 0.); 75 54 76 glRotated(angle .x, 1., 0., 0.);77 glRotated(angle .y, 0., 1., 0.);78 glRotated(angle .z, 0., 0., 1.);55 glRotated(angle_.x, 1., 0., 0.); 56 glRotated(angle_.y, 0., 1., 0.); 57 glRotated(angle_.z, 0., 0., 1.); 79 58 } 80 59 81 void82 NvCamera::set_screen_size(int sx, int sy, int w, int h)83 {84 width = w, height = h;85 startX = sx, startY = sy;86 }
Note: See TracChangeset
for help on using the changeset viewer.