Showing the changes to interface/src/main.cpp (1 of 10 files). Show all
Unified · Split
| @@ -75,6 +75,9 @@ · 74 unmodified lines | ||
| 75 | 75 | #include <PerfStat.h> |
| 76 | 76 | #include <SharedUtil.h> |
| 77 | 77 | #include <PacketHeaders.h> |
| 78 | +#include <glmUtils.h> | |
| 79 | + | |
| 80 | +#include "ViewFrustum.h" | |
| 78 | 81 | |
| 79 | 82 | using namespace std; |
| 80 | 83 | |
| @@ -159,6 +162,7 @@ bool viewFrustumFromOffset=false; // Wether or not to offset the view of the · 78 unmodified lines | ||
| 159 | 162 | float viewFrustumOffsetYaw = -90.0; |
| 160 | 163 | float viewFrustumOffsetPitch = 7.5; |
| 161 | 164 | float viewFrustumOffsetRoll = 0.0; |
| 165 | +float viewFrustumOffsetDistance = 0.0; | |
| 162 | 166 | |
| 163 | 167 | int noiseOn = 0; // Whether to add random noise |
| 164 | 168 | float noise = 1.0; // Overall magnitude scaling for random noise levels |
| @@ -561,11 +565,14 @@ void render_view_frustum() { · 396 unmodified lines | ||
| 561 | 565 | up = headUp; |
| 562 | 566 | right = headRight; |
| 563 | 567 | } |
| 568 | + | |
| 569 | + ViewFrustum vf(viewFrustumPosition,viewFrustumDirection); | |
| 570 | + vf.dump(); | |
| 564 | 571 | |
| 565 | 572 | float nearDist = 0.1; |
| 566 | − float farDist = 1.0; | |
| 573 | + float farDist = 10.0; | |
| 567 | 574 | |
| 568 | − float fovHalfAngle = 0.7854f*1.7; // 45 deg for half, so fov = 90 deg | |
| 575 | + float fovHalfAngle = 0.7854f*1.5; // 45 deg for half, so fov = 90 deg | |
| 569 | 576 | |
| 570 | 577 | float screenWidth = ::WIDTH; // These values come from reshape() |
| 571 | 578 | float screenHeight = ::HEIGHT; |
| @@ -577,7 +584,7 @@ void render_view_frustum() { · 5 unmodified lines | ||
| 577 | 584 | float farWidth = farHeight * ratio; |
| 578 | 585 | |
| 579 | 586 | glm::vec3 farCenter = viewFrustumPosition+viewFrustumDirection*farDist; |
| 580 | − glm::vec3 farTopLeft = farCenter + (up*farHeight*0.5) - (right*farWidth*0.5); | |
| 587 | + glm::vec3 farTopLeft = farCenter + (up*farHeight*0.5) - (right*farWidth*0.5); | |
| 581 | 588 | glm::vec3 farTopRight = farCenter + (up*farHeight*0.5) + (right*farWidth*0.5); |
| 582 | 589 | glm::vec3 farBottomLeft = farCenter - (up*farHeight*0.5) - (right*farWidth*0.5); |
| 583 | 590 | glm::vec3 farBottomRight = farCenter - (up*farHeight*0.5) + (right*farWidth*0.5); |
| @@ -587,6 +594,9 @@ void render_view_frustum() { · 3 unmodified lines | ||
| 587 | 594 | glm::vec3 nearTopRight = nearCenter + (up*nearHeight*0.5) + (right*nearWidth*0.5); |
| 588 | 595 | glm::vec3 nearBottomLeft = nearCenter - (up*nearHeight*0.5) - (right*nearWidth*0.5); |
| 589 | 596 | glm::vec3 nearBottomRight = nearCenter - (up*nearHeight*0.5) + (right*nearWidth*0.5); |
| 597 | + | |
| 598 | + //printf("farCenter.x=%f, farCenter.y=%f, farCenter.z=%f\n",farCenter.x,farCenter.y,farCenter.z); | |
| 599 | + //printf("farTopLeft.x=%f, farTopLeft.y=%f, farTopLeft.z=%f\n",farTopLeft.x,farTopLeft.y,farTopLeft.z); | |
| 590 | 600 | |
| 591 | 601 | // At this point we have all the corners for our frustum... we could use these to |
| 592 | 602 | // calculate various things... |
| @@ -770,9 +780,9 @@ void display(void) · 177 unmodified lines | ||
| 770 | 780 | //---------------------------------------------------- |
| 771 | 781 | viewFrustumOffsetCamera.setYaw ( 180.0 - myAvatar.getBodyYaw() + ::viewFrustumOffsetYaw ); |
| 772 | 782 | viewFrustumOffsetCamera.setPitch ( 0.0 + ::viewFrustumOffsetPitch ); |
| 773 | − viewFrustumOffsetCamera.setRoll ( 0.0 + ::viewFrustumOffsetRoll ); | |
| 783 | + viewFrustumOffsetCamera.setRoll ( 0.0 + ::viewFrustumOffsetRoll ); | |
| 774 | 784 | viewFrustumOffsetCamera.setUp ( 0.2 + 0.2 ); |
| 775 | − viewFrustumOffsetCamera.setDistance( 0.5 + 0.2 ); | |
| 785 | + viewFrustumOffsetCamera.setDistance ( 0.5 + ::viewFrustumOffsetDistance ); | |
| 776 | 786 | viewFrustumOffsetCamera.update(); |
| 777 | 787 | |
| 778 | 788 | whichCamera = viewFrustumOffsetCamera; |
| @@ -1138,6 +1148,9 @@ void key(unsigned char k, int x, int y) · 359 unmodified lines | ||
| 1138 | 1148 | if (k == '(') ::viewFrustumOffsetRoll -= 0.5; |
| 1139 | 1149 | if (k == ')') ::viewFrustumOffsetRoll += 0.5; |
| 1140 | 1150 | |
| 1151 | + if (k == '<') ::viewFrustumOffsetDistance -= 0.5; | |
| 1152 | + if (k == '>') ::viewFrustumOffsetDistance += 0.5; | |
| 1153 | + | |
| 1141 | 1154 | if (k == '&') { |
| 1142 | 1155 | ::paintOn = !::paintOn; // toggle paint |
| 1143 | 1156 | ::setupPaintingVoxel(); // also randomizes colors |