Changeset 1236 for trunk/packages/vizservers/nanovis
- Timestamp:
- Nov 25, 2008, 9:56:29 AM (16 years ago)
- Location:
- trunk/packages/vizservers/nanovis
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/Command.cpp
r1229 r1236 732 732 return TCL_ERROR; 733 733 } 734 /* Convert to normalized coordinates */ 735 x = x / (float)NanoVis::win_width; 736 y = y / (float)NanoVis::win_height; 737 /* Move the camera and its target by equal amounts along the x and y 738 * axes. */ 739 NanoVis::cam->x(NanoVis::cam->x() + x); 740 NanoVis::cam->y(NanoVis::cam->y() + y); 741 fprintf(stderr, "dx=%f, dy=%f\n", x, y); 742 fprintf(stderr, "set eye to %f %f\n", NanoVis::cam->x(), NanoVis::cam->y()); 743 Vector3 target; 744 target = NanoVis::cam->aim(); 745 x += target.x; 746 y += target.y; 747 NanoVis::cam->aim(x, y, target.z); 748 fprintf(stderr, "set aim to %f %f\n", x, y); 734 NanoVis::pan(x, y); 749 735 return TCL_OK; 750 736 } -
trunk/packages/vizservers/nanovis/NvCamera.h
r1215 r1236 42 42 43 43 //move location of camera 44 void x( doubleloc_x) {44 void x(float loc_x) { 45 45 location_.x = loc_x; 46 46 } … … 48 48 return location_.x; 49 49 } 50 void y( doubleloc_y) {50 void y(float loc_y) { 51 51 location_.y = loc_y; 52 52 } … … 54 54 return location_.y; 55 55 } 56 void z( doubleloc_z) {56 void z(float loc_z) { 57 57 location_.z = loc_z; 58 58 } … … 61 61 } 62 62 63 void aim(double target_x, double target_y, double target_z) { 64 target_ = Vector3(target_x, target_y, target_z); 63 //move location of target 64 void xAim(float x) { 65 aim_.x = x; 65 66 } 66 Vector3 aim(void) {67 return target_;67 float xAim(void) { 68 return aim_.x; 68 69 } 69 void rotate(double angle_x, double angle_y, double angle_z) { 70 void yAim(float y) { 71 aim_.y = y; 72 } 73 float yAim(void) { 74 return aim_.y; 75 } 76 void zAim(float z) { 77 aim_.z = z; 78 } 79 float zAim(void) { 80 return aim_.z; 81 } 82 83 void rotate(float angle_x, float angle_y, float angle_z) { 70 84 angle_ = Vector3(angle_x, angle_y, angle_z); 71 85 } -
trunk/packages/vizservers/nanovis/nanovis.cpp
r1219 r1236 442 442 return result; 443 443 } 444 445 static void 446 NanoVis::pan(int dx, int dy) 447 { 448 float x, y; 449 450 /* Normalize coordinates */ 451 x = (float)dx / (float)win_width; 452 y = (float)dy / (float)win_height; 453 454 /* Move the camera and its target by equal amounts along the x and y 455 * axes. */ 456 fprintf(stderr, "x=%f, y=%f\n", x, y); 457 458 cam->x(cam->x() + x); 459 cam->y(cam->y() + y); 460 fprintf(stderr, "set eye to %f %f\n", cam->x(), cam->y()); 461 462 cam->xAim(cam->xAim() + x); 463 cam->yAim(cam->yAim() + y); 464 fprintf(stderr, "set aim to %f %f\n", cam->xAim(), cam->yAim()); 465 } 466 444 467 445 468 /* Load a 3D volume
Note: See TracChangeset
for help on using the changeset viewer.