History

merge upstream/master into andrew/scripting

Andrew Meadows committed 12 years ago

Commit 229d6ce2 parents b8232b5 dc8902652 files · +1399 −352Browse files

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

Unified · Split

interface/src/Application.cpp+27−8
@@ -524,10 +524,22 @@ void Application::paintGL() { · 523 unmodified lines
524524
525525 } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
526526 _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;
528529 _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _myAvatar->getScale());
529530 _myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight, 0));
530531 _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+ }
531543 }
532544
533545 // Update camera position
@@ -2232,8 +2244,7 @@ void Application::updateShadowMap() { · 1698 unmodified lines
22322244 glRotatef(glm::degrees(glm::angle(inverseRotation)), axis.x, axis.y, axis.z);
22332245
22342246 // 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();
22372248
22382249 _avatarManager.renderAvatars(Avatar::SHADOW_RENDER_MODE);
22392250 _particles.render();
@@ -2318,8 +2329,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 78 unmodified lines
23182329 glRotatef(-glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
23192330
23202331 // 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());
23232333
23242334 glTranslatef(_viewMatrixTranslation.x, _viewMatrixTranslation.y, _viewMatrixTranslation.z);
23252335
@@ -2450,6 +2460,11 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 124 unmodified lines
24502460 }
24512461 }
24522462
2463+void Application::updateUntranslatedViewMatrix(const glm::vec3& viewMatrixTranslation) {
2464+ glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat*)&_untranslatedViewMatrix);
2465+ _viewMatrixTranslation = viewMatrixTranslation;
2466+}
2467+
24532468 void Application::loadTranslatedViewMatrix(const glm::vec3& translation) {
24542469 glLoadMatrixf((const GLfloat*)&_untranslatedViewMatrix);
24552470 glTranslatef(translation.x + _viewMatrixTranslation.x, translation.y + _viewMatrixTranslation.y,
@@ -3248,9 +3263,12 @@ void Application::toggleRunningScriptsWidget() · 792 unmodified lines
32483263
32493264 void Application::uploadFST(bool isHead) {
32503265 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();
32543272 }
32553273
32563274 void Application::uploadHead() {
@@ -3277,6 +3295,7 @@ void Application::loadScript(const QString& scriptName) { · 20 unmodified lines
32773295 // we can use the same ones from the application.
32783296 scriptEngine->getVoxelsScriptingInterface()->setPacketSender(&_voxelEditSender);
32793297 scriptEngine->getVoxelsScriptingInterface()->setVoxelTree(_voxels.getTree());
3298+ scriptEngine->getVoxelsScriptingInterface()->setUndoStack(&_undoStack);
32803299 scriptEngine->getParticlesScriptingInterface()->setPacketSender(&_particleEditSender);
32813300 scriptEngine->getParticlesScriptingInterface()->setParticleTree(_particles.getTree());
32823301

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