Showing the changes to interface/src/Application.cpp (1 of 21 files). Show all
Unified · Split
| @@ -2135,13 +2135,21 @@ void Application::toggleMixedSong() { · 2134 unmodified lines | |||
| 2135 | 2135 | ||
| 2136 | QByteArray filenameArray = filename.toLocal8Bit(); | 2136 | QByteArray filenameArray = filename.toLocal8Bit(); |
| 2137 | _audio.importSongToMixWithMicrophone(filenameArray.data()); | 2137 | _audio.importSongToMixWithMicrophone(filenameArray.data()); |
| 2138 | _rawAudioMicrophoneMix->setText("Stop Mixing Song"); | 2138 | resetSongMixMenuItem(); |
| 2139 | } else { | 2139 | } else { |
| 2140 | _audio.stopMixingSongWithMicrophone(); | 2140 | _audio.stopMixingSongWithMicrophone(); |
| 2141 | _rawAudioMicrophoneMix->setText("Mix RAW Song"); | 2141 | resetSongMixMenuItem(); |
| 2142 | } | 2142 | } |
| 2143 | } | 2143 | } |
| 2144 | 2144 | ||
| 2145 | void Application::resetSongMixMenuItem() { | ||
| 2146 | if (_audio.getSongFileBytes() == 0) { | ||
| 2147 | _rawAudioMicrophoneMix->setText("Mix RAW Song"); | ||
| 2148 | } else { | ||
| 2149 | _rawAudioMicrophoneMix->setText("Stop Mixing Song"); | ||
| 2150 | } | ||
| 2151 | |||
| 2152 | } | ||
| 2145 | 2153 | ||
| 2146 | void Application::updateFrustumRenderModeAction() { | 2154 | void Application::updateFrustumRenderModeAction() { |
| 2147 | switch (_frustumDrawingMode) { | 2155 | switch (_frustumDrawingMode) { |
| @@ -2251,7 +2259,7 @@ Avatar* Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3 · 103 unmodified lines | |||
| 2251 | if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { | 2259 | if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { |
| 2252 | Avatar* avatar = (Avatar *) node->getLinkedData(); | 2260 | Avatar* avatar = (Avatar *) node->getLinkedData(); |
| 2253 | glm::vec3 headPosition = avatar->getHead().getPosition(); | 2261 | glm::vec3 headPosition = avatar->getHead().getPosition(); |
| 2254 | if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) { | 2262 | if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS * avatar->getScale())) { |
| 2255 | eyePosition = avatar->getHead().getEyePosition(); | 2263 | eyePosition = avatar->getHead().getEyePosition(); |
| 2256 | _lookatIndicatorScale = avatar->getScale(); | 2264 | _lookatIndicatorScale = avatar->getScale(); |
| 2257 | _lookatOtherPosition = headPosition; | 2265 | _lookatOtherPosition = headPosition; |
| @@ -2263,6 +2271,16 @@ Avatar* Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3 · 5 unmodified lines | |||
| 2263 | return NULL; | 2271 | return NULL; |
| 2264 | } | 2272 | } |
| 2265 | 2273 | ||
| 2274 | bool Application::isLookingAtMyAvatar(Avatar* avatar) { | ||
| 2275 | glm::vec3 theirLookat = avatar->getHead().getLookAtPosition(); | ||
| 2276 | glm::vec3 myHeadPosition = _myAvatar.getHead().getPosition(); | ||
| 2277 | |||
| 2278 | if (pointInSphere(theirLookat, myHeadPosition, HEAD_SPHERE_RADIUS * _myAvatar.getScale())) { | ||
| 2279 | return true; | ||
| 2280 | } | ||
| 2281 | return false; | ||
| 2282 | } | ||
| 2283 | |||
| 2266 | void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& whichCamera) { | 2284 | void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& whichCamera) { |
| 2267 | 2285 | ||
| 2268 | const float DISTANCE_FROM_HEAD_SPHERE = 0.1f * _lookatIndicatorScale; | 2286 | const float DISTANCE_FROM_HEAD_SPHERE = 0.1f * _lookatIndicatorScale; |
| @@ -2954,6 +2972,23 @@ void Application::displaySide(Camera& whichCamera) { · 685 unmodified lines | |||
| 2954 | 2972 | ||
| 2955 | //draw a grid ground plane.... | 2973 | //draw a grid ground plane.... |
| 2956 | if (_renderGroundPlaneOn->isChecked()) { | 2974 | if (_renderGroundPlaneOn->isChecked()) { |
| 2975 | // draw grass plane with fog | ||
| 2976 | glEnable(GL_FOG); | ||
| 2977 | const float FOG_COLOR[] = { 1.0f, 1.0f, 1.0f, 1.0f }; | ||
| 2978 | glFogfv(GL_FOG_COLOR, FOG_COLOR); | ||
| 2979 | glFogi(GL_FOG_MODE, GL_EXP2); | ||
| 2980 | glFogf(GL_FOG_DENSITY, 0.025f); | ||
| 2981 | glPushMatrix(); | ||
| 2982 | const float GRASS_PLANE_SIZE = 256.0f; | ||
| 2983 | glTranslatef(-GRASS_PLANE_SIZE * 0.5f, -0.01f, GRASS_PLANE_SIZE * 0.5f); | ||
| 2984 | glScalef(GRASS_PLANE_SIZE, 1.0f, GRASS_PLANE_SIZE); | ||
| 2985 | glRotatef(-90.0f, 1.0f, 0.0f, 0.0f); | ||
| 2986 | glColor3ub(70, 134, 74); | ||
| 2987 | const int GRASS_DIVISIONS = 40; | ||
| 2988 | _geometryCache.renderSquare(GRASS_DIVISIONS, GRASS_DIVISIONS); | ||
| 2989 | glPopMatrix(); | ||
| 2990 | glDisable(GL_FOG); | ||
| 2991 | |||
| 2957 | renderGroundPlaneGrid(EDGE_SIZE_GROUND_PLANE, _audio.getCollisionSoundMagnitude()); | 2992 | renderGroundPlaneGrid(EDGE_SIZE_GROUND_PLANE, _audio.getCollisionSoundMagnitude()); |
| 2958 | } | 2993 | } |
| 2959 | // Draw voxels | 2994 | // Draw voxels |
| @@ -2995,6 +3030,9 @@ void Application::displaySide(Camera& whichCamera) { · 35 unmodified lines | |||
| 2995 | if (!avatar->isInitialized()) { | 3030 | if (!avatar->isInitialized()) { |
| 2996 | avatar->init(); | 3031 | avatar->init(); |
| 2997 | } | 3032 | } |
| 3033 | if (isLookingAtMyAvatar(avatar)) { | ||
| 3034 | avatar->getHead().setLookAtPosition(_myCamera.getPosition()); | ||
| 3035 | } | ||
| 2998 | avatar->render(false, _renderAvatarBalls->isChecked()); | 3036 | avatar->render(false, _renderAvatarBalls->isChecked()); |
| 2999 | avatar->setDisplayingLookatVectors(_renderLookatOn->isChecked()); | 3037 | avatar->setDisplayingLookatVectors(_renderLookatOn->isChecked()); |
| 3000 | } | 3038 | } |