History

Merge branch 'master' of https://github.com/highfidelity/hifi into add_interface_to_log_user_activity

Atlante45 committed 12 years ago

Commit 958367f2 parents 2015861 df51d2667 files · +2595 −1005Browse files

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

Unified · Split

interface/src/Application.cpp+46−24
@@ -583,6 +583,16 @@ void Application::paintGL() { · 582 unmodified lines
583 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);583 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
584 PerformanceWarning warn(showWarnings, "Application::paintGL()");584 PerformanceWarning warn(showWarnings, "Application::paintGL()");
585 585
586 const bool glowEnabled = Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect);
587
588 // Set the desired FBO texture size. If it hasn't changed, this does nothing.
589 // Otherwise, it must rebuild the FBOs
590 if (OculusManager::isConnected()) {
591 _textureCache.setFrameBufferSize(OculusManager::getRenderTargetSize());
592 } else {
593 _textureCache.setFrameBufferSize(_glWidget->size());
594 }
595
586 glEnable(GL_LINE_SMOOTH);596 glEnable(GL_LINE_SMOOTH);
587 597
588 if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {598 if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
@@ -591,28 +601,16 @@ void Application::paintGL() { · 2 unmodified lines
591 _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation());601 _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation());
592 602
593 } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {603 } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
604 //Note, the camera distance is set in Camera::setMode() so we dont have to do it here.
594 _myCamera.setTightness(0.0f); // Camera is directly connected to head without smoothing605 _myCamera.setTightness(0.0f); // Camera is directly connected to head without smoothing
595 _myCamera.setTargetPosition(_myAvatar->getUprightHeadPosition());606 _myCamera.setTargetPosition(_myAvatar->getUprightHeadPosition());
596 _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation());607 _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation());
597 608
598 } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {609 } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
599 _myCamera.setTightness(0.0f);610 _myCamera.setTightness(0.0f);
600 glm::vec3 eyePosition = _myAvatar->getHead()->calculateAverageEyePosition();
601 float headHeight = eyePosition.y - _myAvatar->getPosition().y;
602 _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _scaleMirror);611 _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _scaleMirror);
603 _myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight + (_raiseMirror * _myAvatar->getScale()), 0));
604 _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));612 _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
605 }613 _myCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition());
606
607 if (OculusManager::isConnected()) {
608 // Oculus in third person causes nausea, so only allow it if option is checked in dev menu
609 if (!Menu::getInstance()->isOptionChecked(MenuOption::AllowOculusCameraModeChange) || _myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
610 _myCamera.setDistance(0.0f);
611 _myCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition());
612 _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation());
613 }
614 _myCamera.setUpShift(0.0f);
615 _myCamera.setTightness(0.0f); // Camera is directly connected to head without smoothing
616 }614 }
617 615
618 // Update camera position616 // Update camera position
@@ -647,16 +645,32 @@ void Application::paintGL() { · 28 unmodified lines
647 updateShadowMap();645 updateShadowMap();
648 }646 }
649 647
648 //If we aren't using the glow shader, we have to clear the color and depth buffer
649 if (!glowEnabled) {
650 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
651 }
652
650 if (OculusManager::isConnected()) {653 if (OculusManager::isConnected()) {
651 OculusManager::display(whichCamera);654 //When in mirror mode, use camera rotation. Otherwise, use body rotation
655 if (whichCamera.getMode() == CAMERA_MODE_MIRROR) {
656 OculusManager::display(whichCamera.getRotation(), whichCamera.getPosition(), whichCamera);
657 } else {
658 OculusManager::display(_myAvatar->getWorldAlignedOrientation(), whichCamera.getPosition(), whichCamera);
659 }
652 660
653 } else if (TV3DManager::isConnected()) {661 } else if (TV3DManager::isConnected()) {
654 _glowEffect.prepare();662 if (glowEnabled) {
663 _glowEffect.prepare();
664 }
655 TV3DManager::display(whichCamera);665 TV3DManager::display(whichCamera);
656 _glowEffect.render();666 if (glowEnabled) {
667 _glowEffect.render();
668 }
657 669
658 } else {670 } else {
659 _glowEffect.prepare();671 if (glowEnabled) {
672 _glowEffect.prepare();
673 }
660 674
661 glMatrixMode(GL_MODELVIEW);675 glMatrixMode(GL_MODELVIEW);
662 glPushMatrix();676 glPushMatrix();
@@ -664,7 +678,9 @@ void Application::paintGL() { · 1 unmodified line
664 displaySide(whichCamera);678 displaySide(whichCamera);
665 glPopMatrix();679 glPopMatrix();
666 680
667 _glowEffect.render();681 if (glowEnabled) {
682 _glowEffect.render();
683 }
668 684
669 if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {685 if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {
670 renderRearViewMirror(_mirrorViewRect);686 renderRearViewMirror(_mirrorViewRect);
@@ -2184,7 +2200,8 @@ int Application::sendNackPackets() { · 1513 unmodified lines
2184 OctreeSceneStats& stats = _octreeServerSceneStats[nodeUUID];2200 OctreeSceneStats& stats = _octreeServerSceneStats[nodeUUID];
2185 2201
2186 // make copy of missing sequence numbers from stats2202 // make copy of missing sequence numbers from stats
2187 const QSet<OCTREE_PACKET_SEQUENCE> missingSequenceNumbers = stats.getMissingSequenceNumbers();2203 const QSet<OCTREE_PACKET_SEQUENCE> missingSequenceNumbers =
2204 stats.getIncomingOctreeSequenceNumberStats().getMissingSet();
2188 2205
2189 _octreeSceneStatsLock.unlock();2206 _octreeSceneStatsLock.unlock();
2190 2207
@@ -3154,9 +3171,7 @@ void Application::resetSensors() { · 963 unmodified lines
3154 _faceshift.reset();3171 _faceshift.reset();
3155 _visage.reset();3172 _visage.reset();
3156 3173
3157 if (OculusManager::isConnected()) {3174 OculusManager::reset();
3158 OculusManager::reset();
3159 }
3160 3175
3161 _prioVR.reset();3176 _prioVR.reset();
3162 3177
@@ -3308,6 +3323,10 @@ void Application::nodeKilled(SharedNodePointer node) { · 145 unmodified lines
3308 _particleEditSender.nodeKilled(node);3323 _particleEditSender.nodeKilled(node);
3309 _modelEditSender.nodeKilled(node);3324 _modelEditSender.nodeKilled(node);
3310 3325
3326 if (node->getType() == NodeType::AudioMixer) {
3327 QMetaObject::invokeMethod(&_audio, "resetIncomingMixedAudioSequenceNumberStats");
3328 }
3329
3311 if (node->getType() == NodeType::VoxelServer) {3330 if (node->getType() == NodeType::VoxelServer) {
3312 QUuid nodeUUID = node->getUUID();3331 QUuid nodeUUID = node->getUUID();
3313 // see if this is the first we've heard of this node...3332 // see if this is the first we've heard of this node...
@@ -3632,6 +3651,9 @@ ScriptEngine* Application::loadScript(const QString& scriptName, bool loadScript · 318 unmodified lines
3632 // when the application is about to quit, stop our script engine so it unwinds properly3651 // when the application is about to quit, stop our script engine so it unwinds properly
3633 connect(this, SIGNAL(aboutToQuit()), scriptEngine, SLOT(stop()));3652 connect(this, SIGNAL(aboutToQuit()), scriptEngine, SLOT(stop()));
3634 3653
3654 NodeList* nodeList = NodeList::getInstance();
3655 connect(nodeList, &NodeList::nodeKilled, scriptEngine, &ScriptEngine::nodeKilled);
3656
3635 scriptEngine->moveToThread(workerThread);3657 scriptEngine->moveToThread(workerThread);
3636 3658
3637 // Starts an event loop, and emits workerThread->started()3659 // Starts an event loop, and emits workerThread->started()

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