Showing the changes to interface/src/Application.cpp (1 of 62 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 |
| @@ -1572,14 +1584,14 @@ void Application::init() { · 1038 unmodified lines | ||
| 1572 | 1584 | |
| 1573 | 1585 | // connect the _particleCollisionSystem to our script engine's ParticleScriptingInterface |
| 1574 | 1586 | connect(&_particleCollisionSystem, |
| 1575 | − SIGNAL(particleCollisionWithVoxel(const ParticleID&, const VoxelDetail&, const glm::vec3&)), | |
| 1587 | + SIGNAL(particleCollisionWithVoxel(const ParticleID&, const VoxelDetail&, const CollisionInfo&)), | |
| 1576 | 1588 | ScriptEngine::getParticlesScriptingInterface(), |
| 1577 | − SLOT(forwardParticleCollisionWithVoxel(const ParticleID&, const VoxelDetail&, const glm::vec3&))); | |
| 1589 | + SIGNAL(particleCollisionWithVoxels(const ParticleID&, const VoxelDetail&, const CollisionInfo&))); | |
| 1578 | 1590 | |
| 1579 | 1591 | connect(&_particleCollisionSystem, |
| 1580 | − SIGNAL(particleCollisionWithParticle(const ParticleID&, const ParticleID&, const glm::vec3&)), | |
| 1592 | + SIGNAL(particleCollisionWithParticle(const ParticleID&, const ParticleID&, const CollisionInfo&)), | |
| 1581 | 1593 | ScriptEngine::getParticlesScriptingInterface(), |
| 1582 | − SLOT(forwardParticleCollisionWithParticle(const ParticleID&, const ParticleID&, const glm::vec3&))); | |
| 1594 | + SIGNAL(particleCollisionWithParticle(const ParticleID&, const ParticleID&, const CollisionInfo&))); | |
| 1583 | 1595 | |
| 1584 | 1596 | _audio.init(_glWidget); |
| 1585 | 1597 | |
| @@ -2229,8 +2241,7 @@ void Application::updateShadowMap() { · 643 unmodified lines | ||
| 2229 | 2241 | glRotatef(glm::degrees(glm::angle(inverseRotation)), axis.x, axis.y, axis.z); |
| 2230 | 2242 | |
| 2231 | 2243 | // store view matrix without translation, which we'll use for precision-sensitive objects |
| 2232 | − glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat*)&_untranslatedViewMatrix); | |
| 2233 | − _viewMatrixTranslation = glm::vec3(); | |
| 2244 | + updateUntranslatedViewMatrix(); | |
| 2234 | 2245 | |
| 2235 | 2246 | _avatarManager.renderAvatars(Avatar::SHADOW_RENDER_MODE); |
| 2236 | 2247 | _particles.render(); |
| @@ -2315,8 +2326,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 78 unmodified lines | ||
| 2315 | 2326 | glRotatef(-glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z); |
| 2316 | 2327 | |
| 2317 | 2328 | // store view matrix without translation, which we'll use for precision-sensitive objects |
| 2318 | − glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat*)&_untranslatedViewMatrix); | |
| 2319 | − _viewMatrixTranslation = -whichCamera.getPosition(); | |
| 2329 | + updateUntranslatedViewMatrix(-whichCamera.getPosition()); | |
| 2320 | 2330 | |
| 2321 | 2331 | glTranslatef(_viewMatrixTranslation.x, _viewMatrixTranslation.y, _viewMatrixTranslation.z); |
| 2322 | 2332 | |
| @@ -2447,6 +2457,11 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 124 unmodified lines | ||
| 2447 | 2457 | } |
| 2448 | 2458 | } |
| 2449 | 2459 | |
| 2460 | +void Application::updateUntranslatedViewMatrix(const glm::vec3& viewMatrixTranslation) { | |
| 2461 | + glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat*)&_untranslatedViewMatrix); | |
| 2462 | + _viewMatrixTranslation = viewMatrixTranslation; | |
| 2463 | +} | |
| 2464 | + | |
| 2450 | 2465 | void Application::loadTranslatedViewMatrix(const glm::vec3& translation) { |
| 2451 | 2466 | glLoadMatrixf((const GLfloat*)&_untranslatedViewMatrix); |
| 2452 | 2467 | glTranslatef(translation.x + _viewMatrixTranslation.x, translation.y + _viewMatrixTranslation.y, |
| @@ -3254,9 +3269,12 @@ void Application::toggleRunningScriptsWidget() · 801 unmodified lines | ||
| 3254 | 3269 | |
| 3255 | 3270 | void Application::uploadFST(bool isHead) { |
| 3256 | 3271 | ModelUploader* uploader = new ModelUploader(isHead); |
| 3257 | − if (uploader->zip()) { | |
| 3258 | − uploader->send(); | |
| 3259 | − } | |
| 3272 | + QThread* thread = new QThread(); | |
| 3273 | + thread->connect(uploader, SIGNAL(destroyed()), SLOT(quit())); | |
| 3274 | + thread->connect(thread, SIGNAL(finished()), SLOT(deleteLater())); | |
| 3275 | + uploader->connect(thread, SIGNAL(started()), SLOT(send())); | |
| 3276 | + | |
| 3277 | + thread->start(); | |
| 3260 | 3278 | } |
| 3261 | 3279 | |
| 3262 | 3280 | void Application::uploadHead() { |
| @@ -3283,6 +3301,7 @@ void Application::loadScript(const QString& scriptName) { · 20 unmodified lines | ||
| 3283 | 3301 | // we can use the same ones from the application. |
| 3284 | 3302 | scriptEngine->getVoxelsScriptingInterface()->setPacketSender(&_voxelEditSender); |
| 3285 | 3303 | scriptEngine->getVoxelsScriptingInterface()->setVoxelTree(_voxels.getTree()); |
| 3304 | + scriptEngine->getVoxelsScriptingInterface()->setUndoStack(&_undoStack); | |
| 3286 | 3305 | scriptEngine->getParticlesScriptingInterface()->setPacketSender(&_particleEditSender); |
| 3287 | 3306 | scriptEngine->getParticlesScriptingInterface()->setParticleTree(_particles.getTree()); |
| 3288 | 3307 | |