Showing the changes to interface/src/main.cpp (1 of 3 files). Show all
Unified · Split
| @@ -102,7 +102,7 @@ int HEIGHT = 800; · 101 unmodified lines | |||
| 102 | int fullscreen = 0; | 102 | int fullscreen = 0; |
| 103 | float aspectRatio = 1.0f; | 103 | float aspectRatio = 1.0f; |
| 104 | 104 | ||
| 105 | bool USING_FIRST_PERSON_EFFECT = false; | 105 | bool USING_FIRST_PERSON_EFFECT = true; |
| 106 | 106 | ||
| 107 | bool wantColorRandomizer = true; // for addSphere and load file | 107 | bool wantColorRandomizer = true; // for addSphere and load file |
| 108 | 108 | ||
| @@ -738,9 +738,14 @@ void display(void) · 629 unmodified lines | |||
| 738 | myCamera.setTightness ( 100.0f ); | 738 | myCamera.setTightness ( 100.0f ); |
| 739 | } else { | 739 | } else { |
| 740 | 740 | ||
| 741 | //float firstPersonPitch = 20.0f; | ||
| 742 | //float firstPersonUpShift = 0.0f; | ||
| 743 | //float firstPersonDistance = 0.0f; | ||
| 744 | //float firstPersonTightness = 100.0f; | ||
| 745 | |||
| 741 | float firstPersonPitch = 20.0f; | 746 | float firstPersonPitch = 20.0f; |
| 742 | float firstPersonUpShift = 0.1f; | 747 | float firstPersonUpShift = 0.1f; |
| 743 | float firstPersonDistance = 0.0f; | 748 | float firstPersonDistance = 0.4f; |
| 744 | float firstPersonTightness = 100.0f; | 749 | float firstPersonTightness = 100.0f; |
| 745 | 750 | ||
| 746 | float thirdPersonPitch = 0.0f; | 751 | float thirdPersonPitch = 0.0f; |
| @@ -749,14 +754,44 @@ void display(void) · 2 unmodified lines | |||
| 749 | float thirdPersonTightness = 8.0f; | 754 | float thirdPersonTightness = 8.0f; |
| 750 | 755 | ||
| 751 | if ( USING_FIRST_PERSON_EFFECT ) { | 756 | if ( USING_FIRST_PERSON_EFFECT ) { |
| 757 | float ff = 0.0; | ||
| 758 | float min = 0.1; | ||
| 759 | float max = 0.5; | ||
| 760 | |||
| 761 | if ( myAvatar.getIsNearInteractingOther()){ | ||
| 762 | if ( myAvatar.getSpeed() < max ) { | ||
| 763 | |||
| 764 | float s = (myAvatar.getSpeed()- min)/max ; | ||
| 765 | ff = 1.0 - s; | ||
| 766 | } | ||
| 767 | } | ||
| 768 | |||
| 769 | /* | ||
| 770 | if ( ff < 0.8 ) { | ||
| 771 | myAvatar.setDisplayingHead( true ); | ||
| 772 | } else { | ||
| 773 | myAvatar.setDisplayingHead( false ); | ||
| 774 | } | ||
| 775 | */ | ||
| 776 | |||
| 777 | //printf( "ff = %f\n", ff ); | ||
| 778 | |||
| 779 | myCamera.setPitch ( thirdPersonPitch + ff * ( firstPersonPitch - thirdPersonPitch )); | ||
| 780 | myCamera.setUpShift ( thirdPersonUpShift + ff * ( firstPersonUpShift - thirdPersonUpShift )); | ||
| 781 | myCamera.setDistance ( thirdPersonDistance + ff * ( firstPersonDistance - thirdPersonDistance )); | ||
| 782 | myCamera.setTightness ( thirdPersonTightness + ff * ( firstPersonTightness - thirdPersonTightness )); | ||
| 783 | |||
| 784 | |||
| 785 | |||
| 786 | // this version uses a ramp-up/ramp-down timer in the camera to determine shift between first and thirs-person view | ||
| 787 | /* | ||
| 752 | if ( myAvatar.getSpeed() < 0.02 ) { | 788 | if ( myAvatar.getSpeed() < 0.02 ) { |
| 753 | 789 | ||
| 754 | if (myCamera.getMode() != CAMERA_MODE_FIRST_PERSON ) { | 790 | if (myCamera.getMode() != CAMERA_MODE_FIRST_PERSON ) { |
| 755 | myCamera.setMode(CAMERA_MODE_FIRST_PERSON); | 791 | myCamera.setMode(CAMERA_MODE_FIRST_PERSON); |
| 756 | } | 792 | } |
| 757 | 793 | ||
| 758 | printf( "myCamera.getModeShift() = %f\n", myCamera.getModeShift()); | 794 | //printf( "myCamera.getModeShift() = %f\n", myCamera.getModeShift()); |
| 759 | |||
| 760 | myCamera.setPitch ( thirdPersonPitch + myCamera.getModeShift() * ( firstPersonPitch - thirdPersonPitch )); | 795 | myCamera.setPitch ( thirdPersonPitch + myCamera.getModeShift() * ( firstPersonPitch - thirdPersonPitch )); |
| 761 | myCamera.setUpShift ( thirdPersonUpShift + myCamera.getModeShift() * ( firstPersonUpShift - thirdPersonUpShift )); | 796 | myCamera.setUpShift ( thirdPersonUpShift + myCamera.getModeShift() * ( firstPersonUpShift - thirdPersonUpShift )); |
| 762 | myCamera.setDistance ( thirdPersonDistance + myCamera.getModeShift() * ( firstPersonDistance - thirdPersonDistance )); | 797 | myCamera.setDistance ( thirdPersonDistance + myCamera.getModeShift() * ( firstPersonDistance - thirdPersonDistance )); |
| @@ -766,13 +801,14 @@ void display(void) · 3 unmodified lines | |||
| 766 | myCamera.setMode(CAMERA_MODE_THIRD_PERSON); | 801 | myCamera.setMode(CAMERA_MODE_THIRD_PERSON); |
| 767 | } | 802 | } |
| 768 | 803 | ||
| 769 | printf( "myCamera.getModeShift() = %f\n", myCamera.getModeShift()); | 804 | //printf( "myCamera.getModeShift() = %f\n", myCamera.getModeShift()); |
| 770 | |||
| 771 | myCamera.setPitch ( firstPersonPitch + myCamera.getModeShift() * ( thirdPersonPitch - firstPersonPitch )); | 805 | myCamera.setPitch ( firstPersonPitch + myCamera.getModeShift() * ( thirdPersonPitch - firstPersonPitch )); |
| 772 | myCamera.setUpShift ( firstPersonUpShift + myCamera.getModeShift() * ( thirdPersonUpShift - firstPersonUpShift )); | 806 | myCamera.setUpShift ( firstPersonUpShift + myCamera.getModeShift() * ( thirdPersonUpShift - firstPersonUpShift )); |
| 773 | myCamera.setDistance ( firstPersonDistance + myCamera.getModeShift() * ( thirdPersonDistance - firstPersonDistance )); | 807 | myCamera.setDistance ( firstPersonDistance + myCamera.getModeShift() * ( thirdPersonDistance - firstPersonDistance )); |
| 774 | myCamera.setTightness ( firstPersonTightness + myCamera.getModeShift() * ( thirdPersonTightness - firstPersonTightness )); | 808 | myCamera.setTightness ( firstPersonTightness + myCamera.getModeShift() * ( thirdPersonTightness - firstPersonTightness )); |
| 775 | } | 809 | } |
| 810 | */ | ||
| 811 | |||
| 776 | } else { | 812 | } else { |
| 777 | myCamera.setPitch (thirdPersonPitch ); | 813 | myCamera.setPitch (thirdPersonPitch ); |
| 778 | myCamera.setUpShift (thirdPersonUpShift ); | 814 | myCamera.setUpShift (thirdPersonUpShift ); |