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
583583 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
584584 PerformanceWarning warn(showWarnings, "Application::paintGL()");
585585
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+
586596 glEnable(GL_LINE_SMOOTH);
587597
588598 if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
@@ -591,28 +601,16 @@ void Application::paintGL() { · 2 unmodified lines
591601 _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation());
592602
593603 } 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.
594605 _myCamera.setTightness(0.0f); // Camera is directly connected to head without smoothing
595606 _myCamera.setTargetPosition(_myAvatar->getUprightHeadPosition());
596− _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation());
607+ _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation());
597608
598609 } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
599610 _myCamera.setTightness(0.0f);
600− glm::vec3 eyePosition = _myAvatar->getHead()->calculateAverageEyePosition();
601− float headHeight = eyePosition.y - _myAvatar->getPosition().y;
602611 _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _scaleMirror);
603− _myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight + (_raiseMirror * _myAvatar->getScale()), 0));
604612 _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
605− }
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
613+ _myCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition());
616614 }
617615
618616 // Update camera position
@@ -647,16 +645,32 @@ void Application::paintGL() { · 28 unmodified lines
647645 updateShadowMap();
648646 }
649647
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+
650653 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+ }
652660
653661 } else if (TV3DManager::isConnected()) {
654− _glowEffect.prepare();
662+ if (glowEnabled) {
663+ _glowEffect.prepare();
664+ }
655665 TV3DManager::display(whichCamera);
656− _glowEffect.render();
666+ if (glowEnabled) {
667+ _glowEffect.render();
668+ }
657669
658670 } else {
659− _glowEffect.prepare();
671+ if (glowEnabled) {
672+ _glowEffect.prepare();
673+ }
660674
661675 glMatrixMode(GL_MODELVIEW);
662676 glPushMatrix();
@@ -664,7 +678,9 @@ void Application::paintGL() { · 1 unmodified line
664678 displaySide(whichCamera);
665679 glPopMatrix();
666680
667− _glowEffect.render();
681+ if (glowEnabled) {
682+ _glowEffect.render();
683+ }
668684
669685 if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {
670686 renderRearViewMirror(_mirrorViewRect);
@@ -2184,7 +2200,8 @@ int Application::sendNackPackets() { · 1513 unmodified lines
21842200 OctreeSceneStats& stats = _octreeServerSceneStats[nodeUUID];
21852201
21862202 // 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();
21882205
21892206 _octreeSceneStatsLock.unlock();
21902207
@@ -3154,9 +3171,7 @@ void Application::resetSensors() { · 963 unmodified lines
31543171 _faceshift.reset();
31553172 _visage.reset();
31563173
3157− if (OculusManager::isConnected()) {
3158− OculusManager::reset();
3159− }
3174+ OculusManager::reset();
31603175
31613176 _prioVR.reset();
31623177
@@ -3308,6 +3323,10 @@ void Application::nodeKilled(SharedNodePointer node) { · 145 unmodified lines
33083323 _particleEditSender.nodeKilled(node);
33093324 _modelEditSender.nodeKilled(node);
33103325
3326+ if (node->getType() == NodeType::AudioMixer) {
3327+ QMetaObject::invokeMethod(&_audio, "resetIncomingMixedAudioSequenceNumberStats");
3328+ }
3329+
33113330 if (node->getType() == NodeType::VoxelServer) {
33123331 QUuid nodeUUID = node->getUUID();
33133332 // 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
36323651 // when the application is about to quit, stop our script engine so it unwinds properly
36333652 connect(this, SIGNAL(aboutToQuit()), scriptEngine, SLOT(stop()));
36343653
3654+ NodeList* nodeList = NodeList::getInstance();
3655+ connect(nodeList, &NodeList::nodeKilled, scriptEngine, &ScriptEngine::nodeKilled);
3656+
36353657 scriptEngine->moveToThread(workerThread);
36363658
36373659 // 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