Showing the changes to interface/src/Application.cpp (1 of 81 files). Show all
Unified · Split
| @@ -695,8 +695,6 @@ void Application::paintGL() { · 694 unmodified lines | |||
| 695 | displaySide(whichCamera); | 695 | displaySide(whichCamera); |
| 696 | glPopMatrix(); | 696 | glPopMatrix(); |
| 697 | 697 | ||
| 698 | _glowEffect.render(); | ||
| 699 | |||
| 700 | if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { | 698 | if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { |
| 701 | renderRearViewMirror(_mirrorViewRect); | 699 | renderRearViewMirror(_mirrorViewRect); |
| 702 | 700 | ||
| @@ -704,6 +702,8 @@ void Application::paintGL() { · 1 unmodified line | |||
| 704 | _rearMirrorTools->render(true); | 702 | _rearMirrorTools->render(true); |
| 705 | } | 703 | } |
| 706 | 704 | ||
| 705 | _glowEffect.render(); | ||
| 706 | |||
| 707 | { | 707 | { |
| 708 | PerformanceTimer perfTimer("renderOverlay"); | 708 | PerformanceTimer perfTimer("renderOverlay"); |
| 709 | // PrioVR will only work if renderOverlay is called, calibration is connected to Application::renderingOverlay() | 709 | // PrioVR will only work if renderOverlay is called, calibration is connected to Application::renderingOverlay() |
| @@ -1751,6 +1751,7 @@ void Application::init() { · 1041 unmodified lines | |||
| 1751 | 1751 | ||
| 1752 | _environment.init(); | 1752 | _environment.init(); |
| 1753 | 1753 | ||
| 1754 | _deferredLightingEffect.init(); | ||
| 1754 | _glowEffect.init(); | 1755 | _glowEffect.init(); |
| 1755 | _ambientOcclusionEffect.init(); | 1756 | _ambientOcclusionEffect.init(); |
| 1756 | _voxelShader.init(); | 1757 | _voxelShader.init(); |
| @@ -2706,7 +2707,6 @@ void Application::updateShadowMap() { · 949 unmodified lines | |||
| 2706 | const GLfloat WORLD_AMBIENT_COLOR[] = { 0.525f, 0.525f, 0.6f }; | 2707 | const GLfloat WORLD_AMBIENT_COLOR[] = { 0.525f, 0.525f, 0.6f }; |
| 2707 | const GLfloat WORLD_DIFFUSE_COLOR[] = { 0.6f, 0.525f, 0.525f }; | 2708 | const GLfloat WORLD_DIFFUSE_COLOR[] = { 0.6f, 0.525f, 0.525f }; |
| 2708 | const GLfloat WORLD_SPECULAR_COLOR[] = { 0.94f, 0.94f, 0.737f, 1.0f }; | 2709 | const GLfloat WORLD_SPECULAR_COLOR[] = { 0.94f, 0.94f, 0.737f, 1.0f }; |
| 2709 | const GLfloat NO_SPECULAR_COLOR[] = { 0.0f, 0.0f, 0.0f, 1.0f }; | ||
| 2710 | 2710 | ||
| 2711 | void Application::setupWorldLight() { | 2711 | void Application::setupWorldLight() { |
| 2712 | 2712 | ||
| @@ -2727,7 +2727,8 @@ void Application::setupWorldLight() { · 14 unmodified lines | |||
| 2727 | QImage Application::renderAvatarBillboard() { | 2727 | QImage Application::renderAvatarBillboard() { |
| 2728 | _textureCache.getPrimaryFramebufferObject()->bind(); | 2728 | _textureCache.getPrimaryFramebufferObject()->bind(); |
| 2729 | 2729 | ||
| 2730 | glDisable(GL_BLEND); | 2730 | // the "glow" here causes an alpha of one |
| 2731 | Glower glower; | ||
| 2731 | 2732 | ||
| 2732 | const int BILLBOARD_SIZE = 64; | 2733 | const int BILLBOARD_SIZE = 64; |
| 2733 | renderRearViewMirror(QRect(0, _glWidget->getDeviceHeight() - BILLBOARD_SIZE, BILLBOARD_SIZE, BILLBOARD_SIZE), true); | 2734 | renderRearViewMirror(QRect(0, _glWidget->getDeviceHeight() - BILLBOARD_SIZE, BILLBOARD_SIZE, BILLBOARD_SIZE), true); |
| @@ -2735,8 +2736,6 @@ QImage Application::renderAvatarBillboard() { · 1 unmodified line | |||
| 2735 | QImage image(BILLBOARD_SIZE, BILLBOARD_SIZE, QImage::Format_ARGB32); | 2736 | QImage image(BILLBOARD_SIZE, BILLBOARD_SIZE, QImage::Format_ARGB32); |
| 2736 | glReadPixels(0, 0, BILLBOARD_SIZE, BILLBOARD_SIZE, GL_BGRA, GL_UNSIGNED_BYTE, image.bits()); | 2737 | glReadPixels(0, 0, BILLBOARD_SIZE, BILLBOARD_SIZE, GL_BGRA, GL_UNSIGNED_BYTE, image.bits()); |
| 2737 | 2738 | ||
| 2738 | glEnable(GL_BLEND); | ||
| 2739 | |||
| 2740 | _textureCache.getPrimaryFramebufferObject()->release(); | 2739 | _textureCache.getPrimaryFramebufferObject()->release(); |
| 2741 | 2740 | ||
| 2742 | return image; | 2741 | return image; |
| @@ -2840,6 +2839,8 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 97 unmodified lines | |||
| 2840 | glEnable(GL_LIGHTING); | 2839 | glEnable(GL_LIGHTING); |
| 2841 | glEnable(GL_DEPTH_TEST); | 2840 | glEnable(GL_DEPTH_TEST); |
| 2842 | 2841 | ||
| 2842 | _deferredLightingEffect.prepare(); | ||
| 2843 | |||
| 2843 | if (!selfAvatarOnly) { | 2844 | if (!selfAvatarOnly) { |
| 2844 | // draw a red sphere | 2845 | // draw a red sphere |
| 2845 | float originSphereRadius = 0.05f; | 2846 | float originSphereRadius = 0.05f; |
| @@ -2848,15 +2849,19 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 2 unmodified lines | |||
| 2848 | glutSolidSphere(originSphereRadius, 15, 15); | 2849 | glutSolidSphere(originSphereRadius, 15, 15); |
| 2849 | glPopMatrix(); | 2850 | glPopMatrix(); |
| 2850 | 2851 | ||
| 2851 | // disable specular lighting for ground and voxels | ||
| 2852 | glMaterialfv(GL_FRONT, GL_SPECULAR, NO_SPECULAR_COLOR); | ||
| 2853 | |||
| 2854 | // draw the audio reflector overlay | 2852 | // draw the audio reflector overlay |
| 2855 | { | 2853 | { |
| 2856 | PerformanceTimer perfTimer("audio"); | 2854 | PerformanceTimer perfTimer("audio"); |
| 2857 | _audioReflector.render(); | 2855 | _audioReflector.render(); |
| 2858 | } | 2856 | } |
| 2859 | 2857 | ||
| 2858 | if (Menu::getInstance()->isOptionChecked(MenuOption::BuckyBalls)) { | ||
| 2859 | PerformanceTimer perfTimer("buckyBalls"); | ||
| 2860 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | ||
| 2861 | "Application::displaySide() ... bucky balls..."); | ||
| 2862 | _buckyBalls.render(); | ||
| 2863 | } | ||
| 2864 | |||
| 2860 | // Draw voxels | 2865 | // Draw voxels |
| 2861 | if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) { | 2866 | if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) { |
| 2862 | PerformanceTimer perfTimer("voxels"); | 2867 | PerformanceTimer perfTimer("voxels"); |
| @@ -2873,13 +2878,6 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 10 unmodified lines | |||
| 2873 | _metavoxels.render(); | 2878 | _metavoxels.render(); |
| 2874 | } | 2879 | } |
| 2875 | 2880 | ||
| 2876 | if (Menu::getInstance()->isOptionChecked(MenuOption::BuckyBalls)) { | ||
| 2877 | PerformanceTimer perfTimer("buckyBalls"); | ||
| 2878 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | ||
| 2879 | "Application::displaySide() ... bucky balls..."); | ||
| 2880 | _buckyBalls.render(); | ||
| 2881 | } | ||
| 2882 | |||
| 2883 | // render particles... | 2881 | // render particles... |
| 2884 | if (Menu::getInstance()->isOptionChecked(MenuOption::Particles)) { | 2882 | if (Menu::getInstance()->isOptionChecked(MenuOption::Particles)) { |
| 2885 | PerformanceTimer perfTimer("particles"); | 2883 | PerformanceTimer perfTimer("particles"); |
| @@ -2903,27 +2901,34 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 17 unmodified lines | |||
| 2903 | "Application::displaySide() ... AmbientOcclusion..."); | 2901 | "Application::displaySide() ... AmbientOcclusion..."); |
| 2904 | _ambientOcclusionEffect.render(); | 2902 | _ambientOcclusionEffect.render(); |
| 2905 | } | 2903 | } |
| 2906 | |||
| 2907 | // restore default, white specular | ||
| 2908 | glMaterialfv(GL_FRONT, GL_SPECULAR, WORLD_SPECULAR_COLOR); | ||
| 2909 | |||
| 2910 | _nodeBoundsDisplay.draw(); | ||
| 2911 | |||
| 2912 | } | 2904 | } |
| 2913 | 2905 | ||
| 2914 | bool mirrorMode = (whichCamera.getInterpolatedMode() == CAMERA_MODE_MIRROR); | 2906 | bool mirrorMode = (whichCamera.getInterpolatedMode() == CAMERA_MODE_MIRROR); |
| 2915 | { | 2907 | { |
| 2916 | PerformanceTimer perfTimer("avatars"); | 2908 | PerformanceTimer perfTimer("avatars"); |
| 2917 | 2909 | _avatarManager.renderAvatars(mirrorMode ? Avatar::MIRROR_RENDER_MODE : Avatar::NORMAL_RENDER_MODE, | |
| 2918 | _avatarManager.renderAvatars(mirrorMode ? Avatar::MIRROR_RENDER_MODE : Avatar::NORMAL_RENDER_MODE, selfAvatarOnly); | 2910 | false, selfAvatarOnly); |
| 2911 | } | ||
| 2912 | |||
| 2913 | { | ||
| 2914 | PerformanceTimer perfTimer("lighting"); | ||
| 2915 | _deferredLightingEffect.render(); | ||
| 2916 | } | ||
| 2919 | 2917 | ||
| 2920 | //Render the sixense lasers | 2918 | { |
| 2921 | if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseLasers)) { | 2919 | PerformanceTimer perfTimer("avatarsPostLighting"); |
| 2922 | _myAvatar->renderLaserPointers(); | 2920 | _avatarManager.renderAvatars(mirrorMode ? Avatar::MIRROR_RENDER_MODE : Avatar::NORMAL_RENDER_MODE, |
| 2923 | } | 2921 | true, selfAvatarOnly); |
| 2922 | } | ||
| 2923 | |||
| 2924 | //Render the sixense lasers | ||
| 2925 | if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseLasers)) { | ||
| 2926 | _myAvatar->renderLaserPointers(); | ||
| 2924 | } | 2927 | } |
| 2925 | 2928 | ||
| 2926 | if (!selfAvatarOnly) { | 2929 | if (!selfAvatarOnly) { |
| 2930 | _nodeBoundsDisplay.draw(); | ||
| 2931 | |||
| 2927 | // Render the world box | 2932 | // Render the world box |
| 2928 | if (whichCamera.getMode() != CAMERA_MODE_MIRROR && Menu::getInstance()->isOptionChecked(MenuOption::Stats) && | 2933 | if (whichCamera.getMode() != CAMERA_MODE_MIRROR && Menu::getInstance()->isOptionChecked(MenuOption::Stats) && |
| 2929 | Menu::getInstance()->isOptionChecked(MenuOption::UserInterface)) { | 2934 | Menu::getInstance()->isOptionChecked(MenuOption::UserInterface)) { |
| @@ -2998,7 +3003,7 @@ void Application::computeOffAxisFrustum(float& left, float& right, float& bottom · 68 unmodified lines | |||
| 2998 | float& farVal, glm::vec4& nearClipPlane, glm::vec4& farClipPlane) const { | 3003 | float& farVal, glm::vec4& nearClipPlane, glm::vec4& farClipPlane) const { |
| 2999 | 3004 | ||
| 3000 | // allow 3DTV/Oculus to override parameters from camera | 3005 | // allow 3DTV/Oculus to override parameters from camera |
| 3001 | _viewFrustum.computeOffAxisFrustum(left, right, bottom, top, nearVal, farVal, nearClipPlane, farClipPlane); | 3006 | _displayViewFrustum.computeOffAxisFrustum(left, right, bottom, top, nearVal, farVal, nearClipPlane, farClipPlane); |
| 3002 | if (OculusManager::isConnected()) { | 3007 | if (OculusManager::isConnected()) { |
| 3003 | OculusManager::overrideOffAxisFrustum(left, right, bottom, top, nearVal, farVal, nearClipPlane, farClipPlane); | 3008 | OculusManager::overrideOffAxisFrustum(left, right, bottom, top, nearVal, farVal, nearClipPlane, farClipPlane); |
| 3004 | 3009 | ||
| @@ -3797,8 +3802,8 @@ ScriptEngine* Application::loadScript(const QString& scriptFilename, bool isUser · 792 unmodified lines | |||
| 3797 | scriptEngine->getEntityScriptingInterface()->setPacketSender(&_entityEditSender); | 3802 | scriptEngine->getEntityScriptingInterface()->setPacketSender(&_entityEditSender); |
| 3798 | scriptEngine->getEntityScriptingInterface()->setEntityTree(_entities.getTree()); | 3803 | scriptEngine->getEntityScriptingInterface()->setEntityTree(_entities.getTree()); |
| 3799 | 3804 | ||
| 3800 | // model has some custom types | 3805 | // AvatarManager has some custom types |
| 3801 | Model::registerMetaTypes(scriptEngine); | 3806 | AvatarManager::registerMetaTypes(scriptEngine); |
| 3802 | 3807 | ||
| 3803 | // hook our avatar object into this script engine | 3808 | // hook our avatar object into this script engine |
| 3804 | scriptEngine->setAvatarData(_myAvatar, "MyAvatar"); // leave it as a MyAvatar class to expose thrust features | 3809 | scriptEngine->setAvatarData(_myAvatar, "MyAvatar"); // leave it as a MyAvatar class to expose thrust features |