Showing the changes to interface/src/Application.cpp (1 of 52 files). Show all
Unified · Split
| @@ -524,10 +524,22 @@ void Application::paintGL() { · 523 unmodified lines | ||
| 524 | 524 | |
| 525 | 525 | } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { |
| 526 | 526 | _myCamera.setTightness(0.0f); |
| 527 | − float headHeight = _myAvatar->getHead()->calculateAverageEyePosition().y - _myAvatar->getPosition().y; | |
| 527 | + glm::vec3 eyePosition = _myAvatar->getHead()->calculateAverageEyePosition(); | |
| 528 | + float headHeight = eyePosition.y - _myAvatar->getPosition().y; | |
| 528 | 529 | _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _myAvatar->getScale()); |
| 529 | 530 | _myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight, 0)); |
| 530 | 531 | _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI, 0.0f))); |
| 532 | + | |
| 533 | + // if the head would intersect the near clip plane, we must push the camera out | |
| 534 | + glm::vec3 relativePosition = glm::inverse(_myCamera.getTargetRotation()) * | |
| 535 | + (eyePosition - _myCamera.getTargetPosition()); | |
| 536 | + const float PUSHBACK_RADIUS = 0.2f; | |
| 537 | + float pushback = relativePosition.z + _myCamera.getNearClip() + | |
| 538 | + _myAvatar->getScale() * PUSHBACK_RADIUS - _myCamera.getDistance(); | |
| 539 | + if (pushback > 0.0f) { | |
| 540 | + _myCamera.setTargetPosition(_myCamera.getTargetPosition() + | |
| 541 | + _myCamera.getTargetRotation() * glm::vec3(0.0f, 0.0f, pushback)); | |
| 542 | + } | |
| 531 | 543 | } |
| 532 | 544 | |
| 533 | 545 | // Update camera position |
| @@ -2232,8 +2244,7 @@ void Application::updateShadowMap() { · 1698 unmodified lines | ||
| 2232 | 2244 | glRotatef(glm::degrees(glm::angle(inverseRotation)), axis.x, axis.y, axis.z); |
| 2233 | 2245 | |
| 2234 | 2246 | // store view matrix without translation, which we'll use for precision-sensitive objects |
| 2235 | − glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat*)&_untranslatedViewMatrix); | |
| 2236 | − _viewMatrixTranslation = glm::vec3(); | |
| 2247 | + updateUntranslatedViewMatrix(); | |
| 2237 | 2248 | |
| 2238 | 2249 | _avatarManager.renderAvatars(Avatar::SHADOW_RENDER_MODE); |
| 2239 | 2250 | _particles.render(); |
| @@ -2318,8 +2329,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 78 unmodified lines | ||
| 2318 | 2329 | glRotatef(-glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z); |
| 2319 | 2330 | |
| 2320 | 2331 | // store view matrix without translation, which we'll use for precision-sensitive objects |
| 2321 | − glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat*)&_untranslatedViewMatrix); | |
| 2322 | − _viewMatrixTranslation = -whichCamera.getPosition(); | |
| 2332 | + updateUntranslatedViewMatrix(-whichCamera.getPosition()); | |
| 2323 | 2333 | |
| 2324 | 2334 | glTranslatef(_viewMatrixTranslation.x, _viewMatrixTranslation.y, _viewMatrixTranslation.z); |
| 2325 | 2335 | |
| @@ -2450,6 +2460,11 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 124 unmodified lines | ||
| 2450 | 2460 | } |
| 2451 | 2461 | } |
| 2452 | 2462 | |
| 2463 | +void Application::updateUntranslatedViewMatrix(const glm::vec3& viewMatrixTranslation) { | |
| 2464 | + glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat*)&_untranslatedViewMatrix); | |
| 2465 | + _viewMatrixTranslation = viewMatrixTranslation; | |
| 2466 | +} | |
| 2467 | + | |
| 2453 | 2468 | void Application::loadTranslatedViewMatrix(const glm::vec3& translation) { |
| 2454 | 2469 | glLoadMatrixf((const GLfloat*)&_untranslatedViewMatrix); |
| 2455 | 2470 | glTranslatef(translation.x + _viewMatrixTranslation.x, translation.y + _viewMatrixTranslation.y, |
| @@ -3248,9 +3263,12 @@ void Application::toggleRunningScriptsWidget() · 792 unmodified lines | ||
| 3248 | 3263 | |
| 3249 | 3264 | void Application::uploadFST(bool isHead) { |
| 3250 | 3265 | ModelUploader* uploader = new ModelUploader(isHead); |
| 3251 | − if (uploader->zip()) { | |
| 3252 | − uploader->send(); | |
| 3253 | − } | |
| 3266 | + QThread* thread = new QThread(); | |
| 3267 | + thread->connect(uploader, SIGNAL(destroyed()), SLOT(quit())); | |
| 3268 | + thread->connect(thread, SIGNAL(finished()), SLOT(deleteLater())); | |
| 3269 | + uploader->connect(thread, SIGNAL(started()), SLOT(send())); | |
| 3270 | + | |
| 3271 | + thread->start(); | |
| 3254 | 3272 | } |
| 3255 | 3273 | |
| 3256 | 3274 | void Application::uploadHead() { |
| @@ -3277,6 +3295,7 @@ void Application::loadScript(const QString& scriptName) { · 20 unmodified lines | ||
| 3277 | 3295 | // we can use the same ones from the application. |
| 3278 | 3296 | scriptEngine->getVoxelsScriptingInterface()->setPacketSender(&_voxelEditSender); |
| 3279 | 3297 | scriptEngine->getVoxelsScriptingInterface()->setVoxelTree(_voxels.getTree()); |
| 3298 | + scriptEngine->getVoxelsScriptingInterface()->setUndoStack(&_undoStack); | |
| 3280 | 3299 | scriptEngine->getParticlesScriptingInterface()->setPacketSender(&_particleEditSender); |
| 3281 | 3300 | scriptEngine->getParticlesScriptingInterface()->setParticleTree(_particles.getTree()); |
| 3282 | 3301 | |