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 | 695 | displaySide(whichCamera); |
| 696 | 696 | glPopMatrix(); |
| 697 | 697 | |
| 698 | − _glowEffect.render(); | |
| 699 | − | |
| 700 | 698 | if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { |
| 701 | 699 | renderRearViewMirror(_mirrorViewRect); |
| 702 | 700 | |
| @@ -704,6 +702,8 @@ void Application::paintGL() { · 1 unmodified line | ||
| 704 | 702 | _rearMirrorTools->render(true); |
| 705 | 703 | } |
| 706 | 704 | |
| 705 | + _glowEffect.render(); | |
| 706 | + | |
| 707 | 707 | { |
| 708 | 708 | PerformanceTimer perfTimer("renderOverlay"); |
| 709 | 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 | 1752 | _environment.init(); |
| 1753 | 1753 | |
| 1754 | + _deferredLightingEffect.init(); | |
| 1754 | 1755 | _glowEffect.init(); |
| 1755 | 1756 | _ambientOcclusionEffect.init(); |
| 1756 | 1757 | _voxelShader.init(); |
| @@ -2706,7 +2707,6 @@ void Application::updateShadowMap() { · 949 unmodified lines | ||
| 2706 | 2707 | const GLfloat WORLD_AMBIENT_COLOR[] = { 0.525f, 0.525f, 0.6f }; |
| 2707 | 2708 | const GLfloat WORLD_DIFFUSE_COLOR[] = { 0.6f, 0.525f, 0.525f }; |
| 2708 | 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 | 2711 | void Application::setupWorldLight() { |
| 2712 | 2712 | |
| @@ -2727,7 +2727,8 @@ void Application::setupWorldLight() { · 14 unmodified lines | ||
| 2727 | 2727 | QImage Application::renderAvatarBillboard() { |
| 2728 | 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 | 2733 | const int BILLBOARD_SIZE = 64; |
| 2733 | 2734 | renderRearViewMirror(QRect(0, _glWidget->getDeviceHeight() - BILLBOARD_SIZE, BILLBOARD_SIZE, BILLBOARD_SIZE), true); |
| @@ -2735,8 +2736,6 @@ QImage Application::renderAvatarBillboard() { · 1 unmodified line | ||
| 2735 | 2736 | QImage image(BILLBOARD_SIZE, BILLBOARD_SIZE, QImage::Format_ARGB32); |
| 2736 | 2737 | glReadPixels(0, 0, BILLBOARD_SIZE, BILLBOARD_SIZE, GL_BGRA, GL_UNSIGNED_BYTE, image.bits()); |
| 2737 | 2738 | |
| 2738 | − glEnable(GL_BLEND); | |
| 2739 | − | |
| 2740 | 2739 | _textureCache.getPrimaryFramebufferObject()->release(); |
| 2741 | 2740 | |
| 2742 | 2741 | return image; |
| @@ -2840,6 +2839,8 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 97 unmodified lines | ||
| 2840 | 2839 | glEnable(GL_LIGHTING); |
| 2841 | 2840 | glEnable(GL_DEPTH_TEST); |
| 2842 | 2841 | |
| 2842 | + _deferredLightingEffect.prepare(); | |
| 2843 | + | |
| 2843 | 2844 | if (!selfAvatarOnly) { |
| 2844 | 2845 | // draw a red sphere |
| 2845 | 2846 | float originSphereRadius = 0.05f; |
| @@ -2848,15 +2849,19 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 2 unmodified lines | ||
| 2848 | 2849 | glutSolidSphere(originSphereRadius, 15, 15); |
| 2849 | 2850 | glPopMatrix(); |
| 2850 | 2851 | |
| 2851 | − // disable specular lighting for ground and voxels | |
| 2852 | − glMaterialfv(GL_FRONT, GL_SPECULAR, NO_SPECULAR_COLOR); | |
| 2853 | − | |
| 2854 | 2852 | // draw the audio reflector overlay |
| 2855 | 2853 | { |
| 2856 | 2854 | PerformanceTimer perfTimer("audio"); |
| 2857 | 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 | 2865 | // Draw voxels |
| 2861 | 2866 | if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) { |
| 2862 | 2867 | PerformanceTimer perfTimer("voxels"); |
| @@ -2873,13 +2878,6 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 10 unmodified lines | ||
| 2873 | 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 | 2881 | // render particles... |
| 2884 | 2882 | if (Menu::getInstance()->isOptionChecked(MenuOption::Particles)) { |
| 2885 | 2883 | PerformanceTimer perfTimer("particles"); |
| @@ -2903,27 +2901,34 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 17 unmodified lines | ||
| 2903 | 2901 | "Application::displaySide() ... AmbientOcclusion..."); |
| 2904 | 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 | 2906 | bool mirrorMode = (whichCamera.getInterpolatedMode() == CAMERA_MODE_MIRROR); |
| 2915 | 2907 | { |
| 2916 | 2908 | PerformanceTimer perfTimer("avatars"); |
| 2917 | − | |
| 2918 | − _avatarManager.renderAvatars(mirrorMode ? Avatar::MIRROR_RENDER_MODE : Avatar::NORMAL_RENDER_MODE, selfAvatarOnly); | |
| 2909 | + _avatarManager.renderAvatars(mirrorMode ? Avatar::MIRROR_RENDER_MODE : Avatar::NORMAL_RENDER_MODE, | |
| 2910 | + false, selfAvatarOnly); | |
| 2911 | + } | |
| 2912 | + | |
| 2913 | + { | |
| 2914 | + PerformanceTimer perfTimer("lighting"); | |
| 2915 | + _deferredLightingEffect.render(); | |
| 2916 | + } | |
| 2919 | 2917 | |
| 2920 | − //Render the sixense lasers | |
| 2921 | − if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseLasers)) { | |
| 2922 | − _myAvatar->renderLaserPointers(); | |
| 2923 | − } | |
| 2918 | + { | |
| 2919 | + PerformanceTimer perfTimer("avatarsPostLighting"); | |
| 2920 | + _avatarManager.renderAvatars(mirrorMode ? Avatar::MIRROR_RENDER_MODE : Avatar::NORMAL_RENDER_MODE, | |
| 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 | 2929 | if (!selfAvatarOnly) { |
| 2930 | + _nodeBoundsDisplay.draw(); | |
| 2931 | + | |
| 2927 | 2932 | // Render the world box |
| 2928 | 2933 | if (whichCamera.getMode() != CAMERA_MODE_MIRROR && Menu::getInstance()->isOptionChecked(MenuOption::Stats) && |
| 2929 | 2934 | Menu::getInstance()->isOptionChecked(MenuOption::UserInterface)) { |
| @@ -2998,7 +3003,7 @@ void Application::computeOffAxisFrustum(float& left, float& right, float& bottom · 68 unmodified lines | ||
| 2998 | 3003 | float& farVal, glm::vec4& nearClipPlane, glm::vec4& farClipPlane) const { |
| 2999 | 3004 | |
| 3000 | 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 | 3007 | if (OculusManager::isConnected()) { |
| 3003 | 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 | 3802 | scriptEngine->getEntityScriptingInterface()->setPacketSender(&_entityEditSender); |
| 3798 | 3803 | scriptEngine->getEntityScriptingInterface()->setEntityTree(_entities.getTree()); |
| 3799 | 3804 | |
| 3800 | − // model has some custom types | |
| 3801 | − Model::registerMetaTypes(scriptEngine); | |
| 3805 | + // AvatarManager has some custom types | |
| 3806 | + AvatarManager::registerMetaTypes(scriptEngine); | |
| 3802 | 3807 | |
| 3803 | 3808 | // hook our avatar object into this script engine |
| 3804 | 3809 | scriptEngine->setAvatarData(_myAvatar, "MyAvatar"); // leave it as a MyAvatar class to expose thrust features |