Showing the changes to interface/src/Application.cpp (1 of 108 files). Show all
Unified · Split
| @@ -241,6 +241,7 @@ bool setupEssentials(int& argc, char** argv) { · 240 unmodified lines | ||
| 241 | 241 | auto dialogsManager = DependencyManager::set<DialogsManager>(); |
| 242 | 242 | auto bandwidthRecorder = DependencyManager::set<BandwidthRecorder>(); |
| 243 | 243 | auto resouceCacheSharedItems = DependencyManager::set<ResouceCacheSharedItems>(); |
| 244 | + auto entityScriptingInterface = DependencyManager::set<EntityScriptingInterface>(); | |
| 244 | 245 | #if defined(Q_OS_MAC) || defined(Q_OS_WIN) |
| 245 | 246 | auto speechRecognizer = DependencyManager::set<SpeechRecognizer>(); |
| 246 | 247 | #endif |
| @@ -1141,6 +1142,10 @@ void Application::keyPressEvent(QKeyEvent* event) { · 894 unmodified lines | ||
| 1141 | 1142 | |
| 1142 | 1143 | break; |
| 1143 | 1144 | } |
| 1145 | + | |
| 1146 | + case Qt::Key_Comma: { | |
| 1147 | + _myAvatar->togglePhysicsEnabled(); | |
| 1148 | + } | |
| 1144 | 1149 | |
| 1145 | 1150 | default: |
| 1146 | 1151 | event->ignore(); |
| @@ -1766,10 +1771,14 @@ void Application::init() { · 619 unmodified lines | ||
| 1766 | 1771 | tree->setSimulation(&_physicsEngine); |
| 1767 | 1772 | _physicsEngine.init(&_entityEditSender); |
| 1768 | 1773 | |
| 1774 | + | |
| 1769 | 1775 | _physicsEngine.setAvatarData(_myAvatar); |
| 1770 | 1776 | |
| 1777 | + auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>(); | |
| 1778 | + | |
| 1779 | + | |
| 1771 | 1780 | connect(&_physicsEngine, &EntitySimulation::entityCollisionWithEntity, |
| 1772 | − ScriptEngine::getEntityScriptingInterface(), &EntityScriptingInterface::entityCollisionWithEntity); | |
| 1781 | + entityScriptingInterface.data(), &EntityScriptingInterface::entityCollisionWithEntity); | |
| 1773 | 1782 | |
| 1774 | 1783 | // connect the _entityCollisionSystem to our EntityTreeRenderer since that's what handles running entity scripts |
| 1775 | 1784 | connect(&_physicsEngine, &EntitySimulation::entityCollisionWithEntity, |
| @@ -1777,7 +1786,7 @@ void Application::init() { · 1 unmodified line | ||
| 1777 | 1786 | |
| 1778 | 1787 | // connect the _entities (EntityTreeRenderer) to our script engine's EntityScriptingInterface for firing |
| 1779 | 1788 | // of events related clicking, hovering over, and entering entities |
| 1780 | − _entities.connectSignalsToSlots(ScriptEngine::getEntityScriptingInterface()); | |
| 1789 | + _entities.connectSignalsToSlots(entityScriptingInterface.data()); | |
| 1781 | 1790 | |
| 1782 | 1791 | _entityClipboardRenderer.init(); |
| 1783 | 1792 | _entityClipboardRenderer.setViewFrustum(getViewFrustum()); |
| @@ -2047,7 +2056,6 @@ void Application::update(float deltaTime) { · 263 unmodified lines | ||
| 2047 | 2056 | } |
| 2048 | 2057 | SixenseManager::getInstance().update(deltaTime); |
| 2049 | 2058 | JoystickScriptingInterface::getInstance().update(); |
| 2050 | − _prioVR.update(deltaTime); | |
| 2051 | 2059 | } |
| 2052 | 2060 | |
| 2053 | 2061 | // Dispatch input events |
| @@ -2547,7 +2555,9 @@ void Application::updateShadowMap() { · 493 unmodified lines | ||
| 2547 | 2555 | glm::ortho(minima.x, maxima.x, minima.y, maxima.y, -maxima.z, -minima.z) * glm::mat4_cast(inverseRotation)); |
| 2548 | 2556 | |
| 2549 | 2557 | // update the shadow view frustum |
| 2550 | − _shadowViewFrustum.setPosition(rotation * ((minima + maxima) * 0.5f)); | |
| 2558 | + // glm::vec3 shadowFrustumCenter = glm::vec3((minima.x + maxima.x) * 0.5f, (minima.y + maxima.y) * 0.5f, (minima.z + maxima.z) * 0.5f); | |
| 2559 | + glm::vec3 shadowFrustumCenter = rotation * ((minima + maxima) * 0.5f); | |
| 2560 | + _shadowViewFrustum.setPosition(shadowFrustumCenter); | |
| 2551 | 2561 | _shadowViewFrustum.setOrientation(rotation); |
| 2552 | 2562 | _shadowViewFrustum.setOrthographic(true); |
| 2553 | 2563 | _shadowViewFrustum.setWidth(maxima.x - minima.x); |
| @@ -2577,8 +2587,10 @@ void Application::updateShadowMap() { · 23 unmodified lines | ||
| 2577 | 2587 | // this is what is used for rendering the Entities and avatars |
| 2578 | 2588 | Transform viewTransform; |
| 2579 | 2589 | viewTransform.setRotation(rotation); |
| 2590 | + // viewTransform.postTranslate(shadowFrustumCenter); | |
| 2580 | 2591 | setViewTransform(viewTransform); |
| 2581 | 2592 | |
| 2593 | + | |
| 2582 | 2594 | glEnable(GL_POLYGON_OFFSET_FILL); |
| 2583 | 2595 | glPolygonOffset(1.1f, 4.0f); // magic numbers courtesy http://www.eecs.berkeley.edu/~ravir/6160/papers/shadowmaps.ppt |
| 2584 | 2596 | |
| @@ -3109,7 +3121,6 @@ void Application::resetSensors() { · 524 unmodified lines | ||
| 3109 | 3121 | |
| 3110 | 3122 | OculusManager::reset(); |
| 3111 | 3123 | |
| 3112 | − _prioVR.reset(); | |
| 3113 | 3124 | //_leapmotion.reset(); |
| 3114 | 3125 | |
| 3115 | 3126 | QScreen* currentScreen = _window->windowHandle()->screen(); |
| @@ -3443,8 +3454,9 @@ void joystickFromScriptValue(const QScriptValue &object, Joystick* &out) { · 327 unmodified lines | ||
| 3443 | 3454 | void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scriptEngine) { |
| 3444 | 3455 | // setup the packet senders and jurisdiction listeners of the script engine's scripting interfaces so |
| 3445 | 3456 | // we can use the same ones from the application. |
| 3446 | − scriptEngine->getEntityScriptingInterface()->setPacketSender(&_entityEditSender); | |
| 3447 | − scriptEngine->getEntityScriptingInterface()->setEntityTree(_entities.getTree()); | |
| 3457 | + auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>(); | |
| 3458 | + entityScriptingInterface->setPacketSender(&_entityEditSender); | |
| 3459 | + entityScriptingInterface->setEntityTree(_entities.getTree()); | |
| 3448 | 3460 | |
| 3449 | 3461 | // AvatarManager has some custom types |
| 3450 | 3462 | AvatarManager::registerMetaTypes(scriptEngine); |