diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl | 10 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class3/lighting/lightV.glsl | 10 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl | 67 | ||||
-rw-r--r-- | indra/newview/lldrawpoolavatar.cpp | 49 | ||||
-rw-r--r-- | indra/newview/lldynamictexture.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llfloaterbvhpreview.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llfloaterbvhpreview.h | 1 | ||||
-rw-r--r-- | indra/newview/llviewercamera.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llviewercamera.h | 4 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 23 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.h | 1 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 2 |
13 files changed, 32 insertions, 163 deletions
diff --git a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl index 0c3ea4231e..75a327d3d7 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl @@ -38,15 +38,7 @@ vec4 sumLights(vec3 pos, vec3 norm, vec4 color) col.a = color.a; col.rgb = light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz); - col.rgb = scaleDownLight(col.rgb); - -#if defined(LOCAL_LIGHT_KILL) - col.rgb = vec3(0); -#endif - -#if !defined(SUNLIGHT_KILL) - col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, light_position[0].xyz)); -#endif + col.rgb += light_diffuse[1].rgb * sqrt(calcDirectionalLight(norm, -light_position[1].xyz)*0.5+0.25); col.rgb = min(col.rgb*color.rgb, 1.0); return col; diff --git a/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl index 30ad493331..77bbbabfae 100644 --- a/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl +++ b/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl @@ -23,21 +23,13 @@ * $/LicenseInfo$ */ - - -// All lights, no specular highlights -vec3 atmosAmbient(); +// used for preview renders only vec4 sumLights(vec3 pos, vec3 norm, vec4 color); -float getAmbientClamp(); vec4 calcLighting(vec3 pos, vec3 norm, vec4 color) { vec4 c = sumLights(pos, norm, color); -#if !defined(AMBIENT_KILL) - c.rgb += atmosAmbient() * color.rgb * getAmbientClamp(); -#endif - return c; } diff --git a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl deleted file mode 100644 index 4b663dd5b2..0000000000 --- a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @file class3\lighting\sumLightsV.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2005, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - - -float calcDirectionalLight(vec3 n, vec3 l); -float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight); - -vec3 atmosAffectDirectionalLight(float lightIntensity); -vec3 scaleDownLight(vec3 light); - -uniform vec4 light_position[8]; -uniform vec3 light_direction[8]; -uniform vec4 light_attenuation[8]; -uniform vec3 light_diffuse[8]; - -vec4 sumLights(vec3 pos, vec3 norm, vec4 color) -{ - vec4 col = vec4(0.0, 0.0, 0.0, color.a); - - // Collect normal lights (need to be divided by two, as we later multiply by 2) - - // Collect normal lights - col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].y, light_attenuation[2].z); - col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].y, light_attenuation[3].z); - col.rgb += light_diffuse[4].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[4], light_direction[4], light_attenuation[4].x, light_attenuation[4].y, light_attenuation[4].z); - col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].y, light_attenuation[5].z); - col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].y, light_attenuation[6].z); - col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].y, light_attenuation[7].z); - col.rgb += light_diffuse[1].rgb*calcDirectionalLight(norm, light_position[1].xyz); - col.rgb = scaleDownLight(col.rgb); - -#if defined(LOCAL_LIGHT_KILL) - col.rgb = vec3(0); -#endif - - // Add windlight lights -#if !defined(SUNLIGHT_KILL) - col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, light_position[0].xyz)); -#endif - - col.rgb = min(col.rgb*color.rgb, 1.0); - - return col; -} - diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 19b23609a6..f3a6c4a3a7 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -597,49 +597,14 @@ void LLDrawPoolAvatar::beginSkinned() { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR - if (sShaderLevel > 0) - { - if (LLPipeline::sUnderWaterRender) - { - sVertexProgram = &gAvatarWaterProgram; - sShaderLevel = llmin((U32) 1, sShaderLevel); - } - else - { - sVertexProgram = &gAvatarProgram; - } - } - else - { - if (LLPipeline::sUnderWaterRender) - { - sVertexProgram = &gObjectAlphaMaskNoColorWaterProgram; - } - else - { - sVertexProgram = &gObjectAlphaMaskNoColorProgram; - } - } - - if (sShaderLevel > 0) // for hardware blending - { - sRenderingSkinned = TRUE; + // used for preview only - sVertexProgram->bind(); - sVertexProgram->enableTexture(LLViewerShaderMgr::BUMP_MAP); - gGL.getTexUnit(0)->activate(); - } - else - { - if(gPipeline.shadersLoaded()) - { - // software skinning, use a basic shader for windlight. - // TODO: find a better fallback method for software skinning. - sVertexProgram->bind(); - } - } + sVertexProgram = &gAvatarProgram; + + sRenderingSkinned = TRUE; - sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha); + sVertexProgram->bind(); + sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha); } void LLDrawPoolAvatar::endSkinned() @@ -704,7 +669,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) if (pass == -1) { for (S32 i = 1; i < getNumPasses(); i++) - { //skip foot shadows + { //skip impostor pass prerender(); beginRenderPass(i); renderAvatars(single_avatar, i); diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index 7fdb3fbdaf..425acd3392 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -170,7 +170,7 @@ void LLViewerDynamicTexture::postRender(BOOL success) camera->setOrigin(mCamera); camera->setAxes(mCamera); camera->setAspect(mCamera.getAspect()); - camera->setView(mCamera.getView()); + camera->setViewNoBroadcast(mCamera.getView()); camera->setNear(mCamera.getNear()); } diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index ed3dc37043..6e29450ff3 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -1113,18 +1113,17 @@ BOOL LLPreviewAnimation::render() LLQuaternion camera_rot = LLQuaternion(mCameraPitch, LLVector3::y_axis) * LLQuaternion(mCameraYaw, LLVector3::z_axis); + LLViewerCamera* camera = LLViewerCamera::getInstance(); + LLQuaternion av_rot = avatarp->mRoot->getWorldRotation() * camera_rot; - LLViewerCamera::getInstance()->setOriginAndLookAt( + camera->setOriginAndLookAt( target_pos + ((LLVector3(mCameraDistance, 0.f, 0.f) + mCameraOffset) * av_rot), // camera LLVector3::z_axis, // up target_pos + (mCameraOffset * av_rot) ); // point of interest - LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom); - LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE); - - mCameraRelPos = LLViewerCamera::getInstance()->getOrigin() - avatarp->mHeadp->getWorldPosition(); - - //avatarp->setAnimationData("LookAtPoint", (void *)&mCameraRelPos); + camera->setViewNoBroadcast(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom); + camera->setAspect((F32) mFullWidth / (F32) mFullHeight); + camera->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE); //SJB: Animation is updated in LLVOAvatar::updateCharacter diff --git a/indra/newview/llfloaterbvhpreview.h b/indra/newview/llfloaterbvhpreview.h index 20d15d9603..9dfefc5a5f 100644 --- a/indra/newview/llfloaterbvhpreview.h +++ b/indra/newview/llfloaterbvhpreview.h @@ -64,7 +64,6 @@ protected: F32 mCameraPitch; F32 mCameraZoom; LLVector3 mCameraOffset; - LLVector3 mCameraRelPos; LLPointer<LLVOAvatar> mDummyAvatar; }; diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index 5d8e80cc41..b37f08283d 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -819,9 +819,13 @@ BOOL LLViewerCamera::areVertsVisible(LLViewerObject* volumep, BOOL all_verts) return all_verts; } +extern BOOL gCubeSnapshot; + // changes local camera and broadcasts change /* virtual */ void LLViewerCamera::setView(F32 vertical_fov_rads) { + llassert(!gCubeSnapshot); + F32 old_fov = LLViewerCamera::getInstance()->getView(); // cap the FoV @@ -847,6 +851,11 @@ BOOL LLViewerCamera::areVertsVisible(LLViewerObject* volumep, BOOL all_verts) LLCamera::setView(vertical_fov_rads); // call base implementation } +void LLViewerCamera::setViewNoBroadcast(F32 vertical_fov_rads) +{ + LLCamera::setView(vertical_fov_rads); +} + void LLViewerCamera::setDefaultFOV(F32 vertical_fov_rads) { vertical_fov_rads = llclamp(vertical_fov_rads, getMinView(), getMaxView()); diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h index b5841772ed..78ca2b3076 100644 --- a/indra/newview/llviewercamera.h +++ b/indra/newview/llviewercamera.h @@ -87,8 +87,8 @@ public: LLVector3 roundToPixel(const LLVector3 &pos_agent); // Sets the current matrix - /* virtual */ void setView(F32 vertical_fov_rads); - + /* virtual */ void setView(F32 vertical_fov_rads); // NOTE: broadcasts to simulator + void setViewNoBroadcast(F32 vertical_fov_rads); // set FOV without broadcasting to simulator (for temporary local cameras) void setDefaultFOV(F32 fov) ; F32 getDefaultFOV() { return mCameraFOVDefault; } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index b98d836803..f14e3ed737 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -127,6 +127,8 @@ extern void on_new_message(const LLSD& msg); +extern BOOL gCubeSnapshot; + // // Constants // @@ -3294,6 +3296,8 @@ const F32 MAX_HEAD_ROT_QDOT = 0.99999f; // ~= 0.5 degrees -- if its greater th void send_agent_update(BOOL force_send, BOOL send_reliable) { LL_PROFILE_ZONE_SCOPED; + llassert(!gCubeSnapshot); + if (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE) { // We don't care if they want to send an agent update, they're not allowed to until the simulator diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 8e5f5ef866..fe832b20bd 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -118,7 +118,6 @@ LLGLSLShader gPathfindingNoNormalsProgram; //avatar shader handles LLGLSLShader gAvatarProgram; -LLGLSLShader gAvatarWaterProgram; LLGLSLShader gAvatarEyeballProgram; LLGLSLShader gImpostorProgram; @@ -256,7 +255,6 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gSkinnedObjectFullbrightAlphaMaskProgram); mShaderList.push_back(&gObjectAlphaMaskNoColorProgram); mShaderList.push_back(&gObjectAlphaMaskNoColorWaterProgram); - mShaderList.push_back(&gAvatarWaterProgram); mShaderList.push_back(&gUnderWaterProgram); mShaderList.push_back(&gDeferredSunProgram); mShaderList.push_back(&gDeferredSoftenProgram); @@ -2854,7 +2852,6 @@ BOOL LLViewerShaderMgr::loadShadersAvatar() if (mShaderLevel[SHADER_AVATAR] == 0) { gAvatarProgram.unload(); - gAvatarWaterProgram.unload(); gAvatarEyeballProgram.unload(); return TRUE; } @@ -2876,26 +2873,6 @@ BOOL LLViewerShaderMgr::loadShadersAvatar() gAvatarProgram.mShaderLevel = mShaderLevel[SHADER_AVATAR]; success = gAvatarProgram.createShader(NULL, NULL); - if (success) - { - gAvatarWaterProgram.mName = "Avatar Water Shader"; - gAvatarWaterProgram.mFeatures.hasSkinning = true; - gAvatarWaterProgram.mFeatures.calculatesAtmospherics = true; - gAvatarWaterProgram.mFeatures.calculatesLighting = true; - gAvatarWaterProgram.mFeatures.hasWaterFog = true; - gAvatarWaterProgram.mFeatures.hasAtmospherics = true; - gAvatarWaterProgram.mFeatures.hasLighting = true; - gAvatarWaterProgram.mFeatures.hasAlphaMask = true; - gAvatarWaterProgram.mFeatures.disableTextureIndex = true; - gAvatarWaterProgram.mShaderFiles.clear(); - gAvatarWaterProgram.mShaderFiles.push_back(make_pair("avatar/avatarV.glsl", GL_VERTEX_SHADER)); - gAvatarWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER)); - // Note: no cloth under water: - gAvatarWaterProgram.mShaderLevel = llmin(mShaderLevel[SHADER_AVATAR], 1); - gAvatarWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = gAvatarWaterProgram.createShader(NULL, NULL); - } - /// Keep track of avatar levels if (gAvatarProgram.mShaderLevel != mShaderLevel[SHADER_AVATAR]) { diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 492e60b840..0f742b891f 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -196,7 +196,6 @@ extern LLGLSLShader gPathfindingNoNormalsProgram; // avatar shader handles extern LLGLSLShader gAvatarProgram; -extern LLGLSLShader gAvatarWaterProgram; extern LLGLSLShader gAvatarEyeballProgram; extern LLGLSLShader gImpostorProgram; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 2aaaecfb38..8516bbc7ec 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -5326,7 +5326,7 @@ BOOL LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea // camera constants for the square, cube map capture image camera->setAspect(1.0); // must set aspect ratio first to avoid undesirable clamping of vertical FoV - camera->setView(F_PI_BY_TWO); + camera->setViewNoBroadcast(F_PI_BY_TWO); camera->yaw(0.0); camera->setOrigin(origin); camera->setNear(near_clip); |