History

Merge branch 'master' of https://github.com/worklist/hifi into multiple_voxel_servers

ZappoMan committed 13 years ago

Commit f1a0edb2 parents 14b7f58 7021d3c21 files · +538 −278Browse files

Showing the changes to interface/src/Application.cpp (1 of 21 files). Show all

Unified · Split

interface/src/Application.cpp+41−3
@@ -2135,13 +2135,21 @@ void Application::toggleMixedSong() { · 2134 unmodified lines
21352135
21362136 QByteArray filenameArray = filename.toLocal8Bit();
21372137 _audio.importSongToMixWithMicrophone(filenameArray.data());
2138− _rawAudioMicrophoneMix->setText("Stop Mixing Song");
2138+ resetSongMixMenuItem();
21392139 } else {
21402140 _audio.stopMixingSongWithMicrophone();
2141− _rawAudioMicrophoneMix->setText("Mix RAW Song");
2141+ resetSongMixMenuItem();
21422142 }
21432143 }
21442144
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+}
21452153
21462154 void Application::updateFrustumRenderModeAction() {
21472155 switch (_frustumDrawingMode) {
@@ -2251,7 +2259,7 @@ Avatar* Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3 · 103 unmodified lines
22512259 if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) {
22522260 Avatar* avatar = (Avatar *) node->getLinkedData();
22532261 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())) {
22552263 eyePosition = avatar->getHead().getEyePosition();
22562264 _lookatIndicatorScale = avatar->getScale();
22572265 _lookatOtherPosition = headPosition;
@@ -2263,6 +2271,16 @@ Avatar* Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3 · 5 unmodified lines
22632271 return NULL;
22642272 }
22652273
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+
22662284 void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& whichCamera) {
22672285
22682286 const float DISTANCE_FROM_HEAD_SPHERE = 0.1f * _lookatIndicatorScale;
@@ -2954,6 +2972,23 @@ void Application::displaySide(Camera& whichCamera) { · 685 unmodified lines
29542972
29552973 //draw a grid ground plane....
29562974 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+
29572992 renderGroundPlaneGrid(EDGE_SIZE_GROUND_PLANE, _audio.getCollisionSoundMagnitude());
29582993 }
29592994 // Draw voxels
@@ -2995,6 +3030,9 @@ void Application::displaySide(Camera& whichCamera) { · 35 unmodified lines
29953030 if (!avatar->isInitialized()) {
29963031 avatar->init();
29973032 }
3033+ if (isLookingAtMyAvatar(avatar)) {
3034+ avatar->getHead().setLookAtPosition(_myCamera.getPosition());
3035+ }
29983036 avatar->render(false, _renderAvatarBalls->isChecked());
29993037 avatar->setDisplayingLookatVectors(_renderLookatOn->isChecked());
30003038 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t