Showing the changes to interface/src/Application.cpp (1 of 29 files). Show all
Unified · Split
| @@ -256,7 +256,8 @@ bool setupEssentials(int& argc, char** argv) { · 255 unmodified lines | ||
| 256 | 256 | auto speechRecognizer = DependencyManager::set<SpeechRecognizer>(); |
| 257 | 257 | #endif |
| 258 | 258 | auto discoverabilityManager = DependencyManager::set<DiscoverabilityManager>(); |
| 259 | − | |
| 259 | + auto sceneScriptingInterface = DependencyManager::set<SceneScriptingInterface>(); | |
| 260 | + | |
| 260 | 261 | return true; |
| 261 | 262 | } |
| 262 | 263 | |
| @@ -566,6 +567,9 @@ void Application::aboutToQuit() { · 303 unmodified lines | ||
| 566 | 567 | } |
| 567 | 568 | |
| 568 | 569 | void Application::cleanupBeforeQuit() { |
| 570 | + | |
| 571 | + _entities.clear(); // this will allow entity scripts to properly shutdown | |
| 572 | + | |
| 569 | 573 | _datagramProcessor->shutdown(); // tell the datagram processor we're shutting down, so it can short circuit |
| 570 | 574 | _entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts |
| 571 | 575 | ScriptEngine::stopAllScripts(this); // stop all currently running global scripts |
| @@ -773,10 +777,6 @@ void Application::paintGL() { · 201 unmodified lines | ||
| 773 | 777 | } |
| 774 | 778 | |
| 775 | 779 | if (OculusManager::isConnected()) { |
| 776 | − //Clear the color buffer to ensure that there isnt any residual color | |
| 777 | − //Left over from when OR was not connected. | |
| 778 | − glClear(GL_COLOR_BUFFER_BIT); | |
| 779 | − | |
| 780 | 780 | //When in mirror mode, use camera rotation. Otherwise, use body rotation |
| 781 | 781 | if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { |
| 782 | 782 | OculusManager::display(_myCamera.getRotation(), _myCamera.getPosition(), _myCamera); |
| @@ -2257,7 +2257,7 @@ void Application::update(float deltaTime) { · 1474 unmodified lines | ||
| 2257 | 2257 | if (queryIsDue || viewIsDifferentEnough) { |
| 2258 | 2258 | _lastQueriedTime = now; |
| 2259 | 2259 | |
| 2260 | − if (Menu::getInstance()->isOptionChecked(MenuOption::Entities)) { | |
| 2260 | + if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) { | |
| 2261 | 2261 | queryOctree(NodeType::EntityServer, PacketTypeEntityQuery, _entityServerJurisdictions); |
| 2262 | 2262 | } |
| 2263 | 2263 | _lastQueriedViewFrustum = _viewFrustum; |
| @@ -2763,7 +2763,7 @@ void Application::updateShadowMap() { · 499 unmodified lines | ||
| 2763 | 2763 | |
| 2764 | 2764 | const GLfloat WORLD_AMBIENT_COLOR[] = { 0.525f, 0.525f, 0.6f }; |
| 2765 | 2765 | const GLfloat WORLD_DIFFUSE_COLOR[] = { 0.6f, 0.525f, 0.525f }; |
| 2766 | −const GLfloat WORLD_SPECULAR_COLOR[] = { 0.94f, 0.94f, 0.737f, 1.0f }; | |
| 2766 | +const GLfloat WORLD_SPECULAR_COLOR[] = { 0.08f, 0.08f, 0.08f, 1.0f }; | |
| 2767 | 2767 | |
| 2768 | 2768 | const glm::vec3 GLOBAL_LIGHT_COLOR = { 0.6f, 0.525f, 0.525f }; |
| 2769 | 2769 | |
| @@ -2970,7 +2970,7 @@ void Application::displaySide(Camera& theCamera, bool selfAvatarOnly, RenderArgs · 200 unmodified lines | ||
| 2970 | 2970 | DependencyManager::get<GeometryCache>()->renderSphere(originSphereRadius, 15, 15, glm::vec4(1.0f, 0.0f, 0.0f, 1.0f)); |
| 2971 | 2971 | |
| 2972 | 2972 | // render models... |
| 2973 | − if (Menu::getInstance()->isOptionChecked(MenuOption::Entities)) { | |
| 2973 | + if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) { | |
| 2974 | 2974 | PerformanceTimer perfTimer("entities"); |
| 2975 | 2975 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2976 | 2976 | "Application::displaySide() ... entities..."); |
| @@ -2991,17 +2991,15 @@ void Application::displaySide(Camera& theCamera, bool selfAvatarOnly, RenderArgs · 14 unmodified lines | ||
| 2991 | 2991 | DependencyManager::get<AmbientOcclusionEffect>()->render(); |
| 2992 | 2992 | } |
| 2993 | 2993 | } |
| 2994 | − | |
| 2995 | − | |
| 2996 | − | |
| 2994 | + | |
| 2997 | 2995 | bool mirrorMode = (theCamera.getMode() == CAMERA_MODE_MIRROR); |
| 2996 | + | |
| 2998 | 2997 | { |
| 2999 | 2998 | PerformanceTimer perfTimer("avatars"); |
| 3000 | 2999 | DependencyManager::get<AvatarManager>()->renderAvatars(mirrorMode ? Avatar::MIRROR_RENDER_MODE : Avatar::NORMAL_RENDER_MODE, |
| 3001 | − false, selfAvatarOnly); | |
| 3000 | + false, selfAvatarOnly); | |
| 3002 | 3001 | } |
| 3003 | 3002 | |
| 3004 | − | |
| 3005 | 3003 | { |
| 3006 | 3004 | DependencyManager::get<DeferredLightingEffect>()->setAmbientLightMode(getRenderAmbientLight()); |
| 3007 | 3005 | auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage(); |
| @@ -3584,6 +3582,8 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 576 unmodified lines | ||
| 3584 | 3582 | scriptEngine->registerFunction(hmdInterface, "getHUDLookAtPosition2D", HMDScriptingInterface::getHUDLookAtPosition2D, 0); |
| 3585 | 3583 | scriptEngine->registerFunction(hmdInterface, "getHUDLookAtPosition3D", HMDScriptingInterface::getHUDLookAtPosition3D, 0); |
| 3586 | 3584 | |
| 3585 | + scriptEngine->registerGlobalObject("Scene", DependencyManager::get<SceneScriptingInterface>().data()); | |
| 3586 | + | |
| 3587 | 3587 | #ifdef HAVE_RTMIDI |
| 3588 | 3588 | scriptEngine->registerGlobalObject("MIDI", &MIDIManager::getInstance()); |
| 3589 | 3589 | #endif |