Showing the changes to interface/src/main.cpp (1 of 5 files). Show all
Unified · Split
| @@ -692,14 +692,14 @@ void displaySide(Camera& whichCamera) { · 691 unmodified lines | |||
| 692 | float sphereRadius = 0.25f; | 692 | float sphereRadius = 0.25f; |
| 693 | glColor3f(1,0,0); | 693 | glColor3f(1,0,0); |
| 694 | glPushMatrix(); | 694 | glPushMatrix(); |
| 695 | glutSolidSphere( sphereRadius, 15, 15 ); | 695 | glutSolidSphere(sphereRadius, 15, 15); |
| 696 | glPopMatrix(); | 696 | glPopMatrix(); |
| 697 | 697 | ||
| 698 | //draw a grid ground plane.... | 698 | //draw a grid ground plane.... |
| 699 | drawGroundPlaneGrid(10.f); | 699 | drawGroundPlaneGrid(10.f); |
| 700 | 700 | ||
| 701 | // Draw voxels | 701 | // Draw voxels |
| 702 | if ( showingVoxels ) | 702 | if (showingVoxels) |
| 703 | { | 703 | { |
| 704 | voxels.render(); | 704 | voxels.render(); |
| 705 | } | 705 | } |
| @@ -984,15 +984,15 @@ void display(void) · 278 unmodified lines | |||
| 984 | glMateriali(GL_FRONT, GL_SHININESS, 96); | 984 | glMateriali(GL_FRONT, GL_SHININESS, 96); |
| 985 | 985 | ||
| 986 | // camera settings | 986 | // camera settings |
| 987 | if ( ::lookingInMirror ) { | 987 | if (::lookingInMirror) { |
| 988 | // set the camera to looking at my own face | 988 | // set the camera to looking at my own face |
| 989 | myCamera.setTargetPosition ( myAvatar.getHeadPosition() ); | 989 | myCamera.setTargetPosition (myAvatar.getHeadPosition()); |
| 990 | myCamera.setTargetYaw ( myAvatar.getBodyYaw() - 180.0f ); // 180 degrees from body yaw | 990 | myCamera.setTargetYaw (myAvatar.getBodyYaw() - 180.0f); // 180 degrees from body yaw |
| 991 | myCamera.setPitch ( 0.0 ); | 991 | myCamera.setPitch (0.0); |
| 992 | myCamera.setRoll ( 0.0 ); | 992 | myCamera.setRoll (0.0); |
| 993 | myCamera.setUpShift ( 0.0 ); | 993 | myCamera.setUpShift (0.0); |
| 994 | myCamera.setDistance ( 0.2 ); | 994 | myCamera.setDistance (0.2); |
| 995 | myCamera.setTightness ( 100.0f ); | 995 | myCamera.setTightness (100.0f); |
| 996 | } else { | 996 | } else { |
| 997 | 997 | ||
| 998 | //float firstPersonPitch = 20.0f; | 998 | //float firstPersonPitch = 20.0f; |
| @@ -1010,36 +1010,24 @@ void display(void) · 11 unmodified lines | |||
| 1010 | float thirdPersonDistance = 1.2f; | 1010 | float thirdPersonDistance = 1.2f; |
| 1011 | float thirdPersonTightness = 8.0f; | 1011 | float thirdPersonTightness = 8.0f; |
| 1012 | 1012 | ||
| 1013 | if ( USING_FIRST_PERSON_EFFECT ) { | 1013 | if (USING_FIRST_PERSON_EFFECT) { |
| 1014 | float ff = 0.0; | 1014 | float ff = 0.0; |
| 1015 | float min = 0.1; | 1015 | float min = 0.1; |
| 1016 | float max = 0.5; | 1016 | float max = 0.5; |
| 1017 | 1017 | ||
| 1018 | if ( myAvatar.getIsNearInteractingOther()){ | 1018 | if (myAvatar.getIsNearInteractingOther()){ |
| 1019 | if ( myAvatar.getSpeed() < max ) { | 1019 | if (myAvatar.getSpeed() < max) { |
| 1020 | 1020 | ||
| 1021 | float s = (myAvatar.getSpeed()- min)/max ; | 1021 | float s = (myAvatar.getSpeed()- min)/max ; |
| 1022 | ff = 1.0 - s; | 1022 | ff = 1.0 - s; |
| 1023 | } | 1023 | } |
| 1024 | } | 1024 | } |
| 1025 | |||
| 1026 | /* | ||
| 1027 | if ( ff < 0.8 ) { | ||
| 1028 | myAvatar.setDisplayingHead( true ); | ||
| 1029 | } else { | ||
| 1030 | myAvatar.setDisplayingHead( false ); | ||
| 1031 | } | ||
| 1032 | */ | ||
| 1033 | |||
| 1034 | //printf( "ff = %f\n", ff ); | ||
| 1035 | 1025 | ||
| 1036 | myCamera.setPitch ( thirdPersonPitch + ff * ( firstPersonPitch - thirdPersonPitch )); | 1026 | myCamera.setPitch (thirdPersonPitch + ff * (firstPersonPitch - thirdPersonPitch )); |
| 1037 | myCamera.setUpShift ( thirdPersonUpShift + ff * ( firstPersonUpShift - thirdPersonUpShift )); | 1027 | myCamera.setUpShift (thirdPersonUpShift + ff * (firstPersonUpShift - thirdPersonUpShift )); |
| 1038 | myCamera.setDistance ( thirdPersonDistance + ff * ( firstPersonDistance - thirdPersonDistance )); | 1028 | myCamera.setDistance (thirdPersonDistance + ff * (firstPersonDistance - thirdPersonDistance )); |
| 1039 | myCamera.setTightness ( thirdPersonTightness + ff * ( firstPersonTightness - thirdPersonTightness )); | 1029 | myCamera.setTightness (thirdPersonTightness + ff * (firstPersonTightness - thirdPersonTightness)); |
| 1040 | |||
| 1041 | 1030 | ||
| 1042 | |||
| 1043 | // this version uses a ramp-up/ramp-down timer in the camera to determine shift between first and thirs-person view | 1031 | // this version uses a ramp-up/ramp-down timer in the camera to determine shift between first and thirs-person view |
| 1044 | /* | 1032 | /* |
| 1045 | if ( myAvatar.getSpeed() < 0.02 ) { | 1033 | if ( myAvatar.getSpeed() < 0.02 ) { |
| @@ -1073,13 +1061,13 @@ void display(void) · 27 unmodified lines | |||
| 1073 | myCamera.setTightness(thirdPersonTightness); | 1061 | myCamera.setTightness(thirdPersonTightness); |
| 1074 | } | 1062 | } |
| 1075 | 1063 | ||
| 1076 | myCamera.setTargetPosition( myAvatar.getHeadPosition() ); | 1064 | myCamera.setTargetPosition(myAvatar.getHeadPosition()); |
| 1077 | myCamera.setTargetYaw ( myAvatar.getBodyYaw() ); | 1065 | myCamera.setTargetYaw (myAvatar.getBodyYaw()); |
| 1078 | myCamera.setRoll ( 0.0 ); | 1066 | myCamera.setRoll (0.0); |
| 1079 | } | 1067 | } |
| 1080 | 1068 | ||
| 1081 | // important... | 1069 | // important... |
| 1082 | myCamera.update( 1.f/FPS ); | 1070 | myCamera.update(1.f/FPS); |
| 1083 | 1071 | ||
| 1084 | // Note: whichCamera is used to pick between the normal camera myCamera for our | 1072 | // Note: whichCamera is used to pick between the normal camera myCamera for our |
| 1085 | // main camera, vs, an alternate camera. The alternate camera we support right now | 1073 | // main camera, vs, an alternate camera. The alternate camera we support right now |
| @@ -1095,11 +1083,11 @@ void display(void) · 9 unmodified lines | |||
| 1095 | if (::viewFrustumFromOffset && ::frustumOn) { | 1083 | if (::viewFrustumFromOffset && ::frustumOn) { |
| 1096 | 1084 | ||
| 1097 | // set the camera to third-person view but offset so we can see the frustum | 1085 | // set the camera to third-person view but offset so we can see the frustum |
| 1098 | viewFrustumOffsetCamera.setTargetYaw( ::viewFrustumOffsetYaw + myAvatar.getBodyYaw() ); | 1086 | viewFrustumOffsetCamera.setTargetYaw(::viewFrustumOffsetYaw + myAvatar.getBodyYaw() ); |
| 1099 | viewFrustumOffsetCamera.setPitch ( ::viewFrustumOffsetPitch ); | 1087 | viewFrustumOffsetCamera.setPitch (::viewFrustumOffsetPitch ); |
| 1100 | viewFrustumOffsetCamera.setRoll ( ::viewFrustumOffsetRoll ); | 1088 | viewFrustumOffsetCamera.setRoll (::viewFrustumOffsetRoll ); |
| 1101 | viewFrustumOffsetCamera.setUpShift ( ::viewFrustumOffsetUp ); | 1089 | viewFrustumOffsetCamera.setUpShift (::viewFrustumOffsetUp ); |
| 1102 | viewFrustumOffsetCamera.setDistance ( ::viewFrustumOffsetDistance ); | 1090 | viewFrustumOffsetCamera.setDistance (::viewFrustumOffsetDistance); |
| 1103 | viewFrustumOffsetCamera.update(1.f/FPS); | 1091 | viewFrustumOffsetCamera.update(1.f/FPS); |
| 1104 | whichCamera = viewFrustumOffsetCamera; | 1092 | whichCamera = viewFrustumOffsetCamera; |
| 1105 | } | 1093 | } |
| @@ -1109,11 +1097,11 @@ void display(void) · 3 unmodified lines | |||
| 1109 | // or could be viewFrustumOffsetCamera if in offset mode | 1097 | // or could be viewFrustumOffsetCamera if in offset mode |
| 1110 | // I changed the ordering here - roll is FIRST (JJV) | 1098 | // I changed the ordering here - roll is FIRST (JJV) |
| 1111 | 1099 | ||
| 1112 | glRotatef ( whichCamera.getRoll(), IDENTITY_FRONT.x, IDENTITY_FRONT.y, IDENTITY_FRONT.z ); | 1100 | glRotatef ( whichCamera.getRoll(), IDENTITY_FRONT.x, IDENTITY_FRONT.y, IDENTITY_FRONT.z); |
| 1113 | glRotatef ( whichCamera.getPitch(), IDENTITY_RIGHT.x, IDENTITY_RIGHT.y, IDENTITY_RIGHT.z ); | 1101 | glRotatef ( whichCamera.getPitch(), IDENTITY_RIGHT.x, IDENTITY_RIGHT.y, IDENTITY_RIGHT.z); |
| 1114 | glRotatef ( 180.0 - whichCamera.getYaw(), IDENTITY_UP.x, IDENTITY_UP.y, IDENTITY_UP.z ); | 1102 | glRotatef (180.0 - whichCamera.getYaw(), IDENTITY_UP.x, IDENTITY_UP.y, IDENTITY_UP.z ); |
| 1115 | 1103 | ||
| 1116 | glTranslatef( -whichCamera.getPosition().x, -whichCamera.getPosition().y, -whichCamera.getPosition().z ); | 1104 | glTranslatef(-whichCamera.getPosition().x, -whichCamera.getPosition().y, -whichCamera.getPosition().z); |
| 1117 | 1105 | ||
| 1118 | if (::oculusOn) { | 1106 | if (::oculusOn) { |
| 1119 | displayOculus(whichCamera); | 1107 | displayOculus(whichCamera); |
| @@ -1666,16 +1654,16 @@ void idle(void) { · 546 unmodified lines | |||
| 1666 | 1654 | ||
| 1667 | // update behaviors for avatar hand movement: handControl takes mouse values as input, | 1655 | // update behaviors for avatar hand movement: handControl takes mouse values as input, |
| 1668 | // and gives back 3D values modulated for smooth transitioning between interaction modes. | 1656 | // and gives back 3D values modulated for smooth transitioning between interaction modes. |
| 1669 | handControl.update( mouseX, mouseY ); | 1657 | handControl.update(mouseX, mouseY); |
| 1670 | myAvatar.setHandMovementValues( handControl.getValues() ); | 1658 | myAvatar.setHandMovementValues(handControl.getValues()); |
| 1671 | 1659 | ||
| 1672 | // tell my avatar if the mouse is being pressed... | 1660 | // tell my avatar if the mouse is being pressed... |
| 1673 | if ( mousePressed) { | 1661 | if (mousePressed) { |
| 1674 | myAvatar.setMousePressed(mousePressed); | 1662 | myAvatar.setMousePressed(mousePressed); |
| 1675 | } | 1663 | } |
| 1676 | 1664 | ||
| 1677 | // walking triggers the handControl to stop | 1665 | // walking triggers the handControl to stop |
| 1678 | if ( myAvatar.getMode() == AVATAR_MODE_WALKING ) { | 1666 | if (myAvatar.getMode() == AVATAR_MODE_WALKING) { |
| 1679 | handControl.stop(); | 1667 | handControl.stop(); |
| 1680 | } | 1668 | } |
| 1681 | 1669 | ||
| @@ -1868,7 +1856,7 @@ int main(int argc, const char * argv[]) · 186 unmodified lines | |||
| 1868 | 1856 | ||
| 1869 | #ifdef _WIN32 | 1857 | #ifdef _WIN32 |
| 1870 | WSADATA WsaData; | 1858 | WSADATA WsaData; |
| 1871 | int wsaresult = WSAStartup( MAKEWORD(2,2), &WsaData ); | 1859 | int wsaresult = WSAStartup(MAKEWORD(2,2), &WsaData); |
| 1872 | #endif | 1860 | #endif |
| 1873 | 1861 | ||
| 1874 | // start the agentList threads | 1862 | // start the agentList threads |