# Conflicts:
#	indra/newview/VIEWER_VERSION.txt
#	indra/newview/llfasttimerview.cpp
#	indra/newview/skins/default/xui/en/widgets/color_swatch.xml
#	indra/newview/skins/default/xui/en/widgets/texture_picker.xml
master
Ansariel 2024-01-09 09:37:38 +01:00
commit 3bd76c0fea
149 changed files with 1975 additions and 1684 deletions

View File

@ -9,11 +9,18 @@ on:
- "*preview"
schedule:
- cron: '00 03 * * *' # Run every day at 3am UTC
env:
env:
AUTOBUILD_VARIABLES_FILE: ${{github.workspace}}/build-variables/variables
EXTRA_ARGS: -DUSE_FMODSTUDIO=ON -DUSE_KDU=ON --crashreporting
build_secrets_checkout: ${{github.workspace}}/signing
XZ_DEFAULTS: -T0
FS_RELEASE_TYPE: Unknown
platform: Unknown
fallback_platform: ${platform}
FS_RELEASE_CHAN: ${FS_RELEASE_TYPE}x64
FS_GRID: "GRID FLAGS NOT SET"
PYTHON:
jobs:
build_matrix:
strategy:
@ -22,6 +29,9 @@ jobs:
grid: [sl,os]
addrsize: [64]
runs-on: ${{ matrix.os }}
outputs:
viewer_channel: ${{ steps.channel.outputs.viewer_channel }}
viewer_version: ${{ steps.version.outputs.viewer_version }}
steps:
- name: Install Bash 4 and GNU sed on Mac
if: runner.os == 'macOS'
@ -36,15 +46,20 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
id: py312
id: py311
with:
python-version: '3.11.6'
cache: 'pip'
python-version: '3.11'
- name: Set PYTHON environment for CMake
run: |
echo "PYTHON=${{ steps.py311.outputs.python-path }}" >> $GITHUB_ENV
shell: bash
- name: Install python requirements
run: |
python3 -m pip install -r requirements.txt
python -m pip install -r requirements.txt
# export the new python to the environment var $PYTHON
- name: Check python version
run: python -V
@ -90,6 +105,7 @@ jobs:
shell: bash
- name: find channel from Branch name
id: channel
run: |
if [[ "${{ github.ref_name }}" == Firestorm* ]]; then
FS_RELEASE_TYPE=Release
@ -110,6 +126,7 @@ jobs:
echo "FS_RELEASE_TYPE=${FS_RELEASE_TYPE}" >> $GITHUB_ENV
echo "FS_RELEASE_CHAN=${FS_RELEASE_CHAN}" >> $GITHUB_ENV
echo "Building for channel ${FS_RELEASE_CHAN}"
viewer_channel=${FS_RELEASE_CHAN}
shell: bash
- name: Get the code
@ -238,9 +255,18 @@ jobs:
shell: bash
- name: build
id: build
run: autobuild build -c ReleaseFS -A${{matrix.addrsize}} --no-configure
shell: bash
# - name: Extract version number
# id: version
# shell: bash
# run: |
# if [ -r "indra/newview/viewer_version.txt" ]
# then
# viewer_version="$(<"$build_dir/newview/viewer_version.txt")"
# echo "viewer_version=$viewer_version" >> "$GITHUB_OUTPUT"
# fi
- name: Publish artifacts
if: runner.os == 'Windows'
uses: actions/upload-artifact@v3
@ -267,9 +293,37 @@ jobs:
path: |
build-darwin-*/newview/*.dmg
build-darwin-*/newview/*.bz2
# post-windows-symbols:
# needs: build_matrix
# runs-on: ubuntu-latest
# steps:
# - name: Post Windows symbols
# uses: secondlife/viewer-build-util/post-bugsplat-windows@v1
# with:
# username: ${{ secrets.BUGSPLAT_USER }}
# password: ${{ secrets.BUGSPLAT_PASS }}
# database: "firestorm_release"
# channel: ${{ needs.build_matrix.outputs.viewer_channel }}
# version: ${{ needs.build_matrix.outputs.viewer_version }}
# post-mac-symbols:
# needs: build_matrix
# runs-on: ubuntu-latest
# steps:
# - name: Post Mac symbols
# uses: secondlife/viewer-build-util/post-bugsplat-mac@v1
# with:
# username: ${{ secrets.BUGSPLAT_USER }}
# password: ${{ secrets.BUGSPLAT_PASS }}
# database: "firestorm_release"
# channel: ${{ needs.build_matrix.outputs.viewer_channel }}
# version: ${{ needs.build_matrix.outputs.viewer_version }}
deploy:
runs-on: ubuntu-latest
needs: build_matrix
env:
FS_BUILD_WEBHOOK_URL:
FS_RELEASE_FOLDER:
if: always()
steps:
- name: Checkout files

View File

@ -2,9 +2,9 @@
* @file
* @brief
*
* $LicenseInfo:firstyear=2023&license=fsviewerlgpl$
* $LicenseInfo:firstyear=2024&license=fsviewerlgpl$
* Phoenix Firestorm Viewer Source Code
* Copyright (C) 2020, The Phoenix Firestorm Project, Inc.
* Copyright (C) 2024, The Phoenix Firestorm Project, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

29
README.md Normal file
View File

@ -0,0 +1,29 @@
<picture>
<img alt="Firestorm Viewer Logo" src="doc/firestorm_256.png">
</picture>
**[Firestorm](https://www.firestormviewer.org/) is a free client for 3D virtual worlds such as Second Life and various OpenSim worlds where users can create, connect and chat with others from around the world.** This repository contains the official source code for the Firestorm viewer.
## Open Source
Firestorm is a third party viewer derived from the official [Second Life](https://github.com/secondlife/viewer) client. The client codebase has been open source since 2007 and is available under the LGPL license.
## Download
Pre-built versions of the viewer releases for Windows, Mac and Linux can be downloaded from the [official website](https://www.firestormviewer.org/choose-your-platform/).
## Build Instructions
Build instructions for each operating system can be found in the official [wiki](https://wiki.firestormviewer.org/).
- [Windows](https://wiki.firestormviewer.org/fs_compiling_firestorm_windows)
- [Mac](https://wiki.firestormviewer.org/fs_compiling_firestorm_macos)
- [Linux](https://wiki.firestormviewer.org/fs_compiling_firestorm_linux)
Please note that we do not provide support for compiling the viewer or issues resulting from using a self-compiled viewer. However, there is a self-compilers group within Second Life that can be joined to ask questions related to compiling the viewer: [Firestorm Self Compilers](secondlife:///app/group/2014ce4c-5393-fb67-83ac-910db84c273c/about)
## Contribute
Help make Firestorm better! You can get involved with improvements by filing bugs and suggesting enhancements via [JIRA](https://jira.firestormviewer.org) or creating pull requests.

View File

@ -4257,7 +4257,7 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<key>license_file</key>
<string>docs/LICENSE-source.txt</string>
<key>copyright</key>
<string>Copyright (c) 2023, The Phoenix Firestorm Project, Inc.</string>
<string>Copyright (c) 2024, The Phoenix Firestorm Project, Inc.</string>
<key>version_file</key>
<string>newview/viewer_version.txt</string>
<key>name</key>

View File

@ -603,6 +603,7 @@ Henri Beauchamp
SL-15175
SL-19110
SL-19159
[NO JIRA] (fullbright HUD alpha fix)
herina Bode
Hikkoshi Sakai
VWR-429

BIN
doc/firestorm_256.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

View File

@ -411,7 +411,7 @@ void LLAudioEngine::idle()
for (source_map::value_type& src_pair : mAllSources)
{
LLAudioSource *sourcep = src_pair.second;
if (sourcep->isMuted() && sourcep->isSyncMaster() && sourcep->getPriority() > max_sm_priority)
if (!sourcep->isMuted() && sourcep->isSyncMaster() && sourcep->getPriority() > max_sm_priority)
{
sync_masterp = sourcep;
master_channelp = sync_masterp->getChannel();

View File

@ -2731,8 +2731,8 @@ bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& mo
// </FS:Beq>
next->getVolumeFaces() = remainder;
next->mNormalizedScale = ret->mNormalizedScale;
next->mNormalizedTranslation = ret->mNormalizedTranslation; // <FS> Mesh upload fix by Rye Mutt
next->mNormalizedTranslation = ret->mNormalizedTranslation;
if ( ret->mMaterialList.size() > LL_SCULPT_MESH_MAX_FACES)
{
next->mMaterialList.assign(ret->mMaterialList.begin() + LL_SCULPT_MESH_MAX_FACES, ret->mMaterialList.end());

View File

@ -699,24 +699,44 @@ void LLGLTFMaterial::applyOverrideLLSD(const LLSD& data)
if (bc.isDefined())
{
mBaseColor.setValue(bc);
if (mBaseColor == getDefaultBaseColor())
{
// HACK -- nudge by epsilon if we receive a default value (indicates override to default)
mBaseColor.mV[3] -= FLT_EPSILON;
}
}
const LLSD& ec = data["ec"];
if (ec.isDefined())
{
mEmissiveColor.setValue(ec);
if (mEmissiveColor == getDefaultEmissiveColor())
{
// HACK -- nudge by epsilon if we receive a default value (indicates override to default)
mEmissiveColor.mV[0] += FLT_EPSILON;
}
}
const LLSD& mf = data["mf"];
if (mf.isReal())
{
mMetallicFactor = mf.asReal();
if (mMetallicFactor == getDefaultMetallicFactor())
{
// HACK -- nudge by epsilon if we receive a default value (indicates override to default)
mMetallicFactor -= FLT_EPSILON;
}
}
const LLSD& rf = data["rf"];
if (rf.isReal())
{
mRoughnessFactor = rf.asReal();
if (mRoughnessFactor == getDefaultRoughnessFactor())
{
// HACK -- nudge by epsilon if we receive a default value (indicates override to default)
mRoughnessFactor -= FLT_EPSILON;
}
}
const LLSD& am = data["am"];
@ -730,6 +750,11 @@ void LLGLTFMaterial::applyOverrideLLSD(const LLSD& data)
if (ac.isReal())
{
mAlphaCutoff = ac.asReal();
if (mAlphaCutoff == getDefaultAlphaCutoff())
{
// HACK -- nudge by epsilon if we receive a default value (indicates override to default)
mAlphaCutoff -= FLT_EPSILON;
}
}
const LLSD& ds = data["ds"];

View File

@ -55,8 +55,8 @@ const int MODEL_NAMES_LENGTH = sizeof(model_names) / sizeof(std::string);
LLModel::LLModel(LLVolumeParams& params, F32 detail)
: LLVolume(params, detail),
mNormalizedScale(1,1,1),
mNormalizedTranslation(0, 0, 0), // <FS> Mesh upload fix by Rye Mutt
mNormalizedScale(1,1,1),
mNormalizedTranslation(0, 0, 0),
mPelvisOffset( 0.0f ),
mStatus(NO_ERRORS),
mSubmodelID(0)

View File

@ -41,7 +41,6 @@ public:
bool hasLighting = false; // implies no transport (it's possible to have neither though)
bool isAlphaLighting = false; // indicates lighting shaders need not be linked in (lighting performed directly in alpha shader to match deferred lighting functions)
bool isSpecular = false;
bool hasWaterFog = false; // implies no gamma
bool hasTransport = false; // implies no lighting (it's possible to have neither though)
bool hasSkinning = false;
bool hasObjectSkinning = false;

View File

@ -81,14 +81,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
// NOTE order of shader object attaching is VERY IMPORTANT!!!
if (features->calculatesAtmospherics)
{
if (features->hasWaterFog)
{
if (!shader->attachVertexObject("windlight/atmosphericsVarsWaterV.glsl"))
{
return FALSE;
}
}
else if (!shader->attachVertexObject("windlight/atmosphericsVarsV.glsl"))
if (!shader->attachVertexObject("windlight/atmosphericsVarsV.glsl"))
{
return FALSE;
}
@ -201,14 +194,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
if(features->calculatesAtmospherics || features->hasGamma || features->isDeferred)
{
if (features->hasWaterFog)
{
if (!shader->attachFragmentObject("windlight/atmosphericsVarsWaterF.glsl"))
{
return FALSE;
}
}
else if (!shader->attachFragmentObject("windlight/atmosphericsVarsF.glsl"))
if (!shader->attachFragmentObject("windlight/atmosphericsVarsF.glsl"))
{
return FALSE;
}
@ -292,7 +278,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
}
// NOTE order of shader object attaching is VERY IMPORTANT!!!
if (features->hasWaterFog)
if (features->hasAtmospherics)
{
if (!shader->attachFragmentObject("environment/waterFogF.glsl"))
{
@ -302,82 +288,40 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
if (features->hasLighting)
{
if (features->hasWaterFog)
if (features->disableTextureIndex)
{
if (features->disableTextureIndex)
if (features->hasAlphaMask)
{
if (features->hasAlphaMask)
if (!shader->attachFragmentObject("lighting/lightAlphaMaskNonIndexedF.glsl"))
{
if (!shader->attachFragmentObject("lighting/lightWaterAlphaMaskNonIndexedF.glsl"))
{
return FALSE;
}
}
else
{
if (!shader->attachFragmentObject("lighting/lightWaterNonIndexedF.glsl"))
{
return FALSE;
}
return FALSE;
}
}
else
else
{
if (features->hasAlphaMask)
if (!shader->attachFragmentObject("lighting/lightNonIndexedF.glsl"))
{
if (!shader->attachFragmentObject("lighting/lightWaterAlphaMaskF.glsl"))
{
return FALSE;
}
return FALSE;
}
else
{
if (!shader->attachFragmentObject("lighting/lightWaterF.glsl"))
{
return FALSE;
}
}
shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
}
}
else
else
{
if (features->disableTextureIndex)
if (features->hasAlphaMask)
{
if (features->hasAlphaMask)
if (!shader->attachFragmentObject("lighting/lightAlphaMaskF.glsl"))
{
if (!shader->attachFragmentObject("lighting/lightAlphaMaskNonIndexedF.glsl"))
{
return FALSE;
}
}
else
{
if (!shader->attachFragmentObject("lighting/lightNonIndexedF.glsl"))
{
return FALSE;
}
return FALSE;
}
}
else
else
{
if (features->hasAlphaMask)
if (!shader->attachFragmentObject("lighting/lightF.glsl"))
{
if (!shader->attachFragmentObject("lighting/lightAlphaMaskF.glsl"))
{
return FALSE;
}
return FALSE;
}
else
{
if (!shader->attachFragmentObject("lighting/lightF.glsl"))
{
return FALSE;
}
}
shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
}
shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
}
}

View File

@ -1937,31 +1937,16 @@ void LLWindowWin32::destroySharedContext(void* contextPtr)
void LLWindowWin32::toggleVSync(bool enable_vsync)
{
// <FS:Ansariel> Fix null pointer guard
//if (!enable_vsync && wglSwapIntervalEXT)
//{
// LL_INFOS("Window") << "Disabling vertical sync" << LL_ENDL;
// wglSwapIntervalEXT(0);
//}
//else
//{
// LL_INFOS("Window") << "Enabling vertical sync" << LL_ENDL;
// wglSwapIntervalEXT(1);
//}
if (wglSwapIntervalEXT)
if (!enable_vsync && wglSwapIntervalEXT)
{
if (!enable_vsync)
{
LL_INFOS("Window") << "Disabling vertical sync" << LL_ENDL;
wglSwapIntervalEXT(0);
}
else
{
LL_INFOS("Window") << "Enabling vertical sync" << LL_ENDL;
wglSwapIntervalEXT(1);
}
LL_INFOS("Window") << "Disabling vertical sync" << LL_ENDL;
wglSwapIntervalEXT(0);
}
else if (wglSwapIntervalEXT)
{
LL_INFOS("Window") << "Enabling vertical sync" << LL_ENDL;
wglSwapIntervalEXT(1);
}
// </FS:Ansariel>
}
void LLWindowWin32::moveWindow( const LLCoordScreen& position, const LLCoordScreen& size )

View File

@ -2546,7 +2546,7 @@ if (DARWIN)
set(MACOSX_BUNDLE_BUNDLE_NAME "Firestorm")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}")
set(MACOSX_BUNDLE_BUNDLE_VERSION "${VIEWER_SHORT_VERSION}${VIEWER_MACOSX_PHASE}${VIEWER_REVISION}")
set(MACOSX_BUNDLE_COPYRIGHT "Copyright 2010-2023 The Phoenix Firestorm Project, Inc.")
set(MACOSX_BUNDLE_COPYRIGHT "Copyright 2010-2024 The Phoenix Firestorm Project, Inc.")
set(MACOSX_BUNDLE_NSMAIN_NIB_FILE "Firestorm.nib")
set(MACOSX_BUNDLE_NSPRINCIPAL_CLASS "LLApplication")

View File

@ -3,4 +3,4 @@
CFBundleName = "Firestorm";
CFBundleShortVersionString = "Firestorm version %%VERSION%%";
CFBundleGetInfoString = "Firestorm version %%VERSION%%, Copyright 2010-2023 The Phoenix Firestorm Project, Inc.";
CFBundleGetInfoString = "Firestorm version %%VERSION%%, Copyright 2010-2024 The Phoenix Firestorm Project, Inc.";

View File

@ -1 +1 @@
7.1.2
7.1.3

View File

@ -2089,6 +2089,17 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>RenderSnapshotNoPost</key>
<map>
<key>Comment</key>
<string>Disable tone mapping and exposure correction when snapshot is being rendered</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>AutomaticFly</key>
<map>
<key>Comment</key>

View File

@ -34,6 +34,6 @@ void main()
{
// NOTE: when this shader is used, only alpha is being written to
float a = diffuseLookup(vary_texcoord0.xy).a*vertex_color.a;
frag_color = vec4(0, 0, 0, a);
frag_color = max(vec4(0, 0, 0, a), vec4(0));
}

View File

@ -35,21 +35,19 @@ in vec3 vary_position;
in vec4 vertex_color;
in vec2 vary_texcoord0;
#ifdef WATER_FOG
vec4 applyWaterFogView(vec3 pos, vec4 color);
#endif
vec3 srgb_to_linear(vec3 cs);
vec3 linear_to_srgb(vec3 cl);
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten);
void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten);
#ifdef HAS_ALPHA_MASK
uniform float minimum_alpha;
#endif
#ifdef IS_ALPHA
uniform vec4 waterPlane;
void waterClip(vec3 pos);
void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive,
out vec3 atten);
vec4 applySkyAndWaterFog(vec3 pos, vec3 additive, vec3 atten, vec4 color);
#endif
void main()
@ -78,26 +76,21 @@ void main()
vec3 pos = vary_position;
color.a = final_alpha;
#ifndef IS_HUD
color.rgb = srgb_to_linear(color.rgb);
#ifdef IS_ALPHA
vec3 sunlit;
vec3 amblit;
vec3 additive;
vec3 atten;
calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten);
#endif
#ifdef WATER_FOG
color.rgb = applySkyAndWaterFog(pos, additive, atten, color).rgb;
vec4 fogged = applyWaterFogView(pos, vec4(color.rgb, final_alpha));
color.rgb = fogged.rgb;
color.a = fogged.a;
#else
color.a = final_alpha;
#endif
#ifndef IS_HUD
color.rgb = srgb_to_linear(color.rgb);
color.rgb = atmosFragLighting(color.rgb, additive, atten);
#endif
frag_color = max(color, vec4(0));

View File

@ -106,7 +106,7 @@ vec3 toneMap(vec3 color)
color *= exposure * exp_scale;
// mix ACES and Linear here as a compromise to avoid over-darkening legacy content
color = mix(toneMapACES_Hill(color), color, 0.333);
color = mix(toneMapACES_Hill(color), color, 0.3);
#endif
return color;

View File

@ -30,12 +30,14 @@ uniform vec4 waterFogColor;
uniform float waterFogDensity;
uniform float waterFogKS;
vec3 getPositionEye();
vec3 srgb_to_linear(vec3 col);
vec3 linear_to_srgb(vec3 col);
vec4 applyWaterFogView(vec3 pos, vec4 color)
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten);
// get a water fog color that will apply the appropriate haze to a color given
// a blend function of (ONE, SOURCE_ALPHA)
vec4 getWaterFogViewNoClip(vec3 pos)
{
vec3 view = normalize(pos);
//normalize view vector
@ -67,38 +69,76 @@ vec4 applyWaterFogView(vec3 pos, vec4 color)
float L = min(t1/t2*t3, 1.0);
float D = pow(0.98, l*kd);
color.rgb = color.rgb * D + kc.rgb * L;
return color;
return vec4(srgb_to_linear(kc.rgb*L), D);
}
vec4 applyWaterFogViewLinearNoClip(vec3 pos, vec4 color, vec3 sunlit)
vec4 getWaterFogView(vec3 pos)
{
color.rgb = linear_to_srgb(color.rgb);
color = applyWaterFogView(pos, color);
color.rgb = srgb_to_linear(color.rgb);
if (dot(pos, waterPlane.xyz) + waterPlane.w > 0.0)
{
return vec4(0,0,0,1);
}
return getWaterFogViewNoClip(pos);
}
vec4 applyWaterFogView(vec3 pos, vec4 color)
{
vec4 fogged = getWaterFogView(pos);
color.rgb = color.rgb * fogged.a + fogged.rgb;
return color;
}
vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit)
vec4 applyWaterFogViewLinearNoClip(vec3 pos, vec4 color)
{
vec4 fogged = getWaterFogViewNoClip(pos);
color.rgb *= fogged.a;
color.rgb += fogged.rgb;
return color;
}
vec4 applyWaterFogViewLinear(vec3 pos, vec4 color)
{
if (dot(pos, waterPlane.xyz) + waterPlane.w > 0.0)
{
return color;
}
return applyWaterFogViewLinearNoClip(pos, color, sunlit);
return applyWaterFogViewLinearNoClip(pos, color);
}
vec4 applyWaterFogViewLinear(vec3 pos, vec4 color)
// for post deferred shaders, apply sky and water fog in a way that is consistent with
// the deferred rendering haze post effects
vec4 applySkyAndWaterFog(vec3 pos, vec3 additive, vec3 atten, vec4 color)
{
return applyWaterFogViewLinear(pos, color, vec3(1));
}
bool eye_above_water = dot(vec3(0), waterPlane.xyz) + waterPlane.w > 0.0;
bool obj_above_water = dot(pos.xyz, waterPlane.xyz) + waterPlane.w > 0.0;
vec4 applyWaterFog(vec4 color)
{
//normalize view vector
return applyWaterFogViewLinear(getPositionEye(), color);
}
if (eye_above_water)
{
if (!obj_above_water)
{
color.rgb = applyWaterFogViewLinearNoClip(pos, color).rgb;
}
else
{
color.rgb = atmosFragLighting(color.rgb, additive, atten);
}
}
else
{
if (obj_above_water)
{
color.rgb = atmosFragLighting(color.rgb, additive, atten);
}
else
{
color.rgb = applyWaterFogViewLinearNoClip(pos, color).rgb;
}
}
return color;
}

View File

@ -1,51 +0,0 @@
/**
* @file class1\lighting\lightWaterAlphaMaskF.glsl
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, 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$
*/
out vec4 frag_color;
uniform float minimum_alpha;
vec3 atmosLighting(vec3 light);
vec4 applyWaterFog(vec4 color);
in vec4 vertex_color;
in vec2 vary_texcoord0;
void default_lighting_water()
{
vec4 color = diffuseLookup(vary_texcoord0.xy);
if (color.a < minimum_alpha)
{
discard;
}
color.rgb *= vertex_color.rgb;
color.rgb = atmosLighting(color.rgb);
frag_color = max(applyWaterFog(color), vec4(0));
}

View File

@ -1,42 +0,0 @@
/**
* @file class1\lighting\lightWaterF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, 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$
*/
out vec4 frag_color;
in vec4 vertex_color;
in vec2 vary_texcoord0;
vec3 atmosLighting(vec3 light);
vec4 applyWaterFog(vec4 color);
void default_lighting_water()
{
vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
color.rgb = atmosLighting(color.rgb);
frag_color = max(applyWaterFog(color), vec4(0));
}

View File

@ -1,44 +0,0 @@
/**
* @file class1\lighting\lightWaterNonIndexedF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, 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$
*/
out vec4 frag_color;
in vec4 vertex_color;
in vec2 vary_texcoord0;
uniform sampler2D diffuseMap;
vec3 atmosLighting(vec3 light);
vec4 applyWaterFog(vec4 color);
void default_lighting_water()
{
vec4 color = texture(diffuseMap,vary_texcoord0.xy) * vertex_color;
color.rgb = atmosLighting(color.rgb);
frag_color = max(applyWaterFog(color), vec4(0));
}

View File

@ -1,33 +0,0 @@
/**
* @file simpleWaterF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, 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$
*/
void default_lighting_water();
void main()
{
default_lighting_water();
}

View File

@ -30,7 +30,6 @@ vec3 getSunlitColor();
vec3 getAmblitColor();
vec3 getAdditiveColor();
vec3 getAtmosAttenuation();
vec3 getPositionEye();
uniform float scene_light_strength;

View File

@ -42,7 +42,6 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
void calcAtmospherics(vec3 inPositionEye) {
vec3 P = inPositionEye;
setPositionEye(P);
vec3 tmpsunlit = vec3(1);
vec3 tmpamblit = vec3(1);
vec3 tmpaddlit = vec3(1);

View File

@ -44,5 +44,5 @@ vec3 getAdditiveColor()
vec3 getAtmosAttenuation()
{
return vec3(vary_AtmosAttenuation);
return vary_AtmosAttenuation;
}

View File

@ -31,7 +31,6 @@ vec3 additive_color;
vec3 atmos_attenuation;
vec3 sunlit_color;
vec3 amblit_color;
vec3 position_eye;
vec3 getSunlitColor()
{
@ -51,16 +50,6 @@ vec3 getAtmosAttenuation()
return atmos_attenuation;
}
vec3 getPositionEye()
{
return position_eye;
}
void setPositionEye(vec3 v)
{
position_eye = v;
}
void setSunlitColor(vec3 v)
{
sunlit_color = v;

View File

@ -1,50 +0,0 @@
/**
* @file class2\wl\atmosphericVarsWaterF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, 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$
*/
in vec3 vary_PositionEye;
in vec3 vary_AdditiveColor;
in vec3 vary_AtmosAttenuation;
vec3 getSunlitColor()
{
return vec3(0,0,0);
}
vec3 getAmblitColor()
{
return vec3(0,0,0);
}
vec3 getAdditiveColor()
{
return vary_AdditiveColor;
}
vec3 getAtmosAttenuation()
{
return vary_AtmosAttenuation;
}
vec3 getPositionEye()
{
return vary_PositionEye;
}

View File

@ -1,81 +0,0 @@
/**
* @file class2\wl\atmosphericVarsWaterV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, 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$
*/
out vec3 vary_PositionEye;
out vec3 vary_AdditiveColor;
out vec3 vary_AtmosAttenuation;
vec3 atmos_attenuation;
vec3 sunlit_color;
vec3 amblit_color;
vec3 getSunlitColor()
{
return sunlit_color;
}
vec3 getAmblitColor()
{
return amblit_color;
}
vec3 getAdditiveColor()
{
return vary_AdditiveColor;
}
vec3 getAtmosAttenuation()
{
return atmos_attenuation;
}
vec3 getPositionEye()
{
return vary_PositionEye;
}
void setPositionEye(vec3 v)
{
vary_PositionEye = v;
}
void setSunlitColor(vec3 v)
{
sunlit_color = v;
}
void setAmblitColor(vec3 v)
{
amblit_color = v;
}
void setAdditiveColor(vec3 v)
{
vary_AdditiveColor = v;
}
void setAtmosAttenuation(vec3 v)
{
atmos_attenuation = v;
vary_AtmosAttenuation = v;
}

View File

@ -65,16 +65,11 @@ uniform vec3 light_diffuse[8];
void waterClip(vec3 pos);
#ifdef WATER_FOG
vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit);
#endif
vec3 srgb_to_linear(vec3 c);
vec3 linear_to_srgb(vec3 c);
vec2 encode_normal (vec3 n);
vec3 atmosFragLightingLinear(vec3 light, vec3 additive, vec3 atten);
vec4 applySkyAndWaterFog(vec3 pos, vec3 additive, vec3 atten, vec4 color);
void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive);
#ifdef HAS_SUN_SHADOW
@ -270,12 +265,6 @@ void main()
color.rgb *= diffuse_linear.rgb;
color.rgb = atmosFragLightingLinear(color.rgb, additive, atten);
#ifdef WATER_FOG
color = applyWaterFogViewLinear(pos.xyz, color, sunlit_linear);
#endif // WATER_FOG
vec4 light = vec4(0,0,0,0);
#define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, diffuse_linear.rgb, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w);
@ -291,6 +280,8 @@ void main()
// sum local light contrib in linear colorspace
color.rgb += light.rgb;
color.rgb = applySkyAndWaterFog(pos.xyz, additive, atten, color).rgb;
#endif // #else // FOR_IMPOSTOR
#ifdef IS_HUD

View File

@ -82,11 +82,7 @@ vec3 srgb_to_linear(vec3 c);
vec3 linear_to_srgb(vec3 c);
void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive);
vec3 atmosFragLightingLinear(vec3 color, vec3 additive, vec3 atten);
#ifdef WATER_FOG
vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit);
#endif
vec4 applySkyAndWaterFog(vec3 pos, vec3 additive, vec3 atten, vec4 color);
void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist);
float calcLegacyDistanceAttenuation(float distance, float falloff);
@ -228,13 +224,6 @@ void main()
color = pbrBaseLight(diffuseColor, specularColor, metallic, v, norm.xyz, perceptualRoughness, light_dir, sunlit_linear, scol, radiance, irradiance, colorEmissive, ao, additive, atten);
color.rgb = atmosFragLightingLinear(color.rgb, additive, atten);
#ifdef WATER_FOG
vec4 temp = applyWaterFogViewLinear(pos, vec4(color, 0.0), sunlit_linear);
color = temp.rgb;
#endif
vec3 light = vec3(0);
// Punctual lights
@ -250,7 +239,8 @@ void main()
color.rgb += light.rgb;
color.rgb = applySkyAndWaterFog(pos.xyz, additive, atten, vec4(color, 1.0)).rgb;
float a = basecolor.a*vertex_color.a;
frag_color = max(vec4(color.rgb,a), vec4(0));
@ -305,6 +295,7 @@ void main()
float a = basecolor.a*vertex_color.a;
color += colorEmissive;
color = linear_to_srgb(color);
frag_color = max(vec4(color.rgb,a), vec4(0));
}

View File

@ -40,6 +40,8 @@ in vec3 vary_position;
uniform samplerCube environmentMap;
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten);
vec4 applyWaterFogViewLinear(vec3 pos, vec4 color);
void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten);
vec3 linear_to_srgb(vec3 c);
@ -83,7 +85,6 @@ void main()
color.rgb = srgb_to_linear(color.rgb);
applyLegacyEnv(color.rgb, legacyenv, spec, pos, norm, env_intensity);
color.rgb = atmosFragLighting(color.rgb, additive, atten);
#endif
color.a = 1.0;

View File

@ -0,0 +1,106 @@
/**
* @file class3/deferred/hazeF.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, 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$
*/
out vec4 frag_color;
uniform sampler2D normalMap;
// Inputs
uniform vec3 sun_dir;
uniform vec3 moon_dir;
uniform int sun_up_factor;
in vec2 vary_fragcoord;
vec3 getNorm(vec2 pos_screen);
vec4 getPositionWithDepth(vec2 pos_screen, float depth);
void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive);
float getDepth(vec2 pos_screen);
vec3 linear_to_srgb(vec3 c);
vec3 srgb_to_linear(vec3 c);
uniform vec4 waterPlane;
uniform int cube_snapshot;
uniform float sky_hdr_scale;
void main()
{
vec2 tc = vary_fragcoord.xy;
float depth = getDepth(tc.xy);
vec4 pos = getPositionWithDepth(tc, depth);
vec4 norm = texture(normalMap, tc);
norm.xyz = getNorm(tc);
vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
vec3 color = vec3(0);
float bloom = 0.0;
vec3 sunlit;
vec3 amblit;
vec3 additive;
vec3 atten;
calcAtmosphericVarsLinear(pos.xyz, norm.xyz, light_dir, sunlit, amblit, additive, atten);
vec3 sunlit_linear = srgb_to_linear(sunlit);
// mask off atmospherics below water (when camera is under water)
bool do_atmospherics = false;
if (dot(vec3(0), waterPlane.xyz) + waterPlane.w > 0.0 ||
dot(pos.xyz, waterPlane.xyz) + waterPlane.w > 0.0)
{
do_atmospherics = true;
}
vec3 irradiance = vec3(0);
vec3 radiance = vec3(0);
if (depth >= 1.0)
{
//should only be true of sky, clouds, sun/moon, and stars
discard;
}
float alpha = 0.0;
if (do_atmospherics)
{
alpha = atten.r;
color = srgb_to_linear(additive*2.0);
color *= sky_hdr_scale;
}
else
{
color = vec3(0,0,0);
alpha = 1.0;
}
frag_color = max(vec4(color.rgb, alpha), vec4(0)); //output linear since local lights will be added to this shader's results
}

View File

@ -37,11 +37,7 @@
uniform float emissive_brightness; // fullbright flag, 1.0 == fullbright, 0.0 otherwise
uniform int sun_up_factor;
#ifdef WATER_FOG
vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit);
#endif
vec3 atmosFragLightingLinear(vec3 l, vec3 additive, vec3 atten);
vec4 applySkyAndWaterFog(vec3 pos, vec3 additive, vec3 atten, vec4 color);
vec3 scaleSoftClipFragLinear(vec3 l);
void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive);
void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist);
@ -386,13 +382,6 @@ void main()
glare += cur_glare;
}
color.rgb = atmosFragLightingLinear(color.rgb, additive, atten);
#ifdef WATER_FOG
vec4 temp = applyWaterFogViewLinear(pos, vec4(color, 0.0), sunlit_linear);
color = temp.rgb;
#endif
vec3 npos = normalize(-pos.xyz);
vec3 light = vec3(0, 0, 0);
@ -408,6 +397,8 @@ void main()
color += light;
color.rgb = applySkyAndWaterFog(pos.xyz, additive, atten, vec4(color, 1.0)).rgb;
glare *= 1.0-emissive;
glare = min(glare, 1.0);
float al = max(diffcol.a, glare) * vertex_color.a;

View File

@ -83,10 +83,6 @@ uniform vec4 waterPlane;
uniform int cube_snapshot;
#ifdef WATER_FOG
vec4 applyWaterFogViewLinear(vec3 pos, vec4 color);
#endif
uniform float sky_hdr_scale;
void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist);
@ -167,18 +163,6 @@ void main()
vec3 sunlit_linear = srgb_to_linear(sunlit);
vec3 amblit_linear = amblit;
bool do_atmospherics = false;
#ifndef WATER_FOG
// when above water, mask off atmospherics below water
if (dot(pos.xyz, waterPlane.xyz) + waterPlane.w > 0.0)
{
do_atmospherics = true;
}
#else
do_atmospherics = true;
#endif
vec3 irradiance = vec3(0);
vec3 radiance = vec3(0);
@ -203,11 +187,6 @@ void main()
vec3 v = -normalize(pos.xyz);
color = pbrBaseLight(diffuseColor, specularColor, metallic, v, norm.xyz, perceptualRoughness, light_dir, sunlit_linear, scol, radiance, irradiance, colorEmissive, ao, additive, atten);
if (do_atmospherics)
{
color = atmosFragLightingLinear(color, additive, atten);
}
}
else if (!GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_ATMOS))
{
@ -273,21 +252,8 @@ void main()
{ // add environment map
applyLegacyEnv(color, legacyenv, spec, pos.xyz, norm.xyz, envIntensity);
}
if (do_atmospherics)
{
color = atmosFragLightingLinear(color, additive, atten);
}
}
#ifdef WATER_FOG
vec4 fogged = applyWaterFogViewLinear(pos.xyz, vec4(color, bloom));
color = fogged.rgb;
#endif
frag_color.rgb = max(color.rgb, vec3(0)); //output linear since local lights will be added to this shader's results
frag_color.a = 0.0;
}

View File

@ -0,0 +1,65 @@
/**
* @file class3/deferred/waterHazeF.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, 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$
*/
out vec4 frag_color;
// Inputs
in vec4 vary_fragcoord;
uniform sampler2D normalMap;
vec4 getPositionWithDepth(vec2 pos_screen, float depth);
float getDepth(vec2 pos_screen);
vec4 getWaterFogView(vec3 pos);
uniform int above_water;
void main()
{
vec2 tc = vary_fragcoord.xy/vary_fragcoord.w*0.5+0.5;
float depth = getDepth(tc.xy);
if (above_water > 0)
{
// we want to depth test when the camera is above water, but some GPUs have a hard time
// with depth testing against render targets that are bound for sampling in the same shader
// so we do it manually here
float cur_depth = vary_fragcoord.z/vary_fragcoord.w*0.5+0.5;
if (cur_depth > depth)
{
discard;
}
}
vec4 pos = getPositionWithDepth(tc, depth);
vec4 norm = texture(normalMap, tc);
vec4 fogged = getWaterFogView(pos.xyz);
frag_color = max(fogged, vec4(0)); //output linear since local lights will be added to this shader's results
}

View File

@ -1,55 +1,59 @@
/**
* @file class1\lighting\lightWaterAlphaMaskNonIndexedF.glsl
/**
* @file class3/deferred/waterHazeV.glsl
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
*
* Copyright (C) 2023, 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$
*/
out vec4 frag_color;
in vec3 position;
uniform float minimum_alpha;
uniform vec2 screen_res;
uniform sampler2D diffuseMap;
out vec4 vary_fragcoord;
vec3 atmosLighting(vec3 light);
vec4 applyWaterFog(vec4 color);
// forwards
void setAtmosAttenuation(vec3 c);
void setAdditiveColor(vec3 c);
in vec4 vertex_color;
in vec2 vary_texcoord0;
uniform vec4 waterPlane;
void default_lighting_water()
uniform int above_water;
uniform mat4 modelview_projection_matrix;
void main()
{
vec4 color = texture(diffuseMap,vary_texcoord0.xy);
//transform vertex
vec4 pos = vec4(position.xyz, 1.0);
if (color.a < minimum_alpha)
{
discard;
}
if (above_water > 0)
{
pos = modelview_projection_matrix*pos;
}
color.rgb *= vertex_color.rgb;
gl_Position = pos;
color.rgb = atmosLighting(color.rgb);
// appease OSX GLSL compiler/linker by touching all the varyings we said we would
setAtmosAttenuation(vec3(1));
setAdditiveColor(vec3(0));
color = applyWaterFog(color);
frag_color = max(color, vec4(0));
vary_fragcoord = pos;
}

View File

@ -30,7 +30,6 @@ uniform sampler2D bumpMap;
#ifdef TRANSPARENT_WATER
uniform sampler2D screenTex;
uniform sampler2D screenDepth;
#endif
uniform vec4 fogCol;
@ -55,7 +54,7 @@ in vec4 littleWave;
in vec4 view;
in vec3 vary_position;
vec4 applyWaterFogViewLinearNoClip(vec3 pos, vec4 color, vec3 sunlit);
vec4 applyWaterFogViewLinearNoClip(vec3 pos, vec4 color);
void main()
{
@ -77,5 +76,7 @@ void main()
vec4 fb = vec4(waterFogColorLinear, 0.0);
#endif
frag_color = max(applyWaterFogViewLinearNoClip(vary_position, fb, vec3(1)), vec4(0));
fb = applyWaterFogViewLinearNoClip(vary_position, fb);
frag_color = max(fb, vec4(0));
}

View File

@ -32,9 +32,8 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);
#endif
vec3 scaleSoftClipFragLinear(vec3 l);
vec3 atmosFragLightingLinear(vec3 light, vec3 additive, vec3 atten);
void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive);
vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit);
vec4 applyWaterFogViewLinear(vec3 pos, vec4 color);
// PBR interface
vec2 BRDF(float NoV, float roughness);
@ -77,7 +76,7 @@ uniform sampler2D bumpMap2;
uniform float blend_factor;
#ifdef TRANSPARENT_WATER
uniform sampler2D screenTex;
uniform sampler2D screenDepth;
uniform sampler2D depthMap;
#endif
uniform sampler2D refTex;
@ -211,7 +210,7 @@ void main()
#ifdef TRANSPARENT_WATER
vec4 fb = texture(screenTex, distort2);
float depth = texture(screenDepth, distort2).r;
float depth = texture(depthMap, distort2).r;
vec3 refPos = getPositionWithNDC(vec3(distort2*2.0-vec2(1.0), depth*2.0-1.0));
if (refPos.z > pos.z-0.05)
@ -219,13 +218,12 @@ void main()
//we sampled an above water sample, don't distort
distort2 = distort;
fb = texture(screenTex, distort2);
depth = texture(screenDepth, distort2).r;
depth = texture(depthMap, distort2).r;
refPos = getPositionWithNDC(vec3(distort2 * 2.0 - vec2(1.0), depth * 2.0 - 1.0));
}
fb = applyWaterFogViewLinear(refPos, fb, sunlit);
#else
vec4 fb = applyWaterFogViewLinear(viewVec*2048.0, vec4(1.0), sunlit_linear);
vec4 fb = applyWaterFogViewLinear(viewVec*2048.0, vec4(1.0));
#endif
// fudge sample on other side of water to be a tad darker
@ -282,8 +280,6 @@ void main()
color = ((1.0 - f) * color) + fb.rgb;
color = atmosFragLightingLinear(color, additive, atten);
float spec = min(max(max(punctual.r, punctual.g), punctual.b), 0.05);
frag_color = max(vec4(color, spec), vec4(0));

View File

@ -283,4 +283,5 @@ void FSPanelPrefs::onResetDefaultFolders()
gSavedPerAccountSettings.getControl("TextureUploadFolder")->resetToDefault(true);
gSavedPerAccountSettings.getControl("SoundUploadFolder")->resetToDefault(true);
gSavedPerAccountSettings.getControl("AnimationUploadFolder")->resetToDefault(true);
gSavedPerAccountSettings.getControl("PBRUploadFolder")->resetToDefault(true);
}

View File

@ -413,10 +413,10 @@ void ll_nvapi_init(NvDRSSessionHandle hSession)
return;
}
// <FS:Ansariel> Enable Threaded Optimization
// enable Threaded Optimization instead of letting the driver decide
status = NvAPI_DRS_GetSetting(hSession, hProfile, OGL_THREAD_CONTROL_ID, &drsSetting);
if (status == NVAPI_SETTING_NOT_FOUND || (status == NVAPI_OK && drsSetting.u32CurrentValue != OGL_THREAD_CONTROL_ENABLE))
{ //only override if the user hasn't specifically set this setting
{
drsSetting.version = NVDRS_SETTING_VER;
drsSetting.settingId = OGL_THREAD_CONTROL_ID;
drsSetting.settingType = NVDRS_DWORD_TYPE;
@ -441,7 +441,6 @@ void ll_nvapi_init(NvDRSSessionHandle hSession)
nvapi_error(status);
return;
}
// </FS:Ansariel>
}
//#define DEBUGGING_SEH_FILTER 1

View File

@ -52,6 +52,8 @@ LLColorSwatchCtrl::Params::Params()
border_color("border_color"),
label_width("label_width", -1),
label_height("label_height", -1),
text_enabled_color("text_enabled_color"), // <FS:Zi> Add label/caption colors
text_disabled_color("text_disabled_color"), // <FS:Zi> Add label/caption colors
caption_text("caption_text"),
border("border")
{
@ -66,6 +68,8 @@ LLColorSwatchCtrl::LLColorSwatchCtrl(const Params& p)
mOnCancelCallback(p.cancel_callback()),
mOnSelectCallback(p.select_callback()),
mBorderColor(p.border_color()),
mTextEnabledColor(p.text_enabled_color), // <FS:Zi> Add label/caption colors
mTextDisabledColor(p.text_disabled_color), // <FS:Zi> Add label/caption colors
mLabelWidth(p.label_width),
mLabelHeight(p.label_height)
{
@ -95,6 +99,8 @@ LLColorSwatchCtrl::LLColorSwatchCtrl(const Params& p)
params.rect(border_rect);
mBorder = LLUICtrlFactory::create<LLViewBorder> (params);
addChild(mBorder);
updateLabelColor(); // <FS:Zi> Add label/caption colors
}
LLColorSwatchCtrl::~LLColorSwatchCtrl ()
@ -250,12 +256,18 @@ void LLColorSwatchCtrl::draw()
}
}
mCaption->setEnabled(getEnabled() && isInEnabledChain()); // <FS:Zi> Add label/caption colors
LLUICtrl::draw();
}
void LLColorSwatchCtrl::setEnabled( BOOL enabled )
{
mCaption->setEnabled( enabled );
// <FS:Zi> Add label/caption colors
// mCaption->setEnabled( enabled );
mCaption->setEnabled(enabled && isInEnabledChain());
// </FS:Zi>
LLView::setEnabled( enabled );
if (!enabled)
@ -374,3 +386,10 @@ void LLColorSwatchCtrl::showPicker(BOOL take_focus)
}
}
// <FS:Zi> Add label/caption colors
void LLColorSwatchCtrl::updateLabelColor()
{
mCaption->setColor(mTextEnabledColor.get());
mCaption->setReadOnlyColor(mTextDisabledColor.get());
}
// </FS:Zi>

View File

@ -62,6 +62,10 @@ public:
Optional<LLTextBox::Params> caption_text;
Optional<LLViewBorder::Params> border;
Optional<LLUIColor> text_enabled_color; // <FS:Zi> Add label/caption colors
Optional<LLUIColor> text_disabled_color; // <FS:Zi> Add label/caption colors
Params();
};
@ -100,7 +104,12 @@ public:
static void onColorChanged ( void* data, EColorPickOp pick_op = COLOR_CHANGE );
void closeFloaterColorPicker();
void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; updateLabelColor(); } // <FS:Zi> Add label/caption colors
void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; updateLabelColor(); } // <FS:Zi> Add label/caption colors
protected:
void updateLabelColor(); // <FS:Zi> Add label/caption colors
bool mValid;
LLColor4 mColor;
LLUIColor mBorderColor;
@ -116,6 +125,9 @@ protected:
LLPointer<LLUIImage> mAlphaGradientImage;
LLPointer<LLUIImage> mFallbackImage;
LLUIColor mTextEnabledColor; // <FS:Zi> Add label/caption colors
LLUIColor mTextDisabledColor; // <FS:Zi> Add label/caption colors
};
#endif // LL_LLBUTTON_H

View File

@ -320,6 +320,14 @@ void LLFacePool::addFaceReference(LLFace *facep)
}
}
void LLFacePool::pushFaceGeometry()
{
for (LLFace* const& face : mDrawFace)
{
face->renderIndexed();
}
}
BOOL LLFacePool::verify() const
{
BOOL ok = TRUE;

View File

@ -53,7 +53,9 @@ public:
// before grass, so grass should be the first alpha masked pool. Other ordering should be done
// based on fill rate and likelihood to occlude future passes (faster, large occluders first).
//
POOL_SIMPLE = 1,
POOL_SKY = 1,
POOL_WL_SKY,
POOL_SIMPLE,
POOL_FULLBRIGHT,
POOL_BUMP,
POOL_TERRAIN,
@ -64,8 +66,6 @@ public:
POOL_TREE,
POOL_ALPHA_MASK,
POOL_FULLBRIGHT_ALPHA_MASK,
POOL_SKY,
POOL_WL_SKY,
POOL_AVATAR,
POOL_CONTROL_AV, // Animesh
POOL_GLOW,
@ -118,8 +118,8 @@ public:
virtual LLViewerTexture* getTexture() = 0;
virtual BOOL isFacePool() { return FALSE; }
virtual void resetDrawOrders() = 0;
virtual void pushFaceGeometry() {}
protected:
S32 mShaderLevel;
S32 mId;
U32 mType; // Type of draw pool
@ -429,6 +429,9 @@ public:
BOOL isFacePool() { return TRUE; }
// call drawIndexed on every draw face
void pushFaceGeometry();
friend class LLFace;
friend class LLPipeline;
public:

View File

@ -179,27 +179,24 @@ void LLDrawPoolAlpha::renderPostDeferred(S32 pass)
fullbright_shader =
(LLPipeline::sImpostorRender) ? &gDeferredFullbrightAlphaMaskProgram :
(LLPipeline::sUnderWaterRender) ? &gDeferredFullbrightWaterAlphaProgram :
(LLPipeline::sRenderingHUDs) ? &gHUDFullbrightAlphaMaskAlphaProgram :
&gDeferredFullbrightAlphaMaskAlphaProgram;
prepare_alpha_shader(fullbright_shader, true, true, water_sign);
simple_shader =
(LLPipeline::sImpostorRender) ? &gDeferredAlphaImpostorProgram :
(LLPipeline::sUnderWaterRender) ? &gDeferredAlphaWaterProgram :
(LLPipeline::sRenderingHUDs) ? &gHUDAlphaProgram :
&gDeferredAlphaProgram;
prepare_alpha_shader(simple_shader, false, true, water_sign); //prime simple shader (loads shadow relevant uniforms)
LLGLSLShader* materialShader = LLPipeline::sUnderWaterRender ? gDeferredMaterialWaterProgram : gDeferredMaterialProgram;
LLGLSLShader* materialShader = gDeferredMaterialProgram;
for (int i = 0; i < LLMaterial::SHADER_COUNT*2; ++i)
{
prepare_alpha_shader(&materialShader[i], false, true, water_sign);
}
pbr_shader =
(LLPipeline::sUnderWaterRender) ? &gDeferredPBRAlphaWaterProgram :
(LLPipeline::sRenderingHUDs) ? &gHUDPBRAlphaProgram :
&gDeferredPBRAlphaProgram;
@ -755,11 +752,6 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
llassert(mask < LLMaterial::SHADER_COUNT);
target_shader = &(gDeferredMaterialProgram[mask]);
if (LLPipeline::sUnderWaterRender)
{
target_shader = &(gDeferredMaterialWaterProgram[mask]);
}
}
else if (!params.mFullbright)
{

View File

@ -517,14 +517,7 @@ void LLDrawPoolAvatar::beginRigid()
if (gPipeline.shadersLoaded())
{
if (LLPipeline::sUnderWaterRender)
{
sVertexProgram = &gObjectAlphaMaskNoColorWaterProgram;
}
else
{
sVertexProgram = &gObjectAlphaMaskNoColorProgram;
}
sVertexProgram = &gObjectAlphaMaskNoColorProgram;
if (sVertexProgram != NULL)
{ //eyeballs render with the specular shader

View File

@ -82,14 +82,7 @@ void LLDrawPoolMaterials::beginDeferredPass(S32 pass)
U32 idx = shader_idx[pass];
if (LLPipeline::sUnderWaterRender)
{
mShader = &(gDeferredMaterialWaterProgram[idx]);
}
else
{
mShader = &(gDeferredMaterialProgram[idx]);
}
mShader = &(gDeferredMaterialProgram[idx]);
if (rigged)
{

View File

@ -193,10 +193,6 @@ void LLDrawPoolFullbright::renderPostDeferred(S32 pass)
{
shader = &gHUDFullbrightProgram;
}
else if (LLPipeline::sUnderWaterRender)
{
shader = &gDeferredFullbrightWaterProgram;
}
else
{
shader = &gDeferredFullbrightProgram;
@ -225,10 +221,6 @@ void LLDrawPoolFullbrightAlphaMask::renderPostDeferred(S32 pass)
{
shader = &gHUDFullbrightAlphaMaskProgram;
}
else if (LLPipeline::sUnderWaterRender)
{
shader = &gDeferredFullbrightAlphaMaskWaterProgram;
}
else
{
shader = &gDeferredFullbrightAlphaMaskProgram;

View File

@ -212,7 +212,7 @@ void LLDrawPoolWater::renderPostDeferred(S32 pass)
}
}
gPipeline.bindDeferredShader(*shader);
gPipeline.bindDeferredShader(*shader, nullptr, &gPipeline.mWaterDis);
//bind normal map
S32 bumpTex = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP);
@ -244,7 +244,6 @@ void LLDrawPoolWater::renderPostDeferred(S32 pass)
// bind reflection texture from RenderTarget
S32 screentex = shader->enableTexture(LLShaderMgr::WATER_SCREENTEX);
S32 screenDepth = shader->enableTexture(LLShaderMgr::WATER_SCREENDEPTH);
F32 screenRes[] = { 1.f / gGLViewport[2], 1.f / gGLViewport[3] };
@ -261,11 +260,6 @@ void LLDrawPoolWater::renderPostDeferred(S32 pass)
gGL.getTexUnit(screentex)->bind(&gPipeline.mWaterDis);
}
if (screenDepth > -1)
{
gGL.getTexUnit(screenDepth)->bind(&gPipeline.mWaterDis, true);
}
if (mShaderLevel == 1)
{
fog_color.mV[VW] = log(fog_density) / log(2);
@ -348,7 +342,6 @@ void LLDrawPoolWater::renderPostDeferred(S32 pass)
shader->disableTexture(LLShaderMgr::BUMP_MAP);
shader->disableTexture(LLShaderMgr::DIFFUSE_MAP);
shader->disableTexture(LLShaderMgr::WATER_REFTEX);
shader->disableTexture(LLShaderMgr::WATER_SCREENDEPTH);
// clean up
gPipeline.unbindDeferredShader(*shader);

View File

@ -87,6 +87,9 @@ void LLDrawPoolWLSky::endDeferredPass(S32 pass)
cloud_shader = nullptr;
sun_shader = nullptr;
moon_shader = nullptr;
// clear the depth buffer so haze shaders can use unwritten depth as a mask
glClear(GL_DEPTH_BUFFER_BIT);
}
void LLDrawPoolWLSky::renderDome(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader * shader) const

View File

@ -117,6 +117,7 @@ namespace Details
void LLEventPollImpl::handleMessage(const LLSD& content)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_APP;
std::string msg_name = content["message"];
LLSD message;
message["sender"] = mSenderIp;
@ -171,6 +172,14 @@ namespace Details
mAdapter = httpAdapter;
LL::WorkQueue::ptr_t main_queue = nullptr;
// HACK -- grab the mainloop workqueue to move execution of the handler
// to a place that's safe in the main thread
#if 1
main_queue = LL::WorkQueue::getInstance("mainloop");
#endif
// continually poll for a server update until we've been flagged as
// finished
while (!mDone)
@ -302,13 +311,26 @@ namespace Details
// was LL_INFOS() but now that CoarseRegionUpdate is TCP @ 1/second, it'd be too verbose for viewer logs. -MG
LL_DEBUGS("LLEventPollImpl") << " <" << counter << "> " << events.size() << "events (id " << acknowledge << ")" << LL_ENDL;
LLSD::array_const_iterator i = events.beginArray();
LLSD::array_const_iterator end = events.endArray();
for (; i != end; ++i)
{
if (i->has("message"))
{
handleMessage(*i);
if (main_queue)
{ // shuttle to a sensible spot in the main thread instead
// of wherever this coroutine happens to be executing
const LLSD& msg = *i;
main_queue->post([this, msg]()
{
handleMessage(msg);
});
}
else
{
handleMessage(*i);
}
}
}
}

View File

@ -1995,7 +1995,18 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
while (src < end)
{
LLVector4a normal;
// <FS:Zi> GCC12 warning: maybe-uninitialized - probably bogus
#if defined(__GNUC__) && (__GNUC__ >= 12)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
// </FS:Zi>
mat_normal.rotate(*src++, normal);
// <FS:Zi> GCC12 warning: maybe-uninitialized - probably bogus
#if defined(__GNUC__) && (__GNUC__ >= 12)
#pragma GCC diagnostic pop
#endif
// </FS:Zi>
normal.store4a(normals);
normals += 4;
}

View File

@ -1223,9 +1223,20 @@ void LLFastTimerView::drawLegend()
S32 scroll_offset = 0; // element's y offset from top of the inner scroll's rect
ft_display_idx.clear();
std::map<BlockTimerStatHandle*, S32> display_line;
// <FS:Zi> GCC12 warning: nonnull - probably bogus
#if defined(__GNUC__) && (__GNUC__ >= 12)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnonnull"
#endif
// </FS:Zi>
for (LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME);
it != LLTrace::end_block_timer_tree_df();
++it)
// <FS:Zi> GCC12 warning: nonnull - probably bogus
#if defined(__GNUC__) && (__GNUC__ >= 12)
#pragma GCC diagnostic pop
#endif
// </FS:Zi>
{
BlockTimerStatHandle* idp = (*it);
// Needed to figure out offsets and parenting
@ -1338,10 +1349,20 @@ void LLFastTimerView::generateUniqueColors()
sTimerColors[FTM_FRAME.getIndex()] = LLColor4::grey;
F32 hue = 0.f;
// <FS:Zi> GCC12 warning: nonnull - probably bogus
#if defined(__GNUC__) && (__GNUC__ >= 12)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnonnull"
#endif
// </FS:Zi>
for (LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME);
it != LLTrace::end_block_timer_tree_df();
++it)
// <FS:Zi> GCC12 warning: nonnull - probably bogus
#if defined(__GNUC__) && (__GNUC__ >= 12)
#pragma GCC diagnostic pop
#endif
// </FS:Zi>
{
BlockTimerStatHandle* idp = (*it);

View File

@ -29,6 +29,8 @@
#include "llviewertexturelist.h"
#include "llavatarappearancedefines.h"
#include "llviewerobject.h"
#include "llselectmgr.h"
#include "llshadermgr.h"
#include "pipeline.h"
@ -252,3 +254,55 @@ void LLFetchedGLTFMaterial::materialComplete()
materialCompleteCallbacks.clear();
materialCompleteCallbacks.shrink_to_fit();
}
LLPointer<LLViewerFetchedTexture> LLFetchedGLTFMaterial::getUITexture()
{
if (mFetching)
{
return nullptr;
}
auto fetch_texture_for_ui = [](LLPointer<LLViewerFetchedTexture>& img, const LLUUID& id)
{
if (id.notNull())
{
if (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(id))
{
LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
if (obj)
{
LLViewerTexture* viewerTexture = obj->getBakedTextureForMagicId(id);
img = viewerTexture ? dynamic_cast<LLViewerFetchedTexture*>(viewerTexture) : NULL;
}
}
else
{
img = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
}
}
if (img)
{
img->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
img->forceToSaveRawImage(0);
}
};
fetch_texture_for_ui(mBaseColorTexture, mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR]);
fetch_texture_for_ui(mNormalTexture, mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL]);
fetch_texture_for_ui(mMetallicRoughnessTexture, mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS]);
fetch_texture_for_ui(mEmissiveTexture, mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE]);
if ((mBaseColorTexture && (mBaseColorTexture->getRawImageLevel() != 0)) ||
(mNormalTexture && (mNormalTexture->getRawImageLevel() != 0)) ||
(mMetallicRoughnessTexture && (mMetallicRoughnessTexture->getRawImageLevel() != 0)) ||
(mEmissiveTexture && (mEmissiveTexture->getRawImageLevel() != 0)))
{
return nullptr;
}
// *HACK: Use one of the PBR texture components as the preview texture for now
mPreviewTexture = mBaseColorTexture;
return mPreviewTexture;
}

View File

@ -50,6 +50,8 @@ public:
bool isFetching() const { return mFetching; }
LLPointer<LLViewerFetchedTexture> getUITexture();
void addTextureEntry(LLTextureEntry* te) override;
void removeTextureEntry(LLTextureEntry* te) override;
virtual bool replaceLocalTexture(const LLUUID& tracking_id, const LLUUID& old_id, const LLUUID& new_id) override;
@ -63,6 +65,9 @@ public:
std::set<LLTextureEntry*> mTextureEntires;
// Texture used for previewing the material in the UI
LLPointer<LLViewerFetchedTexture> mPreviewTexture;
protected:
// Lifetime management

View File

@ -33,7 +33,6 @@
#include "llagent.h"
#include "llpanel.h"
#include "llbutton.h"
#include "llcolorswatch.h"
#include "llcombobox.h"
#include "llview.h"
#include "llbufferstream.h"

View File

@ -49,7 +49,7 @@
// [/RLVa:KB]
// PoundLife - Improved Object Inspect
#include "llresmgr.h"
#include "lltexturectrl.h"
#include "lltextbase.h"
#include "llviewerobjectlist.h" //gObjectList
#include "llviewertexturelist.h"
// PoundLife END

View File

@ -206,7 +206,7 @@ void LLFloaterSnapshotBase::ImplBase::updateLayout(LLFloaterSnapshotBase* floate
// }
//}
previewp->setFixedThumbnailSize(panel_width, 400);
previewp->setFixedThumbnailSize(panel_width, 420);
LLUICtrl* thumbnail_placeholder = floaterp->getChild<LLUICtrl>("thumbnail_placeholder");
floaterp->getChild<LLUICtrl>("image_res_text")->setVisible(mAdvanced);
floaterp->getChild<LLUICtrl>("file_size_label")->setVisible(mAdvanced);
@ -221,12 +221,12 @@ void LLFloaterSnapshotBase::ImplBase::updateLayout(LLFloaterSnapshotBase* floate
{
LLRect cc_rect = controls_container->getRect();
floaterp->reshape(floater_width, 463);
floaterp->reshape(floater_width, 483);
controls_container->setRect(cc_rect);
controls_container->updateBoundingRect();
thumbnail_placeholder->reshape(panel_width, 400);
thumbnail_placeholder->reshape(panel_width, 420);
LLRect tn_rect = thumbnail_placeholder->getRect();
tn_rect.setLeftTopAndSize(215, floaterp->getRect().getHeight() - 30, tn_rect.getWidth(), tn_rect.getHeight());
@ -240,7 +240,7 @@ void LLFloaterSnapshotBase::ImplBase::updateLayout(LLFloaterSnapshotBase* floate
{
LLRect cc_rect = controls_container->getRect();
floaterp->reshape(floater_width, 593);
floaterp->reshape(floater_width, 613);
controls_container->setRect(cc_rect);
controls_container->updateBoundingRect();
@ -547,8 +547,8 @@ void LLFloaterSnapshotBase::ImplBase::onClickAutoSnap(LLUICtrl *ctrl, void* data
{
LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;
gSavedSettings.setBOOL( "AutoSnapshot", check->get() );
LLFloaterSnapshotBase *view = (LLFloaterSnapshotBase *)data;
LLFloaterSnapshotBase *view = (LLFloaterSnapshotBase *)data;
if (view)
{
view->impl->checkAutoSnapshot(view->getPreviewView());
@ -556,6 +556,17 @@ void LLFloaterSnapshotBase::ImplBase::onClickAutoSnap(LLUICtrl *ctrl, void* data
}
}
// static
void LLFloaterSnapshotBase::ImplBase::onClickNoPost(LLUICtrl *ctrl, void* data)
{
BOOL no_post = ((LLCheckBoxCtrl*)ctrl)->get();
gSavedSettings.setBOOL("RenderSnapshotNoPost", no_post);
LLFloaterSnapshotBase* view = (LLFloaterSnapshotBase*)data;
view->getPreviewView()->updateSnapshot(TRUE, TRUE);
view->impl->updateControls(view);
}
// static
void LLFloaterSnapshotBase::ImplBase::onClickFilter(LLUICtrl *ctrl, void* data)
{
@ -1134,6 +1145,9 @@ BOOL LLFloaterSnapshot::postBuild()
getChild<LLUICtrl>("auto_snapshot_check")->setValue(gSavedSettings.getBOOL("AutoSnapshot"));
childSetCommitCallback("auto_snapshot_check", ImplBase::onClickAutoSnap, this);
getChild<LLUICtrl>("no_post_check")->setValue(gSavedSettings.getBOOL("RenderSnapshotNoPost"));
childSetCommitCallback("no_post_check", ImplBase::onClickNoPost, this);
getChild<LLButton>("retract_btn")->setCommitCallback(boost::bind(&LLFloaterSnapshot::onExtendFloater, this));
getChild<LLButton>("extend_btn")->setCommitCallback(boost::bind(&LLFloaterSnapshot::onExtendFloater, this));

View File

@ -100,6 +100,7 @@ public:
static void onClickNewSnapshot(void* data);
static void onClickAutoSnap(LLUICtrl *ctrl, void* data);
static void onClickNoPost(LLUICtrl *ctrl, void* data);
static void onClickFilter(LLUICtrl *ctrl, void* data);
static void onClickUICheck(LLUICtrl *ctrl, void* data);
static void onClickHUDCheck(LLUICtrl *ctrl, void* data);

View File

@ -1611,6 +1611,10 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask)
{
mask |= LLInventoryObserver::LABEL;
}
if (old_item->getPermissions() != item->getPermissions())
{
mask |= LLInventoryObserver::INTERNAL;
}
old_item->copyViewerItem(item);
if (update_parent_on_server)
{

View File

@ -38,6 +38,7 @@
#include "llgltfmateriallist.h"
#include "llinventorymodel.h"
#include "llinventoryobserver.h"
#include "llinventoryfunctions.h"
#include "lllocalgltfmaterials.h"
#include "llnotificationsutil.h"
#include "lltexturectrl.h"
@ -438,10 +439,10 @@ BOOL LLMaterialEditor::postBuild()
if (!gAgent.isGodlike())
{
// Only allow fully permissive textures
mBaseColorTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
mMetallicTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
mEmissiveTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
mNormalTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
mBaseColorTextureCtrl->setFilterPermissionMasks(PERM_COPY | PERM_TRANSFER);
mMetallicTextureCtrl->setFilterPermissionMasks(PERM_COPY | PERM_TRANSFER);
mEmissiveTextureCtrl->setFilterPermissionMasks(PERM_COPY | PERM_TRANSFER);
mNormalTextureCtrl->setFilterPermissionMasks(PERM_COPY | PERM_TRANSFER);
}
// Texture callback
@ -1498,16 +1499,22 @@ public:
return;
}
// Name may or may not have already been applied
const bool changed_name = item->getName() != mNewName;
// create_inventory_item/copy_inventory_item don't allow presetting some permissions, fix it now
item->setPermissions(mPermissions);
item->updateServer(FALSE);
gInventory.updateItem(item);
gInventory.notifyObservers();
if (item->getName() != mNewName)
const bool changed_permissions = item->getPermissions() != mPermissions;
const bool changed = changed_name || changed_permissions;
LLSD updates;
if (changed)
{
LLSD updates;
updates["name"] = mNewName;
if (changed_name)
{
updates["name"] = mNewName;
}
if (changed_permissions)
{
updates["permissions"] = ll_create_sd_from_permissions(mPermissions);
}
update_inventory_item(inv_item_id, updates, NULL);
}
@ -1517,10 +1524,16 @@ public:
inv_item_id,
LLAssetType::AT_MATERIAL,
mAssetData,
[](LLUUID item_id, LLUUID new_asset_id, LLUUID new_item_id, LLSD response)
[changed, updates](LLUUID item_id, LLUUID new_asset_id, LLUUID new_item_id, LLSD response)
{
// done callback
LL_INFOS("Material") << "inventory item uploaded. item: " << item_id << " new_item_id: " << new_item_id << " response: " << response << LL_ENDL;
// *HACK: Sometimes permissions do not stick in the UI. They are correct on the server-side, though.
if (changed)
{
update_inventory_item(new_item_id, updates, NULL);
}
},
nullptr // failure callback, floater already closed
);
@ -2017,8 +2030,49 @@ void LLMaterialEditor::loadLive()
}
}
namespace
{
// Which inventory to consult for item permissions
enum class ItemSource
{
// Consult the permissions of the item in the object's inventory. If
// the item is not present, then usage of the asset is allowed.
OBJECT,
// Consult the permissions of the item in the agent's inventory. If
// the item is not present, then usage of the asset is not allowed.
AGENT
};
class LLAssetIDMatchesWithPerms : public LLInventoryCollectFunctor
{
public:
LLAssetIDMatchesWithPerms(const LLUUID& asset_id, const std::vector<PermissionBit>& ops) : mAssetID(asset_id), mOps(ops) {}
virtual ~LLAssetIDMatchesWithPerms() {}
bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
if (!item || item->getAssetUUID() != mAssetID)
{
return false;
}
LLPermissions item_permissions = item->getPermissions();
for (PermissionBit op : mOps)
{
if (!gAgent.allowOperation(op, item_permissions, GP_OBJECT_MANIPULATE))
{
return false;
}
}
return true;
}
protected:
LLUUID mAssetID;
std::vector<PermissionBit> mOps;
};
};
// *NOTE: permissions_out includes user preferences for new item creation (LLFloaterPerms)
bool can_use_objects_material(LLSelectedTEGetMatData& func, const std::vector<PermissionBit>& ops, LLPermissions& permissions_out, LLViewerInventoryItem*& item_out)
bool can_use_objects_material(LLSelectedTEGetMatData& func, const std::vector<PermissionBit>& ops, const ItemSource item_source, LLPermissions& permissions_out, LLViewerInventoryItem*& item_out)
{
if (!LLMaterialEditor::capabilitiesAvailable())
{
@ -2031,6 +2085,10 @@ bool can_use_objects_material(LLSelectedTEGetMatData& func, const std::vector<Pe
llassert(func.mIsOverride);
LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, true /*first applicable*/);
if (item_source == ItemSource::AGENT)
{
func.mObjectId = LLUUID::null;
}
LLViewerObject* selected_object = func.mObject;
if (!selected_object)
{
@ -2051,19 +2109,47 @@ bool can_use_objects_material(LLSelectedTEGetMatData& func, const std::vector<Pe
}
}
item_out = selected_object->getInventoryItemByAsset(func.mMaterialId);
// Look for the item to base permissions off of
item_out = nullptr;
const bool blank_material = func.mMaterialId == LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID;
if (!blank_material)
{
LLAssetIDMatchesWithPerms item_has_perms(func.mMaterialId, ops);
if (item_source == ItemSource::OBJECT)
{
LLViewerInventoryItem* item = selected_object->getInventoryItemByAsset(func.mMaterialId);
if (item && !item_has_perms(nullptr, item))
{
return false;
}
item_out = item;
}
else
{
llassert(item_source == ItemSource::AGENT);
LLViewerInventoryCategory::cat_array_t cats;
LLViewerInventoryItem::item_array_t items;
gInventory.collectDescendentsIf(LLUUID::null,
cats,
items,
// *NOTE: PBRPickerAgentListener will need
// to be changed if checking the trash is
// disabled
LLInventoryModel::INCLUDE_TRASH,
item_has_perms);
if (items.empty())
{
return false;
}
item_out = items[0];
}
}
LLPermissions item_permissions;
if (item_out)
{
item_permissions.set(item_out->getPermissions());
for (PermissionBit op : ops)
{
if (!gAgent.allowOperation(op, item_permissions, GP_OBJECT_MANIPULATE))
{
return false;
}
}
item_permissions = item_out->getPermissions();
// Update flags for new owner
if (!item_permissions.setOwnerAndGroup(LLUUID::null, gAgent.getID(), LLUUID::null, true))
{
@ -2116,13 +2202,24 @@ bool can_use_objects_material(LLSelectedTEGetMatData& func, const std::vector<Pe
// creation history when there's no material item present. In that case,
// the agent who saved the material will be considered the creator.
// -Cosmic,2023-08-07
if (item_out)
if (item_source == ItemSource::AGENT)
{
llassert(blank_material || item_out); // See comment at ItemSource::AGENT definition
permissions_out.set(item_permissions);
}
else
{
permissions_out.set(object_permissions);
llassert(item_source == ItemSource::OBJECT);
if (item_out)
{
permissions_out.set(item_permissions);
}
else
{
permissions_out.set(object_permissions);
}
}
permissions_out.accumulate(floater_perm);
@ -2134,7 +2231,7 @@ bool LLMaterialEditor::canModifyObjectsMaterial()
LLSelectedTEGetMatData func(true);
LLPermissions permissions;
LLViewerInventoryItem* item_out;
return can_use_objects_material(func, std::vector({PERM_MODIFY}), permissions, item_out);
return can_use_objects_material(func, std::vector({PERM_MODIFY}), ItemSource::OBJECT, permissions, item_out);
}
bool LLMaterialEditor::canSaveObjectsMaterial()
@ -2142,7 +2239,7 @@ bool LLMaterialEditor::canSaveObjectsMaterial()
LLSelectedTEGetMatData func(true);
LLPermissions permissions;
LLViewerInventoryItem* item_out;
return can_use_objects_material(func, std::vector({PERM_COPY, PERM_MODIFY}), permissions, item_out);
return can_use_objects_material(func, std::vector({PERM_COPY, PERM_MODIFY}), ItemSource::AGENT, permissions, item_out);
}
bool LLMaterialEditor::canClipboardObjectsMaterial()
@ -2168,7 +2265,7 @@ bool LLMaterialEditor::canClipboardObjectsMaterial()
LLSelectedTEGetMatData func(true);
LLPermissions permissions;
LLViewerInventoryItem* item_out;
return can_use_objects_material(func, std::vector({PERM_COPY, PERM_MODIFY, PERM_TRANSFER}), permissions, item_out);
return can_use_objects_material(func, std::vector({PERM_COPY, PERM_MODIFY, PERM_TRANSFER}), ItemSource::OBJECT, permissions, item_out);
}
void LLMaterialEditor::saveObjectsMaterialAs()
@ -2176,7 +2273,7 @@ void LLMaterialEditor::saveObjectsMaterialAs()
LLSelectedTEGetMatData func(true);
LLPermissions permissions;
LLViewerInventoryItem* item = nullptr;
bool allowed = can_use_objects_material(func, std::vector({PERM_COPY, PERM_MODIFY}), permissions, item);
bool allowed = can_use_objects_material(func, std::vector({PERM_COPY, PERM_MODIFY}), ItemSource::AGENT, permissions, item);
if (!allowed)
{
LL_WARNS("MaterialEditor") << "Failed to save GLTF material from object" << LL_ENDL;
@ -2271,64 +2368,11 @@ void LLMaterialEditor::saveObjectsMaterialAs(const LLGLTFMaterial* render_materi
}
else
{
if (item_id.notNull())
{
// Copy existing item from object inventory, and create new composite asset on top of it
LLNotificationsUtil::add("SaveMaterialAs", args, payload, boost::bind(&LLMaterialEditor::onCopyObjectsMaterialAsMsgCallback, _1, _2, permissions, object_id, item_id));
}
else
{
LLNotificationsUtil::add("SaveMaterialAs", args, payload, boost::bind(&LLMaterialEditor::onSaveObjectsMaterialAsMsgCallback, _1, _2, permissions));
}
llassert(object_id.isNull()); // Case for copying item from object inventory is no longer implemented
LLNotificationsUtil::add("SaveMaterialAs", args, payload, boost::bind(&LLMaterialEditor::onSaveObjectsMaterialAsMsgCallback, _1, _2, permissions));
}
}
// static
void LLMaterialEditor::onCopyObjectsMaterialAsMsgCallback(const LLSD& notification, const LLSD& response, const LLPermissions& permissions, const LLUUID& object_id, const LLUUID& item_id)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (0 != option)
{
return;
}
LLSD asset;
asset["version"] = LLGLTFMaterial::ASSET_VERSION;
asset["type"] = LLGLTFMaterial::ASSET_TYPE;
// This is the string serialized from LLGLTFMaterial::asJSON
asset["data"] = notification["payload"]["data"];
std::ostringstream str;
LLSDSerialize::serialize(asset, str, LLSDSerialize::LLSD_BINARY);
LLViewerObject* object = gObjectList.findObject(object_id);
if (!object)
{
return;
}
const LLInventoryItem* item = object->getInventoryItem(item_id);
if (!item)
{
return;
}
std::string new_name = response["message"].asString();
LLInventoryObject::correctInventoryName(new_name);
if (new_name.empty())
{
return;
}
const LLUUID destination_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MATERIAL);
LLPointer<LLInventoryCallback> cb = new LLObjectsMaterialItemCallback(permissions, str.str(), new_name);
// NOTE: This should be an item copy. Saving a material to an inventory should be disabled when the associated material is no-copy.
move_or_copy_inventory_from_object(destination_id,
object_id,
item_id,
cb);
}
// static
void LLMaterialEditor::onSaveObjectsMaterialAsMsgCallback(const LLSD& notification, const LLSD& response, const LLPermissions& permissions)
{

View File

@ -117,7 +117,6 @@ class LLMaterialEditor : public LLPreview, public LLVOInventoryListener
static bool canSaveObjectsMaterial();
static bool canClipboardObjectsMaterial();
static void saveObjectsMaterialAs();
static void onCopyObjectsMaterialAsMsgCallback(const LLSD& notification, const LLSD& response, const LLPermissions& permissions, const LLUUID& object_id, const LLUUID& item_id);
static void onSaveObjectsMaterialAsMsgCallback(const LLSD& notification, const LLSD& response, const LLPermissions& permissions);
static void onLoadComplete(const LLUUID& asset_uuid, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status);

View File

@ -1217,7 +1217,21 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
prev_obj_id = objectp->getID();
}
}
else
{
if (prev_obj_id != objectp->getID())
{
if (has_pbr_material && (mComboMatMedia->getCurrentIndex() == MATMEDIA_MATERIAL))
{
mComboMatMedia->selectNthItem(MATMEDIA_PBR);
}
else if (!has_pbr_material && (mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR))
{
mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL);
}
prev_obj_id = objectp->getID();
}
}
mComboMatMedia->setEnabled(editable);
//LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type");
@ -2044,15 +2058,53 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
}
}
// One-off listener that updates the build floater UI when the agent inventory adds or removes an item
class PBRPickerAgentListener : public LLInventoryObserver
{
protected:
bool mChangePending = true;
public:
PBRPickerAgentListener() : LLInventoryObserver()
{
gInventory.addObserver(this);
}
const bool isListening()
{
return mChangePending;
}
void changed(U32 mask) override
{
if (!(mask & (ADD | REMOVE)))
{
return;
}
if (gFloaterTools)
{
gFloaterTools->dirty();
}
gInventory.removeObserver(this);
mChangePending = false;
}
~PBRPickerAgentListener() override
{
gInventory.removeObserver(this);
mChangePending = false;
}
};
// One-off listener that updates the build floater UI when the prim inventory updates
class PBRPickerItemListener : public LLVOInventoryListener
class PBRPickerObjectListener : public LLVOInventoryListener
{
protected:
LLViewerObject* mObjectp;
bool mChangePending = true;
public:
PBRPickerItemListener(LLViewerObject* object)
PBRPickerObjectListener(LLViewerObject* object)
: mObjectp(object)
{
registerVOInventoryListener(mObjectp, nullptr);
@ -2076,7 +2128,7 @@ public:
mChangePending = false;
}
~PBRPickerItemListener()
~PBRPickerObjectListener()
{
removeVOInventoryListener();
mChangePending = false;
@ -2095,9 +2147,9 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material,
// pbr material
LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control");
LLUUID pbr_id;
if (pbr_ctrl)
{
LLUUID pbr_id;
LLSelectedTE::getPbrMaterialId(pbr_id, identical_pbr, has_pbr_material, has_faces_without_pbr);
pbr_ctrl->setTentative(identical_pbr ? FALSE : TRUE);
@ -2106,7 +2158,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material,
if (objectp->isAttachment())
{
pbr_ctrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER | PERM_MODIFY);
pbr_ctrl->setFilterPermissionMasks(PERM_COPY | PERM_TRANSFER | PERM_MODIFY);
}
else
{
@ -2120,14 +2172,25 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material,
if (objectp->isInventoryPending())
{
// Reuse the same listener when possible
if (!mInventoryListener || !mInventoryListener->isListeningFor(objectp))
if (!mVOInventoryListener || !mVOInventoryListener->isListeningFor(objectp))
{
mInventoryListener = std::make_unique<PBRPickerItemListener>(objectp);
mVOInventoryListener = std::make_unique<PBRPickerObjectListener>(objectp);
}
}
else
{
mInventoryListener = nullptr;
mVOInventoryListener = nullptr;
}
if (!identical_pbr || pbr_id.isNull() || pbr_id == LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID)
{
mAgentInventoryListener = nullptr;
}
else
{
if (!mAgentInventoryListener || !mAgentInventoryListener->isListening())
{
mAgentInventoryListener = std::make_unique<PBRPickerAgentListener>();
}
}
const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled();
@ -4411,6 +4474,7 @@ void LLPanelFace::onCopyTexture()
te_data["te"]["bumpmap"] = tep->getBumpmap();
te_data["te"]["bumpshiny"] = tep->getBumpShiny();
te_data["te"]["bumpfullbright"] = tep->getBumpShinyFullbright();
te_data["te"]["texgen"] = tep->getTexGen();
te_data["te"]["pbr"] = objectp->getRenderMaterialID(te);
if (tep->getGLTFMaterialOverride() != nullptr)
{
@ -4806,6 +4870,11 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te)
{
objectp->setTEBumpShinyFullbright(te, (U8)te_data["te"]["bumpfullbright"].asInteger());
}
if (te_data["te"].has("texgen"))
{
objectp->setTETexGen(te, (U8)te_data["te"]["texgen"].asInteger());
}
// PBR/GLTF
if (te_data["te"].has("pbr"))
{
@ -4874,8 +4943,6 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te)
{
LLUUID object_id = objectp->getID();
LLSelectedTEMaterial::setAlphaMaskCutoff(this, (U8)te_data["material"]["SpecRot"].asInteger(), te, object_id);
// Normal
// Replace placeholders with target's
if (te_data["material"].has("NormMapNoCopy"))
@ -4921,7 +4988,8 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te)
LLSelectedTEMaterial::setSpecularLightColor(this, spec_color, te);
LLSelectedTEMaterial::setSpecularLightExponent(this, (U8)te_data["material"]["SpecExp"].asInteger(), te, object_id);
LLSelectedTEMaterial::setEnvironmentIntensity(this, (U8)te_data["material"]["EnvIntensity"].asInteger(), te, object_id);
LLSelectedTEMaterial::setDiffuseAlphaMode(this, (U8)te_data["material"]["SpecRot"].asInteger(), te, object_id);
LLSelectedTEMaterial::setDiffuseAlphaMode(this, (U8)te_data["material"]["DiffuseAlphaMode"].asInteger(), te, object_id);
LLSelectedTEMaterial::setAlphaMaskCutoff(this, (U8)te_data["material"]["AlphaMaskCutoff"].asInteger(), te, object_id);
if (te_data.has("te") && te_data["te"].has("shiny"))
{
objectp->setTEShiny(te, (U8)te_data["te"]["shiny"].asInteger());

View File

@ -54,7 +54,8 @@ class LLMaterialID;
class LLMediaCtrl;
class LLMenuButton;
class PBRPickerItemListener;
class PBRPickerAgentListener;
class PBRPickerObjectListener;
// Represents an edit for use in replicating the op across one or more materials in the selection set.
//
@ -573,7 +574,8 @@ private:
static Selection sMaterialOverrideSelection;
std::unique_ptr<PBRPickerItemListener> mInventoryListener;
std::unique_ptr<PBRPickerAgentListener> mAgentInventoryListener;
std::unique_ptr<PBRPickerObjectListener> mVOInventoryListener;
public:
#if defined(DEF_GET_MAT_STATE)

View File

@ -206,8 +206,8 @@ LLPanelMainInventory::LLPanelMainInventory(const LLPanel::Params& p)
mFilterMap["filter_type_sounds"] = 0x01 << LLInventoryType::IT_SOUND;
mFilterMap["filter_type_textures"] = 0x01 << LLInventoryType::IT_TEXTURE;
mFilterMap["filter_type_snapshots"] = 0x01 << LLInventoryType::IT_SNAPSHOT;
mFilterMap["filter_type_meshes"] = 0x01 << LLInventoryType::IT_MESH;
mFilterMap["filter_type_settings"] = 0x01 << LLInventoryType::IT_SETTINGS;
mFilterMap["filter_type_materials"] = 0x01 << LLInventoryType::IT_MATERIAL;
// initialize empty filter mask
mFilterMask = 0;

View File

@ -42,7 +42,6 @@
#include "llbutton.h"
#include "llcalc.h"
#include "llcheckboxctrl.h"
#include "llcolorswatch.h"
#include "llcombobox.h"
#include "llfocusmgr.h"
#include "llmanipscale.h"

View File

@ -40,7 +40,6 @@ class LLButton;
class LLMenuButton;
class LLViewerObject;
class LLComboBox;
class LLColorSwatchCtrl;
class LLTextureCtrl;
class LLInventoryItem;
class LLUUID;

View File

@ -764,6 +764,14 @@ void LLPanelVolume::sendIsLight()
LL_INFOS() << "update light sent" << LL_ENDL;
}
void notify_cant_select_reflection_probe()
{
if (!gSavedSettings.getBOOL("SelectReflectionProbes"))
{
LLNotificationsUtil::add("CantSelectReflectionProbe");
}
}
void LLPanelVolume::sendIsReflectionProbe()
{
LLViewerObject* objectp = mObject;
@ -782,6 +790,20 @@ void LLPanelVolume::sendIsReflectionProbe()
}
else
{
if (value)
{
notify_cant_select_reflection_probe();
}
else if (objectp->flagPhantom())
{
LLViewerObject* root = objectp->getRootEdit();
bool in_linkeset = root != objectp || objectp->numChildren() > 0;
if (in_linkeset)
{
// In linkset with a phantom flag
objectp->setFlags(FLAGS_PHANTOM, FALSE);
}
}
volobjp->setIsReflectionProbe(value);
}
}
@ -798,6 +820,7 @@ void LLPanelVolume::doSendIsReflectionProbe(const LLSD & notification, const LLS
}
LLVOVolume* volobjp = (LLVOVolume*)objectp;
notify_cant_select_reflection_probe();
volobjp->setIsReflectionProbe(true);
{ // has become a reflection probe, slam to a 10m sphere and pop up a message
@ -1257,6 +1280,17 @@ void LLPanelVolume::onPasteLight()
}
else
{
if (objectp->flagPhantom())
{
LLViewerObject* root = objectp->getRootEdit();
bool in_linkeset = root != objectp || objectp->numChildren() > 0;
if (in_linkeset)
{
// In linkset with a phantom flag
objectp->setFlags(FLAGS_PHANTOM, FALSE);
}
}
volobjp->setIsReflectionProbe(false);
}
}

View File

@ -167,7 +167,16 @@ void LLReflectionMap::autoAdjustOrigin()
{
mPriority = 1;
mOrigin.load3(mViewerObject->getPositionAgent().mV);
mRadius = mViewerObject->getScale().mV[0]*0.5f;
if (mViewerObject->getVolume() && ((LLVOVolume*)mViewerObject)->getReflectionProbeIsBox())
{
LLVector3 s = mViewerObject->getScale().scaledVec(LLVector3(0.5f, 0.5f, 0.5f));
mRadius = s.magVec();
}
else
{
mRadius = mViewerObject->getScale().mV[0] * 0.5f;
}
}
}

View File

@ -252,14 +252,12 @@ void LLReflectionMapManager::update()
continue;
}
if (probe != mDefaultProbe &&
if (probe != mDefaultProbe &&
(!probe->isRelevant() || mPaused))
{ // skip irrelevant probes (or all non-default probes if paused)
continue;
}
LLVector4a d;
if (probe != mDefaultProbe)
@ -999,10 +997,21 @@ void LLReflectionMapManager::updateUniforms()
llassert(refmap->mCubeIndex >= 0); // should always be true, if not, getReflectionMaps is bugged
{
if (refmap->mViewerObject)
if (refmap->mViewerObject && refmap->mViewerObject->getVolume())
{ // have active manual probes live-track the object they're associated with
refmap->mOrigin.load3(refmap->mViewerObject->getPositionAgent().mV);
refmap->mRadius = refmap->mViewerObject->getScale().mV[0] * 0.5f;
LLVOVolume* vobj = (LLVOVolume*)refmap->mViewerObject;
refmap->mOrigin.load3(vobj->getPositionAgent().mV);
if (vobj->getReflectionProbeIsBox())
{
LLVector3 s = vobj->getScale().scaledVec(LLVector3(0.5f, 0.5f, 0.5f));
refmap->mRadius = s.magVec();
}
else
{
refmap->mRadius = refmap->mViewerObject->getScale().mV[0] * 0.5f;
}
}
modelview.affineTransform(refmap->mOrigin, oa);

View File

@ -63,6 +63,7 @@
#include <boost/algorithm/string/replace.hpp>
#include "llinventoryobserver.h"
#include "llinventorydefines.h"
#include "llworld.h"
#include "lltrans.h"
@ -983,12 +984,21 @@ void LLSettingsVOWater::applySpecial(void *ptarget, bool force)
LLEnvironment& env = LLEnvironment::instance();
auto group = LLGLSLShader::SG_WATER;
auto group = LLGLSLShader::SG_ANY;
LLShaderUniforms* shader = &((LLShaderUniforms*)ptarget)[group];
{
F32 water_height = env.getWaterHeight();
if (LLViewerCamera::instance().cameraUnderWater())
{ // when the camera is under water, use the water height at the camera position
LLViewerRegion* region = LLWorld::instance().getRegionFromPosAgent(LLViewerCamera::instance().getOrigin());
if (region)
{
water_height = region->getWaterHeight();
}
}
//transform water plane to eye space
glh::vec3f norm(0.f, 0.f, 1.f);
glh::vec3f p(0.f, 0.f, water_height);

View File

@ -672,6 +672,7 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update)
mAllowRenderUI && gSavedSettings.getBOOL("RenderUIInSnapshot"),
gSavedSettings.getBOOL("RenderHUDInSnapshot"),
FALSE,
gSavedSettings.getBOOL("RenderSnapshotNoPost"),
mSnapshotBufferType) )
{
raw = NULL ;
@ -831,6 +832,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
previewp->mAllowRenderUI && gSavedSettings.getBOOL("RenderUIInSnapshot"),
gSavedSettings.getBOOL("RenderHUDInSnapshot"),
FALSE,
gSavedSettings.getBOOL("RenderSnapshotNoPost"),
previewp->mSnapshotBufferType,
previewp->getMaxImageSize()))
{

View File

@ -70,6 +70,9 @@ bool LLSpatialGroup::sNoDelete = false;
static F32 sLastMaxTexPriority = 1.f;
static F32 sCurMaxTexPriority = 1.f;
// enable expensive sanity checks around redundant drawable and group insertion to LLCullResult
#define LL_DEBUG_CULL_RESULT 0
//static counter for frame to switch LOD on
void sg_assert(BOOL expr)
@ -4287,6 +4290,10 @@ void LLCullResult::pushOcclusionGroup(LLSpatialGroup* group)
void LLCullResult::pushDrawableGroup(LLSpatialGroup* group)
{
#if LL_DEBUG_CULL_RESULT
// group must NOT be in the drawble groups list already
llassert(std::find(&mDrawableGroups[0], mDrawableGroupsEnd, group) == mDrawableGroupsEnd);
#endif
if (mDrawableGroupsSize < mDrawableGroupsAllocated)
{
mDrawableGroups[mDrawableGroupsSize] = group;
@ -4301,6 +4308,10 @@ void LLCullResult::pushDrawableGroup(LLSpatialGroup* group)
void LLCullResult::pushDrawable(LLDrawable* drawable)
{
#if LL_DEBUG_CULL_RESULT
// drawable must NOT be in the visible list already
llassert(std::find(&mVisibleList[0], mVisibleListEnd, drawable) == mVisibleListEnd);
#endif
if (mVisibleListSize < mVisibleListAllocated)
{
mVisibleList[mVisibleListSize] = drawable;

View File

@ -784,17 +784,27 @@ void LLFloaterTexturePicker::draw()
// If the floater is focused, don't apply its alpha to the texture (STORM-677).
const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
if( mTexturep )
LLViewerTexture* texture = nullptr;
if (mGLTFMaterial)
{
texture = mGLTFMaterial->getUITexture();
}
else
{
texture = mTexturep.get();
}
if( texture )
{
if( mTexturep->getComponents() == 4 )
if( texture->getComponents() == 4 )
{
gl_rect_2d_checkerboard( interior, alpha );
}
gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha );
gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), texture, UI_VERTEX_COLOR % alpha );
// Pump the priority
mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) );
texture->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) );
}
else if (!mFallbackImage.isNull())
{
@ -1759,6 +1769,8 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p)
mDefaultImageAssetID(p.default_image_id),
mDefaultImageName(p.default_image_name),
mFallbackImage(p.fallback_image),
mTextEnabledColor(p.text_enabled_color), // <FS:Zi> Add label/caption colors
mTextDisabledColor(p.text_disabled_color), // <FS:Zi> Add label/caption colors
// <FS:Ansariel> Mask texture if desired
mIsMasked(FALSE)
{
@ -1774,7 +1786,10 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p)
LLTextBox::Params params(p.caption_text);
params.name(p.label);
params.rect(LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ));
// <FS:Zi> Fix label width
// params.rect(LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ));
params.rect(LLRect( 0, BTN_HEIGHT_SMALL, p.label_width == -1 ? getRect().getWidth() : p.label_width, 0 ));
// <//FS:Zi>
params.initial_value(p.label());
params.follows.flags(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM);
mCaption = LLUICtrlFactory::create<LLTextBox> (params);
@ -1812,6 +1827,8 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p)
addChild(mBorder);
mLoadingPlaceholderString = LLTrans::getString("texture_loading");
updateLabelColor(); // <FS:Zi> Add label/caption colors
}
LLTextureCtrl::~LLTextureCtrl()
@ -1866,6 +1883,12 @@ void LLTextureCtrl::setImmediateFilterPermMask(PermissionMask mask)
}
}
void LLTextureCtrl::setFilterPermissionMasks(PermissionMask mask)
{
setImmediateFilterPermMask(mask);
setDnDFilterPermMask(mask);
}
void LLTextureCtrl::setVisible( BOOL visible )
{
if( !visible )
@ -1896,7 +1919,10 @@ void LLTextureCtrl::setEnabled( BOOL enabled )
closeDependentFloater();
}
mCaption->setEnabled( enabled );
// <FS:Zi> Add label/caption colors
// mCaption->setEnabled( enabled );
mCaption->setEnabled(enabled && isInEnabledChain());
// </FS:Zi>
// <FS:Ansariel> Texture preview mode
//LLView::setEnabled( enabled );
@ -2317,11 +2343,21 @@ void LLTextureCtrl::draw()
if (texture.isNull())
{
texture = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
{
LLPointer<LLFetchedGLTFMaterial> material = gGLTFMaterialList.getMaterial(mImageAssetID);
if (material)
{
texture = material->getUITexture();
}
}
else
{
texture = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
texture->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
texture->forceToSaveRawImage(0);
}
}
texture->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
texture->forceToSaveRawImage(0) ;
mTexturep = texture;
}
@ -2421,6 +2457,8 @@ void LLTextureCtrl::draw()
}
}
mCaption->setEnabled(getEnabled() && isInEnabledChain()); // <FS:Zi> Add label/caption colors
LLUICtrl::draw();
}
@ -2527,7 +2565,10 @@ LLSD LLTextureCtrl::getValue() const
return LLSD(getImageAssetID());
}
// <FS:Zi> Add label/caption colors
void LLTextureCtrl::updateLabelColor()
{
mCaption->setColor(mTextEnabledColor.get());
mCaption->setReadOnlyColor(mTextDisabledColor.get());
}
// </FS:Zi>

View File

@ -115,6 +115,9 @@ public:
Optional<LLViewBorder::Params> border;
Optional<bool> show_caption; // <FS:Zi> leave some room underneath the image for the caption
Optional<LLUIColor> text_enabled_color; // <FS:Zi> Add label/caption colors
Optional<LLUIColor> text_disabled_color; // <FS:Zi> Add label/caption colors
Params()
: image_id("image"),
default_image_id("default_image_id"),
@ -127,6 +130,8 @@ public:
fallback_image("fallback_image"),
multiselect_text("multiselect_text"),
show_caption("show_caption", true), // <FS:Zi> leave some room underneath the image for the caption
text_enabled_color("text_enabled_color"), // <FS:Zi> Add label/caption colors
text_disabled_color("text_disabled_color"), // <FS:Zi> Add label/caption colors
caption_text("caption_text"),
border("border")
{}
@ -199,6 +204,7 @@ public:
void setDnDFilterPermMask(PermissionMask mask)
{ mDnDFilterPermMask = mask; }
PermissionMask getImmediateFilterPermMask() { return mImmediateFilterPermMask; }
void setFilterPermissionMasks(PermissionMask mask);
void closeDependentFloater();
@ -243,10 +249,15 @@ public:
// <FS:Ansariel> Mask texture if desired
void setIsMasked(BOOL masked) { mIsMasked = masked; }
void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; updateLabelColor(); } // <FS:Zi> Add label/caption colors
void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; updateLabelColor(); } // <FS:Zi> Add label/caption colors
private:
BOOL allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type, std::string& tooltip_msg);
BOOL doDrop(LLInventoryItem* item);
void updateLabelColor(); // <FS:Zi> Add label/caption colors
private:
drag_n_drop_callback mDragCallback;
drag_n_drop_callback mDropCallback;
@ -286,6 +297,9 @@ private:
// <FS:Ansariel> Mask texture if desired
BOOL mIsMasked;
LLUIColor mTextEnabledColor; // <FS:Zi> Add label/caption colors
LLUIColor mTextDisabledColor; // <FS:Zi> Add label/caption colors
};
//////////////////////////////////////////////////////////////////////////////////////////

View File

@ -572,7 +572,8 @@ void LLGLTexMemBar::draw()
// <FS:Ansariel> Texture memory bars
S32 bar_left = 0;
S32 bar_width = 200;
constexpr S32 bar_width = 200;
constexpr S32 bar_space = 10;
S32 top = line_height*6 - 2 + v_offset;
S32 bottom = top - 6;
S32 left = bar_left;
@ -585,7 +586,7 @@ void LLGLTexMemBar::draw()
text = "VRAM";
LLFontGL::getFontMonospace()->renderUTF8(text, 0, left, v_offset + line_height*6,
text_color, LLFontGL::LEFT, LLFontGL::TOP);
left = left + 35;
left += 35;
right = left + bar_width;
gGL.color4f(0.5f, 0.5f, 0.5f, 0.75f);
@ -601,6 +602,29 @@ void LLGLTexMemBar::draw()
gl_rect_2d(left, top, right, bottom, color);
// </FS:Ansariel>
// <FS:Beq> Texture cache bars
bar_left = left + bar_width + bar_space;
left = bar_left;
// VRAM Mem Bar
text = "CACHE";
LLFontGL::getFontMonospace()->renderUTF8(text, 0, left, v_offset + line_height*6,
text_color, LLFontGL::LEFT, LLFontGL::TOP);
left += 35;
right = left + bar_width;
gGL.color4f(0.5f, 0.5f, 0.5f, 0.75f);
gl_rect_2d(left, top, right, bottom);
color = (cache_usage < cache_max_usage * 0.8f)? LLColor4::green :
(cache_usage < cache_max_usage)? LLColor4::yellow : LLColor4::red;
color[VALPHA] = .75f;
bar_scale = (F32)bar_width / cache_max_usage;
right = left + llfloor(cache_usage * bar_scale);
gl_rect_2d(left, top, right, bottom, color);
// </FS:Beq>
U32 cache_read(0U), cache_write(0U), res_wait(0U);
LLAppViewer::getTextureFetch()->getStateStats(&cache_read, &cache_write, &res_wait);

View File

@ -200,7 +200,16 @@ BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj,
}
else
{
LLVector3d ray_end_global = ray_start_global + (1.f + max_dist_from_camera) * mouse_direction; // add an epsilon to the sim version of the ray to avoid rounding problems.
// <FS:Zi> Fix not being able to rez a box on top of a prim when MaxSelectDistance is shorter
// than the surface distance, even though LimitSelectDistance is switched off.
// LLVector3d ray_end_global = ray_start_global + (1.f + max_dist_from_camera) * mouse_direction; // add an epsilon to the sim version of the ray to avoid rounding problems.
F32 max_raycast_dist = 129.0f;
if (limitSelectDistance)
{
max_raycast_dist = max_dist_from_camera;
}
LLVector3d ray_end_global = ray_start_global + max_raycast_dist * mouse_direction; // add an epsilon to the sim version of the ray to avoid rounding problems.
// </FS:Zi>
*ray_end_region = regionp->getPosRegionFromGlobal( ray_end_global );
}

View File

@ -53,6 +53,7 @@
#include "llquaternion.h"
#include "llwindow.h" // getPixelAspectRatio()
#include "lltracerecording.h"
#include "llenvironment.h"
// System includes
#include <iomanip> // for setprecision
@ -99,35 +100,41 @@ LLViewerCamera::LLViewerCamera() : LLCamera()
gSavedSettings.getControl("CameraAngle")->getCommitSignal()->connect(boost::bind(&LLViewerCamera::updateCameraAngle, this, _2));
}
void LLViewerCamera::updateCameraLocation(const LLVector3 &center,
const LLVector3 &up_direction,
const LLVector3 &point_of_interest)
void LLViewerCamera::updateCameraLocation(const LLVector3 &center, const LLVector3 &up_direction, const LLVector3 &point_of_interest)
{
// do not update if avatar didn't move
if (!LLViewerJoystick::getInstance()->getCameraNeedsUpdate())
{
return;
}
// do not update if avatar didn't move
if (!LLViewerJoystick::getInstance()->getCameraNeedsUpdate())
{
return;
}
LLVector3 last_position;
LLVector3 last_axis;
last_position = getOrigin();
last_axis = getAtAxis();
LLVector3 last_position;
LLVector3 last_axis;
last_position = getOrigin();
last_axis = getAtAxis();
mLastPointOfInterest = point_of_interest;
mLastPointOfInterest = point_of_interest;
LLViewerRegion * regp = gAgent.getRegion();
F32 water_height = (NULL != regp) ? regp->getWaterHeight() : 0.f;
LLViewerRegion* regp = LLWorld::instance().getRegionFromPosAgent(getOrigin());
if (!regp)
{
regp = gAgent.getRegion();
}
LLVector3 origin = center;
if (origin.mV[2] > water_height)
{
origin.mV[2] = llmax(origin.mV[2], water_height+0.20f);
}
else
{
origin.mV[2] = llmin(origin.mV[2], water_height-0.20f);
}
F32 water_height = (NULL != regp) ? regp->getWaterHeight() : 0.f;
LLVector3 origin = center;
{
if (origin.mV[2] > water_height)
{
origin.mV[2] = llmax(origin.mV[2], water_height + 0.20f);
}
else
{
origin.mV[2] = llmin(origin.mV[2], water_height - 0.20f);
}
}
setOriginAndLookAt(origin, up_direction, point_of_interest);
@ -763,11 +770,19 @@ LLVector3 LLViewerCamera::roundToPixel(const LLVector3 &pos_agent)
BOOL LLViewerCamera::cameraUnderWater() const
{
if(!gAgent.getRegion())
LLViewerRegion* regionp = LLWorld::instance().getRegionFromPosAgent(getOrigin());
if (!regionp)
{
regionp = gAgent.getRegion();
}
if(!regionp)
{
return FALSE ;
}
return getOrigin().mV[VZ] < gAgent.getRegion()->getWaterHeight();
return getOrigin().mV[VZ] < regionp->getWaterHeight();
}
BOOL LLViewerCamera::areVertsVisible(LLViewerObject* volumep, BOOL all_verts)

View File

@ -112,6 +112,7 @@ BOOL gResizeShadowTexture = FALSE;
BOOL gWindowResized = FALSE;
BOOL gSnapshot = FALSE;
BOOL gCubeSnapshot = FALSE;
BOOL gSnapshotNoPost = FALSE;
BOOL gShaderProfileFrame = FALSE;
// This is how long the sim will try to teleport you before giving up.
@ -467,13 +468,13 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
gResizeShadowTexture = FALSE;
}
gSnapshot = for_snapshot;
if (LLPipeline::sRenderDeferred)
{ //hack to make sky show up in deferred snapshots
for_snapshot = FALSE;
}
gSnapshot = for_snapshot;
LLGLSDefault gls_default;
LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE, GL_LEQUAL);

View File

@ -938,12 +938,14 @@ bool voice_follow_key(EKeystate s)
if (KEYSTATE_DOWN == s)
{
if (!LLAgent::isActionAllowed("speak")) return false;
if (!LLVoiceClient::getInstance()->getUserPTTState()) make_ui_sound("UISndMicToggle"); // <FS:PP> FIRE-33249 Mic toggle
LLVoiceClient::getInstance()->setUserPTTState(true);
return true;
}
else if (KEYSTATE_UP == s && LLVoiceClient::getInstance()->getUserPTTState())
{
LLVoiceClient::getInstance()->setUserPTTState(false);
make_ui_sound("UISndMicToggle"); // <FS:PP> FIRE-33249 Mic toggle
return true;
}
return false;

View File

@ -2031,67 +2031,6 @@ void copy_inventory_from_notecard(const LLUUID& destination_id,
}
}
void move_or_copy_inventory_from_object(const LLUUID& destination_id,
const LLUUID& object_id,
const LLUUID& item_id,
LLPointer<LLInventoryCallback> cb)
{
LLViewerObject* object = gObjectList.findObject(object_id);
if (!object)
{
return;
}
const LLInventoryItem* item = object->getInventoryItem(item_id);
if (!item)
{
return;
}
class LLItemAddedObserver : public LLInventoryObserver
{
public:
LLItemAddedObserver(const LLUUID& copied_asset_id, LLPointer<LLInventoryCallback> cb)
: LLInventoryObserver(),
mAssetId(copied_asset_id),
mCallback(cb)
{
}
void changed(U32 mask) override
{
if((mask & (LLInventoryObserver::ADD)) == 0)
{
return;
}
for (const LLUUID& changed_id : gInventory.getChangedIDs())
{
LLViewerInventoryItem* changed_item = gInventory.getItem(changed_id);
if (changed_item->getAssetUUID() == mAssetId)
{
changeComplete(changed_item->getUUID());
return;
}
}
}
private:
void changeComplete(const LLUUID& item_id)
{
mCallback->fire(item_id);
gInventory.removeObserver(this);
delete this;
}
LLUUID mAssetId;
LLPointer<LLInventoryCallback> mCallback;
};
const LLUUID& asset_id = item->getAssetUUID();
LLItemAddedObserver* observer = new LLItemAddedObserver(asset_id, cb);
gInventory.addObserver(observer);
object->moveInventory(destination_id, item_id);
}
void create_new_item(const std::string& name,
const LLUUID& parent_id,
LLAssetType::EType asset_type,

View File

@ -466,11 +466,6 @@ void copy_inventory_from_notecard(const LLUUID& destination_id,
const LLInventoryItem *src,
U32 callback_id = 0);
void move_or_copy_inventory_from_object(const LLUUID& destination_id,
const LLUUID& object_id,
const LLUUID& item_id,
LLPointer<LLInventoryCallback> cb);
void menu_create_inventory_item(LLInventoryPanel* root,
LLFolderBridge* bridge,
const LLSD& userdata,

View File

@ -951,6 +951,10 @@ U32 render_type_from_string(std::string render_type)
{
return LLPipeline::RENDER_TYPE_BUMP;
}
else if ("pbr" == render_type)
{
return LLPipeline::RENDER_TYPE_GLTF_PBR;
}
else
{
return 0;

View File

@ -943,8 +943,9 @@ class LLFileTakeSnapshotToDisk : public view_listener_t
S32 width = gViewerWindow->getWindowWidthRaw();
S32 height = gViewerWindow->getWindowHeightRaw();
bool render_ui = gSavedSettings.getBOOL("RenderUIInSnapshot");
bool render_hud = gSavedSettings.getBOOL("RenderHUDInSnapshot");
BOOL render_ui = gSavedSettings.getBOOL("RenderUIInSnapshot");
BOOL render_hud = gSavedSettings.getBOOL("RenderHUDInSnapshot");
BOOL render_no_post = gSavedSettings.getBOOL("RenderSnapshotNoPost");
BOOL high_res = gSavedSettings.getBOOL("HighResSnapshot");
if (high_res)
@ -964,6 +965,7 @@ class LLFileTakeSnapshotToDisk : public view_listener_t
render_ui,
render_hud,
FALSE,
render_no_post,
LLSnapshotModel::SNAPSHOT_TYPE_COLOR,
high_res ? S32_MAX : MAX_SNAPSHOT_IMAGE_SIZE)) //per side
{

View File

@ -99,7 +99,6 @@ LLGLSLShader gSkinnedObjectFullbrightAlphaMaskProgram;
LLGLSLShader gObjectBumpProgram;
LLGLSLShader gSkinnedObjectBumpProgram;
LLGLSLShader gObjectAlphaMaskNoColorProgram;
LLGLSLShader gObjectAlphaMaskNoColorWaterProgram;
//environment shaders
LLGLSLShader gWaterProgram;
@ -139,7 +138,6 @@ LLGLSLShader gDeferredSkinnedDiffuseProgram;
LLGLSLShader gDeferredSkinnedBumpProgram;
LLGLSLShader gDeferredBumpProgram;
LLGLSLShader gDeferredTerrainProgram;
LLGLSLShader gDeferredTerrainWaterProgram;
LLGLSLShader gDeferredTreeProgram;
LLGLSLShader gDeferredTreeShadowProgram;
LLGLSLShader gDeferredSkinnedTreeShadowProgram;
@ -150,9 +148,10 @@ LLGLSLShader gDeferredMultiLightProgram[16];
LLGLSLShader gDeferredSpotLightProgram;
LLGLSLShader gDeferredMultiSpotLightProgram;
LLGLSLShader gDeferredSunProgram;
LLGLSLShader gHazeProgram;
LLGLSLShader gHazeWaterProgram;
LLGLSLShader gDeferredBlurLightProgram;
LLGLSLShader gDeferredSoftenProgram;
LLGLSLShader gDeferredSoftenWaterProgram;
LLGLSLShader gDeferredShadowProgram;
LLGLSLShader gDeferredSkinnedShadowProgram;
LLGLSLShader gDeferredShadowCubeProgram;
@ -172,8 +171,6 @@ LLGLSLShader gHUDAlphaProgram;
LLGLSLShader gDeferredSkinnedAlphaProgram;
LLGLSLShader gDeferredAlphaImpostorProgram;
LLGLSLShader gDeferredSkinnedAlphaImpostorProgram;
LLGLSLShader gDeferredAlphaWaterProgram;
LLGLSLShader gDeferredSkinnedAlphaWaterProgram;
LLGLSLShader gDeferredAvatarEyesProgram;
LLGLSLShader gDeferredFullbrightProgram;
LLGLSLShader gHUDFullbrightProgram;
@ -181,12 +178,6 @@ LLGLSLShader gDeferredFullbrightAlphaMaskProgram;
LLGLSLShader gHUDFullbrightAlphaMaskProgram;
LLGLSLShader gDeferredFullbrightAlphaMaskAlphaProgram;
LLGLSLShader gHUDFullbrightAlphaMaskAlphaProgram;
LLGLSLShader gDeferredFullbrightWaterProgram;
LLGLSLShader gDeferredSkinnedFullbrightWaterProgram;
LLGLSLShader gDeferredFullbrightWaterAlphaProgram;
LLGLSLShader gDeferredSkinnedFullbrightWaterAlphaProgram;
LLGLSLShader gDeferredFullbrightAlphaMaskWaterProgram;
LLGLSLShader gDeferredSkinnedFullbrightAlphaMaskWaterProgram;
LLGLSLShader gDeferredEmissiveProgram;
LLGLSLShader gDeferredSkinnedEmissiveProgram;
LLGLSLShader gDeferredPostProgram;
@ -219,7 +210,6 @@ LLGLSLShader gRlvSphereProgram;
// Deferred materials shaders
LLGLSLShader gDeferredMaterialProgram[LLMaterial::SHADER_COUNT*2];
LLGLSLShader gDeferredMaterialWaterProgram[LLMaterial::SHADER_COUNT*2];
LLGLSLShader gHUDPBROpaqueProgram;
LLGLSLShader gPBRGlowProgram;
LLGLSLShader gPBRGlowSkinnedProgram;
@ -228,8 +218,6 @@ LLGLSLShader gDeferredSkinnedPBROpaqueProgram;
LLGLSLShader gHUDPBRAlphaProgram;
LLGLSLShader gDeferredPBRAlphaProgram;
LLGLSLShader gDeferredSkinnedPBRAlphaProgram;
LLGLSLShader gDeferredPBRAlphaWaterProgram;
LLGLSLShader gDeferredSkinnedPBRAlphaWaterProgram;
//helper for making a rigged variant of a given shader
bool make_rigged_variant(LLGLSLShader& shader, LLGLSLShader& riggedShader)
@ -262,30 +250,22 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
mShaderList.push_back(&gObjectFullbrightAlphaMaskProgram);
mShaderList.push_back(&gSkinnedObjectFullbrightAlphaMaskProgram);
mShaderList.push_back(&gObjectAlphaMaskNoColorProgram);
mShaderList.push_back(&gObjectAlphaMaskNoColorWaterProgram);
mShaderList.push_back(&gUnderWaterProgram);
mShaderList.push_back(&gDeferredSunProgram);
mShaderList.push_back(&gHazeProgram);
mShaderList.push_back(&gHazeWaterProgram);
mShaderList.push_back(&gDeferredSoftenProgram);
mShaderList.push_back(&gDeferredSoftenWaterProgram);
mShaderList.push_back(&gDeferredAlphaProgram);
mShaderList.push_back(&gHUDAlphaProgram);
mShaderList.push_back(&gDeferredSkinnedAlphaProgram);
mShaderList.push_back(&gDeferredAlphaImpostorProgram);
mShaderList.push_back(&gDeferredSkinnedAlphaImpostorProgram);
mShaderList.push_back(&gDeferredAlphaWaterProgram);
mShaderList.push_back(&gDeferredSkinnedAlphaWaterProgram);
mShaderList.push_back(&gDeferredFullbrightProgram);
mShaderList.push_back(&gHUDFullbrightProgram);
mShaderList.push_back(&gDeferredFullbrightAlphaMaskProgram);
mShaderList.push_back(&gHUDFullbrightAlphaMaskProgram);
mShaderList.push_back(&gDeferredFullbrightAlphaMaskAlphaProgram);
mShaderList.push_back(&gHUDFullbrightAlphaMaskAlphaProgram);
mShaderList.push_back(&gDeferredFullbrightWaterProgram);
mShaderList.push_back(&gDeferredSkinnedFullbrightWaterProgram);
mShaderList.push_back(&gDeferredFullbrightWaterAlphaProgram);
mShaderList.push_back(&gDeferredSkinnedFullbrightWaterAlphaProgram);
mShaderList.push_back(&gDeferredFullbrightAlphaMaskWaterProgram);
mShaderList.push_back(&gDeferredSkinnedFullbrightAlphaMaskWaterProgram);
mShaderList.push_back(&gDeferredFullbrightShinyProgram);
mShaderList.push_back(&gHUDFullbrightShinyProgram);
mShaderList.push_back(&gDeferredSkinnedFullbrightShinyProgram);
@ -295,17 +275,14 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
mShaderList.push_back(&gDeferredEmissiveProgram);
mShaderList.push_back(&gDeferredSkinnedEmissiveProgram);
mShaderList.push_back(&gDeferredAvatarEyesProgram);
mShaderList.push_back(&gDeferredTerrainWaterProgram);
mShaderList.push_back(&gDeferredAvatarAlphaProgram);
mShaderList.push_back(&gDeferredAvatarAlphaProgram);
mShaderList.push_back(&gDeferredWLSkyProgram);
mShaderList.push_back(&gDeferredWLCloudProgram);
mShaderList.push_back(&gDeferredWLMoonProgram);
mShaderList.push_back(&gDeferredWLSunProgram);
mShaderList.push_back(&gDeferredPBRAlphaProgram);
mShaderList.push_back(&gDeferredPBRAlphaWaterProgram);
mShaderList.push_back(&gHUDPBRAlphaProgram);
mShaderList.push_back(&gDeferredSkinnedPBRAlphaProgram);
mShaderList.push_back(&gDeferredSkinnedPBRAlphaWaterProgram);
mShaderList.push_back(&gDeferredPostGammaCorrectProgram); // for gamma
mShaderList.push_back(&gNoPostGammaCorrectProgram);
mShaderList.push_back(&gLegacyPostGammaCorrectProgram);
@ -598,7 +575,6 @@ std::string LLViewerShaderMgr::loadBasicShaders()
vector< pair<string, S32> > shaders;
shaders.push_back( make_pair( "windlight/atmosphericsVarsV.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
shaders.push_back( make_pair( "windlight/atmosphericsVarsWaterV.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
shaders.push_back( make_pair( "windlight/atmosphericsHelpersV.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
shaders.push_back( make_pair( "lighting/lightFuncV.glsl", mShaderLevel[SHADER_LIGHTING] ) );
shaders.push_back( make_pair( "lighting/sumLightsV.glsl", sum_lights_class ) );
@ -678,7 +654,6 @@ std::string LLViewerShaderMgr::loadBasicShaders()
std::vector<S32> index_channels;
index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsVarsF.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsVarsWaterF.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsHelpersF.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/gammaF.glsl", mShaderLevel[SHADER_WINDLIGHT]) );
index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsFuncs.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
@ -693,12 +668,8 @@ std::string LLViewerShaderMgr::loadBasicShaders()
index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/screenSpaceReflUtil.glsl", ssr ? 3 : 1) );
index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightAlphaMaskNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightWaterNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightWaterAlphaMaskNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightF.glsl", mShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightAlphaMaskF.glsl", mShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightWaterF.glsl", mShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightWaterAlphaMaskF.glsl", mShaderLevel[SHADER_LIGHTING] ) );
for (U32 i = 0; i < shaders.size(); i++)
{
@ -736,7 +707,6 @@ BOOL LLViewerShaderMgr::loadShadersWater()
gWaterProgram.mName = "Water Shader";
gWaterProgram.mFeatures.calculatesAtmospherics = true;
gWaterProgram.mFeatures.hasAtmospherics = true;
gWaterProgram.mFeatures.hasWaterFog = true;
gWaterProgram.mFeatures.hasGamma = true;
gWaterProgram.mFeatures.hasSrgb = true;
gWaterProgram.mFeatures.hasReflectionProbes = true;
@ -767,7 +737,6 @@ BOOL LLViewerShaderMgr::loadShadersWater()
gWaterEdgeProgram.mName = "Water Edge Shader";
gWaterEdgeProgram.mFeatures.calculatesAtmospherics = true;
gWaterEdgeProgram.mFeatures.hasAtmospherics = true;
gWaterEdgeProgram.mFeatures.hasWaterFog = true;
gWaterEdgeProgram.mFeatures.hasGamma = true;
gWaterEdgeProgram.mFeatures.hasSrgb = true;
gWaterEdgeProgram.mFeatures.hasReflectionProbes = true;
@ -797,7 +766,7 @@ BOOL LLViewerShaderMgr::loadShadersWater()
//load under water vertex shader
gUnderWaterProgram.mName = "Underwater Shader";
gUnderWaterProgram.mFeatures.calculatesAtmospherics = true;
gUnderWaterProgram.mFeatures.hasWaterFog = true;
gUnderWaterProgram.mFeatures.hasAtmospherics = true;
gUnderWaterProgram.mShaderFiles.clear();
gUnderWaterProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER));
gUnderWaterProgram.mShaderFiles.push_back(make_pair("environment/underWaterF.glsl", GL_FRAGMENT_SHADER));
@ -925,7 +894,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSkinnedBumpProgram.unload();
gDeferredImpostorProgram.unload();
gDeferredTerrainProgram.unload();
gDeferredTerrainWaterProgram.unload();
gDeferredLightProgram.unload();
for (U32 i = 0; i < LL_DEFERRED_MULTI_LIGHT_COUNT; ++i)
{
@ -936,7 +904,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSunProgram.unload();
gDeferredBlurLightProgram.unload();
gDeferredSoftenProgram.unload();
gDeferredSoftenWaterProgram.unload();
gDeferredShadowProgram.unload();
gDeferredSkinnedShadowProgram.unload();
gDeferredShadowCubeProgram.unload();
@ -954,20 +921,12 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAlphaProgram.unload();
gHUDAlphaProgram.unload();
gDeferredSkinnedAlphaProgram.unload();
gDeferredAlphaWaterProgram.unload();
gDeferredSkinnedAlphaWaterProgram.unload();
gDeferredFullbrightProgram.unload();
gHUDFullbrightProgram.unload();
gDeferredFullbrightAlphaMaskProgram.unload();
gHUDFullbrightAlphaMaskProgram.unload();
gDeferredFullbrightAlphaMaskAlphaProgram.unload();
gHUDFullbrightAlphaMaskAlphaProgram.unload();
gDeferredFullbrightWaterProgram.unload();
gDeferredSkinnedFullbrightWaterProgram.unload();
gDeferredFullbrightWaterAlphaProgram.unload();
gDeferredSkinnedFullbrightWaterAlphaProgram.unload();
gDeferredFullbrightAlphaMaskWaterProgram.unload();
gDeferredSkinnedFullbrightAlphaMaskWaterProgram.unload();
gDeferredEmissiveProgram.unload();
gDeferredSkinnedEmissiveProgram.unload();
gDeferredAvatarEyesProgram.unload();
@ -1001,7 +960,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
for (U32 i = 0; i < LLMaterial::SHADER_COUNT*2; ++i)
{
gDeferredMaterialProgram[i].unload();
gDeferredMaterialWaterProgram[i].unload();
}
gHUDPBROpaqueProgram.unload();
@ -1010,8 +968,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSkinnedPBROpaqueProgram.unload();
gDeferredPBRAlphaProgram.unload();
gDeferredSkinnedPBRAlphaProgram.unload();
gDeferredPBRAlphaWaterProgram.unload();
gDeferredSkinnedPBRAlphaWaterProgram.unload();
// [RLVa:KB] - @setsphere
gRlvSphereProgram.unload();
@ -1104,15 +1060,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredMaterialProgram[9+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = false;
gDeferredMaterialProgram[13+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = false;
gDeferredMaterialWaterProgram[1].mFeatures.hasLighting = false;
gDeferredMaterialWaterProgram[5].mFeatures.hasLighting = false;
gDeferredMaterialWaterProgram[9].mFeatures.hasLighting = false;
gDeferredMaterialWaterProgram[13].mFeatures.hasLighting = false;
gDeferredMaterialWaterProgram[1+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = false;
gDeferredMaterialWaterProgram[5+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = false;
gDeferredMaterialWaterProgram[9+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = false;
gDeferredMaterialWaterProgram[13+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = false;
for (U32 i = 0; i < LLMaterial::SHADER_COUNT*2; ++i)
{
if (success)
@ -1178,77 +1125,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
success = gDeferredMaterialProgram[i].createShader(NULL, NULL);
llassert(success);
}
if (success)
{
mShaderList.push_back(&gDeferredMaterialWaterProgram[i]);
gDeferredMaterialWaterProgram[i].mName = llformat("Deferred Underwater Material Shader %d", i);
U32 alpha_mode = i & 0x3;
gDeferredMaterialWaterProgram[i].mShaderFiles.clear();
gDeferredMaterialWaterProgram[i].mShaderFiles.push_back(make_pair("deferred/materialV.glsl", GL_VERTEX_SHADER));
gDeferredMaterialWaterProgram[i].mShaderFiles.push_back(make_pair("deferred/materialF.glsl", GL_FRAGMENT_SHADER));
gDeferredMaterialWaterProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredMaterialWaterProgram[i].mShaderGroup = LLGLSLShader::SG_WATER;
gDeferredMaterialWaterProgram[i].clearPermutations();
bool has_normal_map = (i & 0x8) > 0;
bool has_specular_map = (i & 0x4) > 0;
if (has_normal_map)
{
gDeferredMaterialWaterProgram[i].addPermutation("HAS_NORMAL_MAP", "1");
}
if (has_specular_map)
{
gDeferredMaterialWaterProgram[i].addPermutation("HAS_SPECULAR_MAP", "1");
}
gDeferredMaterialWaterProgram[i].addPermutation("DIFFUSE_ALPHA_MODE", llformat("%d", alpha_mode));
if (alpha_mode != 0)
{
gDeferredMaterialWaterProgram[i].mFeatures.hasAlphaMask = true;
gDeferredMaterialWaterProgram[i].addPermutation("HAS_ALPHA_MASK", "1");
}
if (use_sun_shadow)
{
gDeferredMaterialWaterProgram[i].addPermutation("HAS_SUN_SHADOW", "1");
}
bool has_skin = i & 0x10;
if (has_skin)
{
gDeferredMaterialWaterProgram[i].addPermutation("HAS_SKIN", "1");
}
else
{
gDeferredMaterialWaterProgram[i].mRiggedVariant = &(gDeferredMaterialWaterProgram[i + 0x10]);
}
gDeferredMaterialWaterProgram[i].addPermutation("WATER_FOG","1");
gDeferredMaterialWaterProgram[i].mFeatures.hasReflectionProbes = true;
gDeferredMaterialWaterProgram[i].mFeatures.hasWaterFog = true;
gDeferredMaterialWaterProgram[i].mFeatures.hasSrgb = true;
gDeferredMaterialWaterProgram[i].mFeatures.encodesNormal = true;
gDeferredMaterialWaterProgram[i].mFeatures.calculatesAtmospherics = true;
gDeferredMaterialWaterProgram[i].mFeatures.hasAtmospherics = true;
gDeferredMaterialWaterProgram[i].mFeatures.hasGamma = true;
gDeferredMaterialWaterProgram[i].mFeatures.hasShadows = use_sun_shadow;
if (has_skin)
{
gDeferredMaterialWaterProgram[i].mFeatures.hasObjectSkinning = true;
}
success = gDeferredMaterialWaterProgram[i].createShader(NULL, NULL);//&mWLUniforms);
llassert(success);
}
}
gDeferredMaterialProgram[1].mFeatures.hasLighting = true;
@ -1260,15 +1136,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredMaterialProgram[9+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = true;
gDeferredMaterialProgram[13+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = true;
gDeferredMaterialWaterProgram[1].mFeatures.hasLighting = true;
gDeferredMaterialWaterProgram[5].mFeatures.hasLighting = true;
gDeferredMaterialWaterProgram[9].mFeatures.hasLighting = true;
gDeferredMaterialWaterProgram[13].mFeatures.hasLighting = true;
gDeferredMaterialWaterProgram[1+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = true;
gDeferredMaterialWaterProgram[5+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = true;
gDeferredMaterialWaterProgram[9+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = true;
gDeferredMaterialWaterProgram[13+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = true;
if (success)
{
gDeferredPBROpaqueProgram.mName = "Deferred PBR Opaque Shader";
@ -1376,62 +1243,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
shader->mRiggedVariant->mFeatures.hasLighting = true;
}
if (success)
{
LLGLSLShader* shader = &gDeferredPBRAlphaWaterProgram;
shader->mName = "Deferred PBR Alpha Underwater Shader";
shader->mFeatures.calculatesLighting = false;
shader->mFeatures.hasLighting = false;
shader->mFeatures.isAlphaLighting = true;
shader->mFeatures.hasWaterFog = true;
shader->mFeatures.hasSrgb = true;
shader->mFeatures.encodesNormal = true;
shader->mFeatures.calculatesAtmospherics = true;
shader->mFeatures.hasAtmospherics = true;
shader->mFeatures.hasGamma = true;
shader->mFeatures.hasShadows = use_sun_shadow;
shader->mFeatures.isDeferred = true; // include deferredUtils
shader->mFeatures.hasReflectionProbes = mShaderLevel[SHADER_DEFERRED];
shader->mShaderGroup = LLGLSLShader::SG_WATER;
shader->mShaderFiles.clear();
shader->mShaderFiles.push_back(make_pair("deferred/pbralphaV.glsl", GL_VERTEX_SHADER));
shader->mShaderFiles.push_back(make_pair("deferred/pbralphaF.glsl", GL_FRAGMENT_SHADER));
shader->clearPermutations();
U32 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
shader->addPermutation("DIFFUSE_ALPHA_MODE", llformat("%d", alpha_mode));
shader->addPermutation("HAS_NORMAL_MAP", "1");
shader->addPermutation("HAS_SPECULAR_MAP", "1"); // PBR: Packed: Occlusion, Metal, Roughness
shader->addPermutation("HAS_EMISSIVE_MAP", "1");
shader->addPermutation("USE_VERTEX_COLOR", "1");
shader->addPermutation("WATER_FOG", "1");
if (use_sun_shadow)
{
shader->addPermutation("HAS_SUN_SHADOW", "1");
}
shader->mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = make_rigged_variant(*shader, gDeferredSkinnedPBRAlphaWaterProgram);
if (success)
{
success = shader->createShader(NULL, NULL);
}
llassert(success);
// Alpha Shader Hack
// See: LLRender::syncMatrices()
shader->mFeatures.calculatesLighting = true;
shader->mFeatures.hasLighting = true;
shader->mRiggedVariant->mFeatures.calculatesLighting = true;
shader->mRiggedVariant->mFeatures.hasLighting = true;
}
if (success)
{
LLGLSLShader* shader = &gHUDPBRAlphaProgram;
@ -1660,7 +1471,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
shader->mFeatures.hasGamma = true;
shader->mFeatures.hasShadows = use_sun_shadow;
shader->mFeatures.hasReflectionProbes = true;
shader->mFeatures.hasWaterFog = true;
shader->mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
shader->mShaderFiles.clear();
@ -1757,68 +1567,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
}
}
if (success)
{
LLGLSLShader* shader[] = {
&gDeferredAlphaWaterProgram,
&gDeferredSkinnedAlphaWaterProgram
};
gDeferredAlphaWaterProgram.mRiggedVariant = &gDeferredSkinnedAlphaWaterProgram;
gDeferredAlphaWaterProgram.mName = "Deferred Alpha Underwater Shader";
gDeferredSkinnedAlphaWaterProgram.mName = "Deferred Skinned Alpha Underwater Shader";
for (int i = 0; i < 2 && success; ++i)
{
shader[i]->mFeatures.calculatesLighting = false;
shader[i]->mFeatures.hasLighting = false;
shader[i]->mFeatures.isAlphaLighting = true;
shader[i]->mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels
shader[i]->mFeatures.hasWaterFog = true;
shader[i]->mFeatures.hasSrgb = true;
shader[i]->mFeatures.encodesNormal = true;
shader[i]->mFeatures.calculatesAtmospherics = true;
shader[i]->mFeatures.hasAtmospherics = true;
shader[i]->mFeatures.hasGamma = true;
shader[i]->mFeatures.hasShadows = use_sun_shadow;
shader[i]->mFeatures.hasReflectionProbes = true;
shader[i]->mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
shader[i]->mShaderGroup = LLGLSLShader::SG_WATER;
shader[i]->mShaderFiles.clear();
shader[i]->mShaderFiles.push_back(make_pair("deferred/alphaV.glsl", GL_VERTEX_SHADER));
shader[i]->mShaderFiles.push_back(make_pair("deferred/alphaF.glsl", GL_FRAGMENT_SHADER));
shader[i]->clearPermutations();
shader[i]->addPermutation("USE_INDEXED_TEX", "1");
shader[i]->addPermutation("WATER_FOG", "1");
shader[i]->addPermutation("USE_VERTEX_COLOR", "1");
shader[i]->addPermutation("HAS_ALPHA_MASK", "1");
if (use_sun_shadow)
{
shader[i]->addPermutation("HAS_SUN_SHADOW", "1");
}
if (i == 1)
{ // rigged variant
shader[i]->mFeatures.hasObjectSkinning = true;
shader[i]->addPermutation("HAS_SKIN", "1");
}
else
{
shader[i]->mRiggedVariant = shader[1];
}
shader[i]->mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = shader[i]->createShader(NULL, NULL);
llassert(success);
// Hack
shader[i]->mFeatures.calculatesLighting = true;
shader[i]->mFeatures.hasLighting = true;
}
}
if (success)
{
gDeferredAvatarEyesProgram.mName = "Deferred Avatar Eyes Shader";
@ -1953,71 +1701,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
llassert(success);
}
if (success)
{
gDeferredFullbrightWaterProgram.mName = "Deferred Fullbright Underwater Shader";
gDeferredFullbrightWaterProgram.mFeatures.calculatesAtmospherics = true;
gDeferredFullbrightWaterProgram.mFeatures.hasGamma = true;
gDeferredFullbrightWaterProgram.mFeatures.hasAtmospherics = true;
gDeferredFullbrightWaterProgram.mFeatures.hasWaterFog = true;
gDeferredFullbrightWaterProgram.mFeatures.hasSrgb = true;
gDeferredFullbrightWaterProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
gDeferredFullbrightWaterProgram.mShaderFiles.clear();
gDeferredFullbrightWaterProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER));
gDeferredFullbrightWaterProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER));
gDeferredFullbrightWaterProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredFullbrightWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
gDeferredFullbrightWaterProgram.addPermutation("WATER_FOG","1");
success = make_rigged_variant(gDeferredFullbrightWaterProgram, gDeferredSkinnedFullbrightWaterProgram);
success = success && gDeferredFullbrightWaterProgram.createShader(NULL, NULL);
llassert(success);
}
if (success)
{
gDeferredFullbrightWaterAlphaProgram.mName = "Deferred Fullbright Underwater Alpha Shader";
gDeferredFullbrightWaterAlphaProgram.mFeatures.calculatesAtmospherics = true;
gDeferredFullbrightWaterAlphaProgram.mFeatures.hasGamma = true;
gDeferredFullbrightWaterAlphaProgram.mFeatures.hasAtmospherics = true;
gDeferredFullbrightWaterAlphaProgram.mFeatures.hasWaterFog = true;
gDeferredFullbrightWaterAlphaProgram.mFeatures.hasSrgb = true;
gDeferredFullbrightWaterAlphaProgram.mFeatures.isDeferred = true;
gDeferredFullbrightWaterAlphaProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
gDeferredFullbrightWaterAlphaProgram.mShaderFiles.clear();
gDeferredFullbrightWaterAlphaProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER));
gDeferredFullbrightWaterAlphaProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER));
gDeferredFullbrightWaterAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredFullbrightWaterAlphaProgram.mShaderGroup = LLGLSLShader::SG_WATER;
gDeferredFullbrightWaterAlphaProgram.clearPermutations();
gDeferredFullbrightWaterAlphaProgram.addPermutation("WATER_FOG", "1");
gDeferredFullbrightWaterAlphaProgram.addPermutation("IS_ALPHA", "1");
success = make_rigged_variant(gDeferredFullbrightWaterAlphaProgram, gDeferredSkinnedFullbrightWaterAlphaProgram);
success = success && gDeferredFullbrightWaterAlphaProgram.createShader(NULL, NULL);
llassert(success);
}
if (success)
{
gDeferredFullbrightAlphaMaskWaterProgram.mName = "Deferred Fullbright Underwater Alpha Masking Shader";
gDeferredFullbrightAlphaMaskWaterProgram.mFeatures.calculatesAtmospherics = true;
gDeferredFullbrightAlphaMaskWaterProgram.mFeatures.hasGamma = true;
gDeferredFullbrightAlphaMaskWaterProgram.mFeatures.hasAtmospherics = true;
gDeferredFullbrightAlphaMaskWaterProgram.mFeatures.hasWaterFog = true;
gDeferredFullbrightAlphaMaskWaterProgram.mFeatures.hasSrgb = true;
gDeferredFullbrightAlphaMaskWaterProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
gDeferredFullbrightAlphaMaskWaterProgram.mShaderFiles.clear();
gDeferredFullbrightAlphaMaskWaterProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER));
gDeferredFullbrightAlphaMaskWaterProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER));
gDeferredFullbrightAlphaMaskWaterProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredFullbrightAlphaMaskWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
gDeferredFullbrightAlphaMaskWaterProgram.clearPermutations();
gDeferredFullbrightAlphaMaskWaterProgram.addPermutation("HAS_ALPHA_MASK","1");
gDeferredFullbrightAlphaMaskWaterProgram.addPermutation("WATER_FOG","1");
success = make_rigged_variant(gDeferredFullbrightAlphaMaskWaterProgram, gDeferredSkinnedFullbrightAlphaMaskWaterProgram);
success = success && gDeferredFullbrightAlphaMaskWaterProgram.createShader(NULL, NULL);
llassert(success);
}
if (success)
{
gDeferredFullbrightShinyProgram.mName = "Deferred FullbrightShiny Shader";
@ -2104,40 +1787,52 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
llassert(success);
}
if (success)
{
gDeferredSoftenWaterProgram.mName = "Deferred Soften Underwater Shader";
gDeferredSoftenWaterProgram.mShaderFiles.clear();
gDeferredSoftenWaterProgram.mShaderFiles.push_back(make_pair("deferred/softenLightV.glsl", GL_VERTEX_SHADER));
gDeferredSoftenWaterProgram.mShaderFiles.push_back(make_pair("deferred/softenLightF.glsl", GL_FRAGMENT_SHADER));
if (success)
{
gHazeProgram.mName = "Haze Shader";
gHazeProgram.mShaderFiles.clear();
gHazeProgram.mFeatures.hasSrgb = true;
gHazeProgram.mFeatures.calculatesAtmospherics = true;
gHazeProgram.mFeatures.hasAtmospherics = true;
gHazeProgram.mFeatures.hasGamma = true;
gHazeProgram.mFeatures.isDeferred = true;
gHazeProgram.mFeatures.hasShadows = use_sun_shadow;
gHazeProgram.mFeatures.hasReflectionProbes = mShaderLevel[SHADER_DEFERRED] > 2;
gDeferredSoftenWaterProgram.clearPermutations();
gDeferredSoftenWaterProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredSoftenWaterProgram.addPermutation("WATER_FOG", "1");
gDeferredSoftenWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
gDeferredSoftenWaterProgram.mFeatures.hasWaterFog = true;
gDeferredSoftenWaterProgram.mFeatures.hasSrgb = true;
gDeferredSoftenWaterProgram.mFeatures.calculatesAtmospherics = true;
gDeferredSoftenWaterProgram.mFeatures.hasAtmospherics = true;
gDeferredSoftenWaterProgram.mFeatures.hasGamma = true;
gDeferredSoftenWaterProgram.mFeatures.isDeferred = true;
gDeferredSoftenWaterProgram.mFeatures.hasShadows = use_sun_shadow;
gDeferredSoftenWaterProgram.mFeatures.hasReflectionProbes = mShaderLevel[SHADER_DEFERRED] > 2;
gHazeProgram.clearPermutations();
gHazeProgram.mShaderFiles.push_back(make_pair("deferred/softenLightV.glsl", GL_VERTEX_SHADER));
gHazeProgram.mShaderFiles.push_back(make_pair("deferred/hazeF.glsl", GL_FRAGMENT_SHADER));
if (use_sun_shadow)
{
gDeferredSoftenWaterProgram.addPermutation("HAS_SUN_SHADOW", "1");
}
gHazeProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
if (gSavedSettings.getBOOL("RenderDeferredSSAO"))
{ //if using SSAO, take screen space light map into account as if shadows are enabled
gDeferredSoftenWaterProgram.mShaderLevel = llmax(gDeferredSoftenWaterProgram.mShaderLevel, 2);
gDeferredSoftenWaterProgram.addPermutation("HAS_SSAO", "1");
}
success = gHazeProgram.createShader(NULL, NULL);
llassert(success);
}
if (success)
{
gHazeWaterProgram.mName = "Water Haze Shader";
gHazeWaterProgram.mShaderFiles.clear();
gHazeWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
gHazeWaterProgram.mFeatures.hasSrgb = true;
gHazeWaterProgram.mFeatures.calculatesAtmospherics = true;
gHazeWaterProgram.mFeatures.hasAtmospherics = true;
gHazeWaterProgram.mFeatures.hasGamma = true;
gHazeWaterProgram.mFeatures.isDeferred = true;
gHazeWaterProgram.mFeatures.hasShadows = use_sun_shadow;
gHazeWaterProgram.mFeatures.hasReflectionProbes = mShaderLevel[SHADER_DEFERRED] > 2;
gHazeWaterProgram.clearPermutations();
gHazeWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterHazeV.glsl", GL_VERTEX_SHADER));
gHazeWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterHazeF.glsl", GL_FRAGMENT_SHADER));
gHazeWaterProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = gHazeWaterProgram.createShader(NULL, NULL);
llassert(success);
}
success = gDeferredSoftenWaterProgram.createShader(NULL, NULL);
llassert(success);
}
if (success)
{
@ -2284,7 +1979,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredTerrainProgram.mFeatures.hasLighting = false;
gDeferredTerrainProgram.mFeatures.isAlphaLighting = true;
gDeferredTerrainProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels
gDeferredTerrainProgram.mFeatures.hasWaterFog = true;
gDeferredTerrainProgram.mFeatures.calculatesAtmospherics = true;
gDeferredTerrainProgram.mFeatures.hasAtmospherics = true;
gDeferredTerrainProgram.mFeatures.hasGamma = true;
@ -2297,31 +1991,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
llassert(success);
}
if (success)
{
gDeferredTerrainWaterProgram.mName = "Deferred Terrain Underwater Shader";
gDeferredTerrainWaterProgram.mFeatures.encodesNormal = true;
gDeferredTerrainWaterProgram.mFeatures.hasSrgb = true;
gDeferredTerrainWaterProgram.mFeatures.calculatesLighting = false;
gDeferredTerrainWaterProgram.mFeatures.hasLighting = false;
gDeferredTerrainWaterProgram.mFeatures.isAlphaLighting = true;
gDeferredTerrainWaterProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels
gDeferredTerrainWaterProgram.mFeatures.hasWaterFog = true;
gDeferredTerrainWaterProgram.mFeatures.calculatesAtmospherics = true;
gDeferredTerrainWaterProgram.mFeatures.hasAtmospherics = true;
gDeferredTerrainWaterProgram.mFeatures.hasGamma = true;
gDeferredTerrainWaterProgram.mShaderFiles.clear();
gDeferredTerrainWaterProgram.mShaderFiles.push_back(make_pair("deferred/terrainV.glsl", GL_VERTEX_SHADER));
gDeferredTerrainWaterProgram.mShaderFiles.push_back(make_pair("deferred/terrainF.glsl", GL_FRAGMENT_SHADER));
gDeferredTerrainWaterProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredTerrainWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
gDeferredTerrainWaterProgram.clearPermutations();
gDeferredTerrainWaterProgram.addPermutation("WATER_FOG", "1");
success = gDeferredTerrainWaterProgram.createShader(NULL, NULL);
llassert(success);
}
if (success)
{
gDeferredAvatarProgram.mName = "Deferred Avatar Shader";
@ -2695,24 +2364,6 @@ BOOL LLViewerShaderMgr::loadShadersObject()
success = gObjectAlphaMaskNoColorProgram.createShader(NULL, NULL);
}
if (success)
{
gObjectAlphaMaskNoColorWaterProgram.mName = "No color alpha mask Water Shader";
gObjectAlphaMaskNoColorWaterProgram.mFeatures.calculatesLighting = true;
gObjectAlphaMaskNoColorWaterProgram.mFeatures.calculatesAtmospherics = true;
gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasWaterFog = true;
gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasAtmospherics = true;
gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasLighting = true;
gObjectAlphaMaskNoColorWaterProgram.mFeatures.disableTextureIndex = true;
gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasAlphaMask = true;
gObjectAlphaMaskNoColorWaterProgram.mShaderFiles.clear();
gObjectAlphaMaskNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleNoColorV.glsl", GL_VERTEX_SHADER));
gObjectAlphaMaskNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER));
gObjectAlphaMaskNoColorWaterProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT];
gObjectAlphaMaskNoColorWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
success = gObjectAlphaMaskNoColorWaterProgram.createShader(NULL, NULL);
}
if (success)
{
gImpostorProgram.mName = "Impostor Shader";

View File

@ -175,7 +175,6 @@ extern LLGLSLShader gSkinnedObjectFullbrightAlphaMaskProgram;
extern LLGLSLShader gObjectBumpProgram;
extern LLGLSLShader gSkinnedObjectBumpProgram;
extern LLGLSLShader gObjectAlphaMaskNoColorProgram;
extern LLGLSLShader gObjectAlphaMaskNoColorWaterProgram;
//environment shaders
extern LLGLSLShader gWaterProgram;
@ -212,7 +211,6 @@ extern LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram;
extern LLGLSLShader gDeferredNonIndexedDiffuseProgram;
extern LLGLSLShader gDeferredBumpProgram;
extern LLGLSLShader gDeferredTerrainProgram;
extern LLGLSLShader gDeferredTerrainWaterProgram;
extern LLGLSLShader gDeferredTreeProgram;
extern LLGLSLShader gDeferredTreeShadowProgram;
extern LLGLSLShader gDeferredLightProgram;
@ -220,10 +218,11 @@ extern LLGLSLShader gDeferredMultiLightProgram[LL_DEFERRED_MULTI_LIGHT_COUNT];
extern LLGLSLShader gDeferredSpotLightProgram;
extern LLGLSLShader gDeferredMultiSpotLightProgram;
extern LLGLSLShader gDeferredSunProgram;
extern LLGLSLShader gHazeProgram;
extern LLGLSLShader gHazeWaterProgram;
extern LLGLSLShader gDeferredBlurLightProgram;
extern LLGLSLShader gDeferredAvatarProgram;
extern LLGLSLShader gDeferredSoftenProgram;
extern LLGLSLShader gDeferredSoftenWaterProgram;
extern LLGLSLShader gDeferredShadowProgram;
extern LLGLSLShader gDeferredShadowCubeProgram;
extern LLGLSLShader gDeferredShadowAlphaMaskProgram;
@ -252,10 +251,6 @@ extern LLGLSLShader gDeferredFullbrightAlphaMaskProgram;
extern LLGLSLShader gHUDFullbrightAlphaMaskProgram;
extern LLGLSLShader gDeferredFullbrightAlphaMaskAlphaProgram;
extern LLGLSLShader gHUDFullbrightAlphaMaskAlphaProgram;
extern LLGLSLShader gDeferredAlphaWaterProgram;
extern LLGLSLShader gDeferredFullbrightWaterProgram;
extern LLGLSLShader gDeferredFullbrightWaterAlphaProgram;
extern LLGLSLShader gDeferredFullbrightAlphaMaskWaterProgram;
extern LLGLSLShader gDeferredEmissiveProgram;
extern LLGLSLShader gDeferredAvatarEyesProgram;
extern LLGLSLShader gDeferredAvatarAlphaProgram;
@ -275,12 +270,10 @@ extern LLGLSLShader gRlvSphereProgram;
// Deferred materials shaders
extern LLGLSLShader gDeferredMaterialProgram[LLMaterial::SHADER_COUNT*2];
extern LLGLSLShader gDeferredMaterialWaterProgram[LLMaterial::SHADER_COUNT*2];
extern LLGLSLShader gHUDPBROpaqueProgram;
extern LLGLSLShader gPBRGlowProgram;
extern LLGLSLShader gDeferredPBROpaqueProgram;
extern LLGLSLShader gDeferredPBRAlphaProgram;
extern LLGLSLShader gDeferredPBRAlphaWaterProgram;
extern LLGLSLShader gHUDPBRAlphaProgram;
#endif

View File

@ -2213,9 +2213,6 @@ bool LLViewerFetchedTexture::updateFetch()
}
}
llassert(mRawImage.notNull() || !mIsRawImageValid);
llassert(mRawImage.notNull() || !mNeedsCreateTexture);
return mIsFetching ? true : false;
}

View File

@ -906,6 +906,13 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag
{
F32 vsize = face->getPixelArea();
// scale desired texture resolution higher or lower depending on texture scale
const LLTextureEntry* te = face->getTextureEntry();
F32 min_scale = te ? llmin(fabsf(te->getScaleS()), fabsf(te->getScaleT())) : 1.f;
min_scale = llmax(min_scale*min_scale, 0.1f);
vsize /= min_scale;
#if LL_DARWIN
vsize /= 1.f + LLViewerTexture::sDesiredDiscardBias*(1.f+face->getDrawable()->mDistanceWRTCamera*bias_distance_scale);
#else
@ -923,7 +930,6 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag
// if a GLTF material is present, ignore that face
// as far as this texture stats go, but update the GLTF material
// stats
const LLTextureEntry* te = face->getTextureEntry();
LLFetchedGLTFMaterial* mat = te ? (LLFetchedGLTFMaterial*)te->getGLTFRenderMaterial() : nullptr;
llassert(mat == nullptr || dynamic_cast<LLFetchedGLTFMaterial*>(te->getGLTFRenderMaterial()) != nullptr);
if (mat)

View File

@ -259,6 +259,7 @@ extern BOOL gDisplaySwapBuffers;
extern BOOL gDepthDirty;
extern BOOL gResizeScreenTexture;
extern BOOL gCubeSnapshot;
extern BOOL gSnapshotNoPost;
LLViewerWindow *gViewerWindow = NULL;
@ -6031,16 +6032,16 @@ void LLViewerWindow::resetSnapshotLoc() const
gSavedPerAccountSettings.setString("SnapshotBaseDir", std::string());
}
BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type)
BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, BOOL no_post, LLSnapshotModel::ESnapshotLayerType type)
{
return rawSnapshot(raw, preview_width, preview_height, FALSE, FALSE, show_ui, show_hud, do_rebuild, type);
return rawSnapshot(raw, preview_width, preview_height, FALSE, FALSE, show_ui, show_hud, do_rebuild, no_post, type);
}
// Saves the image from the screen to a raw image
// Since the required size might be bigger than the available screen, this method rerenders the scene in parts (called subimages) and copy
// the results over to the final raw image.
BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height,
BOOL keep_window_aspect, BOOL is_texture, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type, S32 max_size)
BOOL keep_window_aspect, BOOL is_texture, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, BOOL no_post, LLSnapshotModel::ESnapshotLayerType type, S32 max_size)
{
if (!raw)
{
@ -6057,6 +6058,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
}
// PRE SNAPSHOT
gSnapshotNoPost = no_post;
gDisplaySwapBuffers = FALSE;
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); // stencil buffer is deprecated | GL_STENCIL_BUFFER_BIT);
@ -6333,6 +6335,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
}
gDisplaySwapBuffers = FALSE;
gSnapshotNoPost = FALSE;
gDepthDirty = TRUE;
// POST SNAPSHOT

View File

@ -363,7 +363,7 @@ public:
BOOL saveSnapshot(const std::string& filename, S32 image_width, S32 image_height, BOOL show_ui = TRUE, BOOL show_hud = TRUE, BOOL do_rebuild = FALSE, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR, LLSnapshotModel::ESnapshotFormat format = LLSnapshotModel::SNAPSHOT_FORMAT_BMP);
BOOL rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, BOOL keep_window_aspect = TRUE, BOOL is_texture = FALSE,
BOOL show_ui = TRUE, BOOL show_hud = TRUE, BOOL do_rebuild = FALSE, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_SNAPSHOT_IMAGE_SIZE);
BOOL show_ui = TRUE, BOOL show_hud = TRUE, BOOL do_rebuild = FALSE, BOOL no_post = FALSE, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_SNAPSHOT_IMAGE_SIZE);
BOOL simpleSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, const int num_render_passes);
@ -381,7 +381,7 @@ public:
// special implementation of simpleSnapshot for reflection maps
BOOL reflectionSnapshot(LLImageRaw* raw, S32 image_width, S32 image_height, const int num_render_passes);
BOOL thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type);
BOOL thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, BOOL no_post, LLSnapshotModel::ESnapshotLayerType type);
BOOL isSnapshotLocSet() const;
void resetSnapshotLoc() const;

View File

@ -628,7 +628,6 @@ void LLVoiceClient::setUserPTTState(bool ptt)
mUserPTTState = ptt;
updateMicMuteLogic();
mMicroChangedSignal();
make_ui_sound("UISndMicToggle"); // <FS:PP> FIRE-33249 Mic toggle
}
bool LLVoiceClient::getUserPTTState()
@ -678,12 +677,14 @@ void LLVoiceClient::inputUserControlState(bool down)
else // set open-mic state as an absolute
{
setUserPTTState(down);
make_ui_sound("UISndMicToggle"); // <FS:PP> FIRE-33249 Mic toggle
}
}
void LLVoiceClient::toggleUserPTTState(void)
{
setUserPTTState(!getUserPTTState());
make_ui_sound("UISndMicToggle"); // <FS:PP> FIRE-33249 Mic toggle
}

View File

@ -1325,58 +1325,6 @@ void LLWorld::waterHeightRegionInfo(std::string const& sim_name, F32 water_heigh
}
}
void LLWorld::precullWaterObjects(LLCamera& camera, LLCullResult* cull, bool include_void_water)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
if (!gAgent.getRegion())
{
return;
}
if (mRegionList.empty())
{
LL_WARNS() << "No regions!" << LL_ENDL;
return;
}
for (region_list_t::iterator iter = mRegionList.begin();
iter != mRegionList.end(); ++iter)
{
LLViewerRegion* regionp = *iter;
LLVOWater* waterp = regionp->getLand().getWaterObj();
if (waterp && waterp->mDrawable)
{
waterp->mDrawable->setVisible(camera);
cull->pushDrawable(waterp->mDrawable);
}
}
if (include_void_water)
{
for (std::list<LLPointer<LLVOWater> >::iterator iter = mHoleWaterObjects.begin();
iter != mHoleWaterObjects.end(); ++ iter)
{
LLVOWater* waterp = (*iter).get();
if (waterp && waterp->mDrawable)
{
waterp->mDrawable->setVisible(camera);
cull->pushDrawable(waterp->mDrawable);
}
}
}
S32 dir;
for (dir = 0; dir < EDGE_WATER_OBJECTS_COUNT; dir++)
{
LLVOWater* waterp = mEdgeWaterObjects[dir];
if (waterp && waterp->mDrawable)
{
waterp->mDrawable->setVisible(camera);
cull->pushDrawable(waterp->mDrawable);
}
}
}
void LLWorld::clearHoleWaterObjects()
{
for (std::list<LLPointer<LLVOWater> >::iterator iter = mHoleWaterObjects.begin();

View File

@ -209,8 +209,6 @@ public:
LLViewerTexture *getDefaultWaterTexture();
void updateWaterObjects();
void precullWaterObjects(LLCamera& camera, LLCullResult* cull, bool include_void_water);
void waterHeightRegionInfo(std::string const& sim_name, F32 water_height);
void shiftRegions(const LLVector3& offset);

View File

@ -45,20 +45,23 @@ static PieChildRegistry::Register<PieSlice> pie_r2("pie_slice");
static PieChildRegistry::Register<PieSeparator> pie_r3("pie_separator");
// pie slice label text positioning
const S32 PIE_X[] = {64, 45, 0, -45, -63, -45, 0, 45};
const S32 PIE_Y[] = { 0, 44, 73, 44, 0, -44, -73, -44};
constexpr S32 PIE_X[] = {64, 45, 0, -45, -63, -45, 0, 45};
constexpr S32 PIE_Y[] = { 0, 44, 73, 44, 0, -44, -73, -44};
const S32 PIE_INNER_SIZE = 20; // radius of the inner pie circle
const F32 PIE_POPUP_FACTOR = 1.7f; // pie menu size factor on popup
const F32 PIE_POPUP_TIME = 0.25f; // time to shrink from popup size to regular size
const S32 PIE_OUTER_SIZE = 96; // radius of the outer pie circle
const F32 PIE_OUTER_SHADE_FACTOR = 1.09f; // size factor of the outer shading ring
const F32 PIE_SLICE_DIVIDER_WIDTH = 0.04f; // width of a slice divider in radians
const F32 PIE_MAX_SLICES_F = F32(PIE_MAX_SLICES);
constexpr S32 PIE_INNER_SIZE = 20; // radius of the inner pie circle
constexpr F32 PIE_POPUP_FACTOR = 1.7f; // pie menu size factor on popup
constexpr F32 PIE_POPUP_TIME = 0.25f; // time to shrink from popup size to regular size
constexpr S32 PIE_OUTER_SIZE = 96; // radius of the outer pie circle
constexpr F32 PIE_OUTER_SHADE_FACTOR = 1.09f; // size factor of the outer shading ring
constexpr F32 PIE_SLICE_DIVIDER_WIDTH = 0.04f; // width of a slice divider in radians
constexpr F32 PIE_MAX_SLICES_F = F32(PIE_MAX_SLICES);
PieMenu::PieMenu(const LLMenuGL::Params& p) :
LLMenuGL(p),
mCurrentSegment(-1)
mCurrentSegment(-1),
mOldSlice(nullptr),
mSlice(nullptr),
mFirstClick(true)
{
LL_DEBUGS("Pie") << "PieMenu::PieMenu()" << LL_ENDL;
@ -75,12 +78,6 @@ PieMenu::PieMenu(const LLMenuGL::Params& p) :
// set slices pointer to our own slices
mSlices = &mMySlices;
// this will be the first click on the menu
mFirstClick = true;
// clean initialisation
mSlice = NULL;
}
bool PieMenu::addChild(LLView* child, S32 tab_group)
@ -92,7 +89,7 @@ bool PieMenu::addChild(LLView* child, S32 tab_group)
}
// add a new slice to the menu
mSlices->push_back(child);
mSlices->emplace_back(child);
// tell the view that our menu has changed and reshape it back to correct size
LLUICtrl::addChild(child);
@ -205,18 +202,17 @@ void PieMenu::show(S32 x, S32 y, LLView* spawning_view)
mSlices = &mMySlices;
// reset enable update checks for slices
for (slice_list_t::iterator it = mSlices->begin(); it != mSlices->end(); ++it)
for (auto slice : *mSlices)
{
PieSlice* resetSlice = dynamic_cast<PieSlice*>(*it);
if (resetSlice)
if (auto resetSlice = dynamic_cast<PieSlice*>(slice); resetSlice)
{
resetSlice->resetUpdateEnabledCheck();
}
}
// cleanup
mSlice = NULL;
mOldSlice = NULL;
mSlice = nullptr;
mOldSlice = nullptr;
// draw the menu on screen
setVisible(TRUE);
@ -262,7 +258,7 @@ void PieMenu::draw()
gGL.pushMatrix();
// save the widget's rectangle for later use
LLRect r = getRect();
const LLRect& r = getRect();
// initialize pie scale factor for popup effect
F32 factor = getScaleFactor();
@ -300,7 +296,7 @@ void PieMenu::draw()
borderColor %= 0.f;
}
S32 steps = 100;
constexpr S32 steps = 100;
// move origin point to the center of our rectangle
LLUI::instance().translate(r.getWidth() / 2.f, r.getHeight() / 2.f);
@ -313,7 +309,7 @@ void PieMenu::draw()
cur_item_iter = mSlices->begin();
// clear current slice pointer
mSlice = NULL;
mSlice = nullptr;
// current slice number is 0
S32 num = 0;
@ -539,10 +535,9 @@ BOOL PieMenu::handleMouseButtonUp(S32 x, S32 y, MASK mask)
// swap out the list of items for the ones in the submenu
mSlices = &currentSubmenu->mMySlices;
// reset enable update checks for slices
for (slice_list_t::iterator it = mSlices->begin(); it != mSlices->end(); ++it)
for (auto slice : *mSlices)
{
PieSlice* resetSlice = dynamic_cast<PieSlice*>(*it);
if (resetSlice)
if (auto resetSlice = dynamic_cast<PieSlice*>(slice); resetSlice)
{
resetSlice->resetUpdateEnabledCheck();
}
@ -564,7 +559,7 @@ BOOL PieMenu::handleMouseButtonUp(S32 x, S32 y, MASK mask)
// release mouse capture after the first click if we still have it grabbed
if (hasMouseCapture())
{
gFocusMgr.setMouseCapture(NULL);
gFocusMgr.setMouseCapture(nullptr);
}
// give control back to the system

View File

@ -31,7 +31,7 @@
#include "llmenugl.h"
#include "llframetimer.h"
const S32 PIE_MAX_SLICES = 8;
constexpr S32 PIE_MAX_SLICES = 8;
// PieChildRegistry contains a list of allowed child types for the XUI definition
struct PieChildRegistry : public LLChildRegistry<PieChildRegistry>
@ -76,7 +76,7 @@ public:
void hide();
// our item list type definition
typedef std::list<LLView*> slice_list_t;
typedef std::vector<LLView*> slice_list_t;
// the actual item list
slice_list_t mMySlices;
// pointer to the currently used list

View File

@ -135,21 +135,21 @@ std::string PieSlice::getLabel() const
}
// accessor
void PieSlice::setLabel(const std::string& newLabel)
void PieSlice::setLabel(std::string_view newLabel)
{
mLabel = newLabel;
}
// accessor
bool PieSlice::getStartAutohide()
bool PieSlice::getStartAutohide() const
{
return mStartAutohide;
}
// accessor
bool PieSlice::getAutohide()
bool PieSlice::getAutohide() const
{
return mStartAutohide | mAutohide;
return mStartAutohide || mAutohide;
}
void PieSlice::resetUpdateEnabledCheck()

View File

@ -66,13 +66,13 @@ public:
// accessor to expose the label to the outside (value is the same as label)
std::string getLabel() const;
void setLabel(const std::string& newLabel);
void setLabel(std::string_view newLabel);
LLSD getValue() const;
void setValue(const LLSD& value);
// accessor to expose the autohide feature
bool getStartAutohide();
bool getAutohide();
bool getStartAutohide() const;
bool getAutohide() const;
// callback connection for the onCommit method to launch the specified function
boost::signals2::connection setClickCallback(const commit_signal_t::slot_type& cb)

Some files were not shown because too many files have changed in this diff Show More