Merge remote-tracking branch 'origin/release/maint-a' into project/gltf_development

master
Brad Linden 2024-06-11 16:03:30 -07:00
commit 9775d7ea10
43 changed files with 311 additions and 322 deletions

View File

@ -312,7 +312,7 @@ jobs:
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
needs: build
runs-on: windows
runs-on: windows-large
steps:
- name: Sign and package Windows viewer
if: env.AZURE_KEY_VAULT_URI && env.AZURE_CERT_NAME && env.AZURE_CLIENT_ID && env.AZURE_CLIENT_SECRET && env.AZURE_TENANT_ID

View File

@ -103,6 +103,11 @@ if (WINDOWS)
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
endif()
# workaround for github runner image breakage:
# https://github.com/actions/runner-images/issues/10004#issuecomment-2153445161
# can be removed after the above issue is resolved and deployed across GHA
add_compile_definitions(_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
endif (WINDOWS)

View File

@ -3,5 +3,5 @@ include(Prebuilt)
use_prebuilt_binary(tinyexr)
set(TINYEXR_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/tinyexr)
set(TINYEXR_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/tinyexr)

View File

@ -1928,7 +1928,6 @@ void LLImageRaw::compositeRowScaled4onto3( const U8* in, U8* out, S32 in_pixel_l
}
}
void LLImageRaw::addEmissive(LLImageRaw* src)
{
LLImageRaw* dst = this; // Just for clarity.
@ -1994,7 +1993,6 @@ void LLImageRaw::addEmissiveScaled(LLImageRaw* src)
dst->addEmissiveUnscaled(&temp);
}
// static
bool LLImageRaw::validateSrcAndDst(std::string func, const LLImageRaw* src, const LLImageRaw* dst)
{
LLImageDataSharedLock lockIn(src);

View File

@ -62,7 +62,7 @@ public:
static const std::string SETTING_DOME_OFFSET;
static const std::string SETTING_DOME_RADIUS;
static const std::string SETTING_GAMMA;
static const std::string SETTING_GLOW;
static const std::string SETTING_GLOW;
static const std::string SETTING_LIGHT_NORMAL;
static const std::string SETTING_MAX_Y;
static const std::string SETTING_MOON_ROTATION;
@ -92,7 +92,7 @@ public:
static const std::string SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR;
static const std::string SETTING_DENSITY_PROFILE_LINEAR_TERM;
static const std::string SETTING_DENSITY_PROFILE_CONSTANT_TERM;
static const std::string SETTING_SKY_MOISTURE_LEVEL;
static const std::string SETTING_SKY_DROPLET_RADIUS;
static const std::string SETTING_SKY_ICE_LEVEL;
@ -117,7 +117,7 @@ public:
virtual std::string getSettingsType() const SETTINGS_OVERRIDE { return std::string("sky"); }
virtual LLSettingsType::type_e getSettingsTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_SKY; }
// Settings status
// Settings status
virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE;
virtual void replaceSettings(LLSD settings) SETTINGS_OVERRIDE;
@ -129,7 +129,7 @@ public:
F32 getSkyBottomRadius() const;
F32 getSkyTopRadius() const;
F32 getSunArcRadians() const;
F32 getMieAnisotropy() const;
F32 getMieAnisotropy() const;
F32 getSkyMoistureLevel() const;
F32 getSkyDropletRadius() const;
@ -196,7 +196,7 @@ public:
F32 getCloudShadow() const;
void setCloudShadow(F32 val);
F32 getCloudVariance() const;
void setCloudVariance(F32 val);
@ -295,7 +295,7 @@ public:
// color based on brightness
LLColor3 getMoonlightColor() const;
LLColor4 getMoonAmbient() const;
LLColor3 getMoonDiffuse() const;
LLColor4 getSunAmbient() const;

View File

@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, 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$
*/
@ -115,18 +115,6 @@ public:
static const char* const GLTF_FILE_EXTENSION_TRANSFORM_ROTATION;
static const LLUUID GLTF_OVERRIDE_NULL_UUID;
// *TODO: If/when we implement additional GLTF extensions, they may not be
// compatible with our GLTF terrain implementation. We may want to disallow
// materials with some features from being set on terrain, if their
// implementation on terrain is not compliant with the spec:
// - KHR_materials_transmission: Probably OK?
// - KHR_materials_ior: Probably OK?
// - KHR_materials_volume: Likely incompatible, as our terrain
// heightmaps cannot currently be described as finite enclosed
// volumes.
// See also LLPanelRegionTerrainInfo::validateMaterials
public:
// get a UUID based on a hash of this LLGLTFMaterial
LLUUID getHash() const;
@ -195,7 +183,7 @@ public:
void writeToModel(tinygltf::Model& model, S32 mat_index) const;
virtual void applyOverride(const LLGLTFMaterial& override_mat);
// apply the given LLSD override data
void applyOverrideLLSD(const LLSD& data);
@ -249,10 +237,17 @@ protected:
void updateLocalTexDataDigest();
public:
// *TODO: If/when we implement additional GLTF extensions, they may not be
// compatible with our GLTF terrain implementation. We may want to disallow
// materials with some features from being set on terrain, if their
// implementation on terrain is not compliant with the spec:
// - KHR_materials_transmission: Probably OK?
// - KHR_materials_ior: Probably OK?
// - KHR_materials_volume: Likely incompatible, as our terrain
// heightmaps cannot currently be described as finite enclosed
// volumes.
// See also LLPanelRegionTerrainInfo::validateMaterials
// These fields are local to viewer and are a part of local bitmap support
// IMPORTANT: do not move this member down (and do not move
// mLocalTexDataDigest either): the getHash() method does rely on the
// current ordering. HB
typedef std::map<LLUUID, LLUUID> local_tex_map_t;
local_tex_map_t mTrackingIdToLocalTexture;
@ -273,7 +268,7 @@ public:
F32 mAlphaCutoff;
AlphaMode mAlphaMode;
bool mDoubleSided = false;
// Override specific flags for state that can't use off-by-epsilon or UUID

View File

@ -1,24 +1,24 @@
/**
/**
* @file blurLightF.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$
*/
@ -42,16 +42,16 @@ in vec2 vary_fragcoord;
vec4 getPosition(vec2 pos_screen);
vec4 getNorm(vec2 pos_screen);
void main()
void main()
{
vec2 tc = vary_fragcoord.xy;
vec4 norm = getNorm(tc);
vec3 pos = getPosition(tc).xyz;
vec4 ccol = texture(lightMap, tc).rgba;
vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy);
dlt /= max(-pos.z*dist_factor, 1.0);
vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free'
vec4 col = defined_weight.xyxx * ccol;
@ -75,15 +75,15 @@ void main()
k[1] = (k[0]+k[2])*0.5f;
k[3] = (k[2]+k[4])*0.5f;
k[5] = (k[4]+k[6])*0.5f;
for (int i = 1; i < 7; i++)
{
vec2 samptc = tc + k[i].z*dlt*2.0;
samptc /= screen_res;
vec3 samppos = getPosition(samptc).xyz;
vec3 samppos = getPosition(samptc).xyz;
float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
if (d*d <= pointplanedist_tolerance_pow2)
{
col += texture(lightMap, samptc)*k[i].xyxx;
@ -95,10 +95,10 @@ void main()
{
vec2 samptc = tc - k[i].z*dlt*2.0;
samptc /= screen_res;
vec3 samppos = getPosition(samptc).xyz;
vec3 samppos = getPosition(samptc).xyz;
float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
if (d*d <= pointplanedist_tolerance_pow2)
{
col += texture(lightMap, samptc)*k[i].xyxx;
@ -108,7 +108,7 @@ void main()
col /= defined_weight.xyxx;
//col.y *= col.y;
frag_color = max(col, vec4(0));
#ifdef IS_AMD_CARD

View File

@ -1,28 +1,28 @@
/**
/**
* @file exposureF.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$
*/
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@ -43,7 +43,7 @@ float lum(vec3 col)
return dot(l, col);
}
void main()
void main()
{
vec2 tc = vec2(0.5,0.5);
@ -53,13 +53,13 @@ void main()
L /= max_L;
L = pow(L, 2.0);
float s = mix(dynamic_exposure_params.z, dynamic_exposure_params.y, L);
#ifdef USE_LAST_EXPOSURE
float prev = texture(exposureMap, vec2(0.5,0.5)).r;
s = mix(prev, s, min(dt*2.0*abs(prev-s), 0.04));
#endif
frag_color = max(vec4(s, s, s, dt), vec4(0.0));
}

View File

@ -1,28 +1,28 @@
/**
/**
* @file deferred/fullbrightF.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$
*/
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@ -52,7 +52,7 @@ vec4 applySkyAndWaterFog(vec3 pos, vec3 additive, vec3 atten, vec4 color);
void mirrorClip(vec3 pos);
void main()
void main()
{
mirrorClip(vary_position);
#ifdef IS_ALPHA
@ -90,7 +90,7 @@ void main()
calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten);
color.rgb = applySkyAndWaterFog(pos, additive, atten, color).rgb;
#endif
#endif

View File

@ -1,24 +1,24 @@
/**
/**
* @file class1/deferred/globalF.glsl
*
* $LicenseInfo:firstyear=2024&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2024, 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$
*/

View File

@ -1,32 +1,32 @@
/**
/**
* @file luminanceF.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$
*/
/*[EXTRA_CODE_HERE]*/
// take a luminance sample of diffuseRect and emissiveRect
// take a luminance sample of diffuseRect and emissiveRect
out vec4 frag_color;
@ -43,12 +43,12 @@ float lum(vec3 col)
return dot(l, col);
}
void main()
void main()
{
vec2 tc = vary_fragcoord*0.6+0.2;
tc.y -= 0.1; // HACK - nudge exposure sample down a little bit to favor ground over sky
vec3 c = texture(diffuseRect, tc).rgb;
vec4 norm = texture(normalMap, tc);
if (!GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_HDRI) &&

View File

@ -1,28 +1,28 @@
/**
/**
* @file class1\deferred\moonF.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, 2020 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$
*/
/*[EXTRA_CODE_HERE]*/
out vec4 frag_data[4];
@ -34,7 +34,7 @@ uniform sampler2D diffuseMap;
in vec2 vary_texcoord0;
void main()
void main()
{
// Restore Pre-EEP alpha fade moon near horizon
float fade = 1.0;

View File

@ -1,24 +1,24 @@
/**
/**
* @file pbrShadowAlphaMaskF.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$
*/
@ -33,7 +33,7 @@ in vec4 vertex_color;
in vec2 vary_texcoord0;
uniform float minimum_alpha;
void main()
void main()
{
float alpha = texture(diffuseMap,vary_texcoord0.xy).a * vertex_color.a;

View File

@ -1,24 +1,24 @@
/**
/**
* @file pbropaqueF.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, 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$
*/
@ -28,7 +28,7 @@
#ifndef IS_HUD
// deferred opaque implementation
// deferred opaque implementation
uniform sampler2D diffuseMap; //always in sRGB space
@ -85,7 +85,7 @@ void main()
float sign = vary_sign;
vec3 vN = vary_normal;
vec3 vT = vary_tangent.xyz;
vec3 vB = sign * cross(vN, vT);
vec3 tnorm = normalize( vNt.x * vT + vNt.y * vB + vNt.z * vN );
@ -95,7 +95,7 @@ void main()
// roughness 0.0
// metal 0.0
vec3 spec = texture(specularMap, metallic_roughness_texcoord.xy).rgb;
spec.g *= roughnessFactor;
spec.b *= metallicFactor;

View File

@ -1,24 +1,24 @@
/**
/**
* @file class1/deferred/skyF.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, Linden Research, Inc.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@ -99,9 +99,9 @@ void main()
else
#endif
{
// Potential Fill-rate optimization. Add cloud calculation
// back in and output alpha of 0 (so that alpha culling kills
// the fragment) if the sky wouldn't show up because the clouds
// Potential Fill-rate optimization. Add cloud calculation
// back in and output alpha of 0 (so that alpha culling kills
// the fragment) if the sky wouldn't show up because the clouds
// are fully opaque.
color = vary_HazeColor;

View File

@ -102,7 +102,7 @@ void main()
// Initialize temp variables
vec3 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color * 0.7; //magic 0.7 to match legacy color
// Sunlight attenuation effect (hue and brightness) due to atmosphere
// this is used later for sunlight modulation at various altitudes
vec3 light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y);
@ -152,7 +152,7 @@ void main()
sunlight *= max(0.0, (1. - cloud_shadow));
// Haze color below cloud
vec3 add_below_cloud = (blue_horizon * blue_weight * (sunlight + ambient)
vec3 add_below_cloud = (blue_horizon * blue_weight * (sunlight + ambient)
+ (haze_horizon * haze_weight) * (sunlight * haze_glow + ambient));
// Attenuate cloud color by atmosphere

View File

@ -1,24 +1,24 @@
/**
/**
* @file class1\environment\terrainV.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$
*/
@ -44,15 +44,15 @@ uniform vec4 object_plane_t;
vec2 texgen_object(vec4 vpos, mat4 mat, vec4 tp0, vec4 tp1)
{
vec4 tcoord;
tcoord.x = dot(vpos, tp0);
tcoord.y = dot(vpos, tp1);
tcoord.z = 0;
tcoord.w = 1;
tcoord = mat * tcoord;
return tcoord.xy;
tcoord = mat * tcoord;
return tcoord.xy;
}
void main()
@ -65,12 +65,12 @@ void main()
pos = (modelview_matrix*pre_pos).xyz;
vary_normal = normalize(normal_matrix * normal);
// Transform and pass tex coords
vary_texcoord0.xy = texgen_object(vec4(position, 1.0), texture_matrix0, object_plane_s, object_plane_t);
vec4 t = vec4(texcoord1,0,1);
vary_texcoord0.zw = t.xy;
vary_texcoord1.xy = t.xy-vec2(2.0, 0.0);
vary_texcoord1.zw = t.xy-vec2(1.0, 0.0);

View File

@ -1,24 +1,24 @@
/**
/**
* @file normaldebugG.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$
*/

View File

@ -57,9 +57,9 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
vec3 rel_pos_norm = normalize(rel_pos);
float rel_pos_len = length(rel_pos);
vec3 sunlight = (sun_up_factor == 1) ? sunlight_color: moonlight_color;
// sunlight attenuation effect (hue and brightness) due to atmosphere
// this is used later for sunlight modulation at various altitudes
vec3 light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y);
@ -119,7 +119,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
additive = (blue_horizon.rgb * blue_weight.rgb) * (cs + tmpAmbient.rgb) + (haze_horizon * haze_weight.rgb) * (cs * haze_glow + tmpAmbient.rgb);
// brightness of surface both sunlight and ambient
sunlit = sunlight.rgb;
amblit = tmpAmbient;
@ -128,7 +128,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
vec3 srgb_to_linear(vec3 col);
// provide a touch of lighting in the opposite direction of the sun light
// provide a touch of lighting in the opposite direction of the sun light
// so areas in shadow don't lose all detail
float ambientLighting(vec3 norm, vec3 light_dir)
{
@ -150,7 +150,7 @@ void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, ou
// (allows for mixing of light sources other than sunlight e.g. reflection probes)
sunlit *= sky_sunlight_scale;
amblit *= sky_ambient_scale;
amblit = srgb_to_linear(amblit);
amblit *= ambientLighting(norm, light_dir);
}

View File

@ -1,24 +1,24 @@
/**
/**
* @file sunLightF.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$
*/
@ -41,7 +41,7 @@ vec4 getPosition(vec2 pos_screen);
float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);
float sampleSpotShadow(vec3 pos, vec3 norm, int index, vec2 pos_screen);
void main()
void main()
{
vec2 pos_screen = vary_fragcoord.xy;
vec4 pos = getPosition(pos_screen);
@ -50,7 +50,7 @@ void main()
vec4 col;
col.r = sampleDirectionalShadow(pos.xyz, norm.xyz, pos_screen);
col.g = 1.0f;
col.b = sampleSpotShadow(pos.xyz, norm.xyz, 0, pos_screen);
col.b = sampleSpotShadow(pos.xyz, norm.xyz, 0, pos_screen);
col.a = sampleSpotShadow(pos.xyz, norm.xyz, 1, pos_screen);
frag_color = clamp(col, vec4(0), vec4(1));

View File

@ -1,27 +1,27 @@
/**
/**
* @file class2/deferred/sunLightSSAOF.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$
*/
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@ -38,7 +38,7 @@ float sampleDirectionalShadow(vec3 shadow_pos, vec3 norm, vec2 pos_screen);
float sampleSpotShadow(vec3 shadow_pos, vec3 norm, int index, vec2 pos_screen);
float calcAmbientOcclusion(vec4 pos, vec3 norm, vec2 pos_screen);
void main()
void main()
{
vec2 pos_screen = vary_fragcoord.xy;
vec4 pos = getPosition(pos_screen);

View File

@ -67,16 +67,16 @@ void main()
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);
@ -101,5 +101,5 @@ void main()
}
frag_color = max(vec4(color.rgb, alpha), vec4(0)); //output linear since local lights will be added to this shader's results
}

View File

@ -56,8 +56,8 @@ vec3 srgb_to_linear(vec3 c);
// Util
vec3 hue_to_rgb(float hue);
vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
float perceptualRoughness,
vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
float perceptualRoughness,
float metallic,
vec3 n, // normal
vec3 v, // surface point to camera
@ -91,7 +91,7 @@ void main()
float metallic = orm.b;
vec3 f0 = vec3(0.04);
vec3 baseColor = diffuse.rgb;
vec3 diffuseColor = baseColor.rgb*(vec3(1.0)-f0);
diffuseColor *= 1.0 - metallic;

View File

@ -1,28 +1,28 @@
/**
/**
* @file class3\deferred\pointLightF.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, 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$
*/
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@ -59,8 +59,8 @@ vec2 getScreenCoord(vec4 clip);
vec3 srgb_to_linear(vec3 c);
float getDepth(vec2 tc);
vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
float perceptualRoughness,
vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
float perceptualRoughness,
float metallic,
vec3 n, // normal
vec3 v, // surface point to camera
@ -93,13 +93,13 @@ void main()
if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
{
vec3 colorEmissive = texture(emissiveRect, tc).rgb;
vec3 colorEmissive = texture(emissiveRect, tc).rgb;
vec3 orm = spec.rgb;
float perceptualRoughness = orm.g;
float metallic = orm.b;
vec3 f0 = vec3(0.04);
vec3 baseColor = diffuse.rgb;
vec3 diffuseColor = baseColor.rgb*(vec3(1.0)-f0);
diffuseColor *= 1.0 - metallic;
@ -136,7 +136,7 @@ void main()
final_color += lit*scol*color.rgb*spec.rgb;
}
}
if (dot(final_color, final_color) <= 0.0)
{
discard;

View File

@ -51,7 +51,7 @@ layout (std140) uniform ReflectionProbes
mat4 heroBox;
// list of bounding spheres for reflection probes sorted by distance to camera (closest first)
vec4 refSphere[MAX_REFMAP_COUNT];
// extra parameters
// extra parameters
// x - irradiance scale
// y - radiance scale
// z - fade in
@ -102,7 +102,7 @@ bool shouldSampleProbe(int i, vec3 pos)
if (refIndex[i].w < 0)
{
vec4 v = refBox[i] * vec4(pos, 1.0);
if (abs(v.x) > 1 ||
if (abs(v.x) > 1 ||
abs(v.y) > 1 ||
abs(v.z) > 1)
{
@ -229,7 +229,7 @@ void preProbeSample(vec3 pos)
}
}
count++;
++neighborIdx;
}
@ -251,56 +251,56 @@ void preProbeSample(vec3 pos)
// original reference implementation:
/*
bool intersect(const Ray &ray) const
{
float t0, t1; // solutions for t if the ray intersects
#if 0
bool intersect(const Ray &ray) const
{
float t0, t1; // solutions for t if the ray intersects
#if 0
// geometric solution
Vec3f L = center - orig;
float tca = L.dotProduct(dir);
Vec3f L = center - orig;
float tca = L.dotProduct(dir);
// if (tca < 0) return false;
float d2 = L.dotProduct(L) - tca * tca;
if (d2 > radius2) return false;
float thc = sqrt(radius2 - d2);
t0 = tca - thc;
t1 = tca + thc;
#else
float d2 = L.dotProduct(L) - tca * tca;
if (d2 > radius2) return false;
float thc = sqrt(radius2 - d2);
t0 = tca - thc;
t1 = tca + thc;
#else
// analytic solution
Vec3f L = orig - center;
float a = dir.dotProduct(dir);
float b = 2 * dir.dotProduct(L);
float c = L.dotProduct(L) - radius2;
if (!solveQuadratic(a, b, c, t0, t1)) return false;
#endif
if (t0 > t1) std::swap(t0, t1);
if (t0 < 0) {
t0 = t1; // if t0 is negative, let's use t1 instead
if (t0 < 0) return false; // both t0 and t1 are negative
}
t = t0;
return true;
Vec3f L = orig - center;
float a = dir.dotProduct(dir);
float b = 2 * dir.dotProduct(L);
float c = L.dotProduct(L) - radius2;
if (!solveQuadratic(a, b, c, t0, t1)) return false;
#endif
if (t0 > t1) std::swap(t0, t1);
if (t0 < 0) {
t0 = t1; // if t0 is negative, let's use t1 instead
if (t0 < 0) return false; // both t0 and t1 are negative
}
t = t0;
return true;
} */
// adapted -- assume that origin is inside sphere, return intersection of ray with edge of sphere
vec3 sphereIntersect(vec3 origin, vec3 dir, vec3 center, float radius2)
{
float t0, t1; // solutions for t if the ray intersects
{
float t0, t1; // solutions for t if the ray intersects
vec3 L = center - origin;
vec3 L = center - origin;
float tca = dot(L,dir);
float d2 = dot(L,L) - tca * tca;
float d2 = dot(L,L) - tca * tca;
float thc = sqrt(radius2 - d2);
t0 = tca - thc;
t1 = tca + thc;
float thc = sqrt(radius2 - d2);
t0 = tca - thc;
t1 = tca + thc;
vec3 v = origin + dir * t1;
return v;
}
return v;
}
void swap(inout float a, inout float b)
{
@ -312,17 +312,17 @@ void swap(inout float a, inout float b)
// debug implementation, make no assumptions about origin
void sphereIntersectDebug(vec3 origin, vec3 dir, vec3 center, float radius2, float depth, inout vec4 col)
{
float t[2]; // solutions for t if the ray intersects
float t[2]; // solutions for t if the ray intersects
// geometric solution
vec3 L = center - origin;
vec3 L = center - origin;
float tca = dot(L, dir);
// if (tca < 0) return false;
float d2 = dot(L, L) - tca * tca;
if (d2 > radius2) return;
float thc = sqrt(radius2 - d2);
t[0] = tca - thc;
t[1] = tca + thc;
float d2 = dot(L, L) - tca * tca;
if (d2 > radius2) return;
float thc = sqrt(radius2 - d2);
t[0] = tca - thc;
t[1] = tca + thc;
for (int i = 0; i < 2; ++i)
{
@ -411,8 +411,8 @@ void debugBoxCol(vec3 ro, vec3 rd, float t, vec3 p, inout vec4 col)
bool behind = dot(v,v) > dot(pos,pos);
float w = 0.25;
if (behind)
if (behind)
{
w *= 0.5;
w /= (length(v)-length(pos))*0.5+1.0;
@ -426,7 +426,7 @@ void debugBoxCol(vec3 ro, vec3 rd, float t, vec3 p, inout vec4 col)
// cribbed from https://iquilezles.org/articles/intersectors/
// axis aligned box centered at the origin, with size boxSize
void boxIntersectionDebug( in vec3 ro, in vec3 p, vec3 boxSize, inout vec4 col)
void boxIntersectionDebug( in vec3 ro, in vec3 p, vec3 boxSize, inout vec4 col)
{
vec3 rd = normalize(p-ro);
@ -453,7 +453,7 @@ void boxIntersectionDebug( in vec3 ro, in vec3 p, vec3 boxSize, inout vec4 col)
void boxIntersectDebug(vec3 origin, vec3 pos, mat4 i, inout vec4 col)
{
mat4 clipToLocal = i;
// transform into unit cube space
origin = (clipToLocal * vec4(origin, 1.0)).xyz;
pos = (clipToLocal * vec4(pos, 1.0)).xyz;
@ -471,7 +471,7 @@ void boxIntersectDebug(vec3 origin, vec3 pos, mat4 i, inout vec4 col)
// dw - distance weight
float sphereWeight(vec3 pos, vec3 dir, vec3 origin, float r, vec4 i, out float dw)
{
float r1 = r * 0.5; // 50% of radius (outer sphere to start interpolating down)
float r1 = r * 0.5; // 50% of radius (outer sphere to start interpolating down)
vec3 delta = pos.xyz - origin;
float d2 = max(length(delta), 0.001);
@ -495,7 +495,7 @@ float sphereWeight(vec3 pos, vec3 dir, vec3 origin, float r, vec4 i, out float d
// lod - which mip to sample (lower is higher res, sharper reflections)
// c - center of probe
// r2 - radius of probe squared
// i - index of probe
// i - index of probe
vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c, int i)
{
// parallax adjustment
@ -514,7 +514,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c,
float rr = r * r;
v = sphereIntersect(pos, dir, c,
v = sphereIntersect(pos, dir, c,
refIndex[i].w < 1 ? 4096.0*4096.0 : // <== effectively disable parallax correction for automatically placed probes to keep from bombing the world with obvious spheres
rr);
@ -525,7 +525,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c,
vec3 d = normalize(v);
v = env_mat * v;
vec4 ret = textureLod(reflectionProbes, vec4(v.xyz, refIndex[i].x), lod) * refParams[i].y;
return ret.rgb;
@ -536,7 +536,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c,
// dir - pixel normal
// w - weight of sample (distance and angular attenuation)
// dw - weight of sample (distance only)
// i - index of probe
// i - index of probe
vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int i, vec3 amblit)
{
// parallax adjustment
@ -554,7 +554,7 @@ vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int
// pad sphere for manual probe extending into automatic probe space
float rr = r * r;
v = sphereIntersect(pos, dir, c,
v = sphereIntersect(pos, dir, c,
refIndex[i].w < 1 ? 4096.0*4096.0 : // <== effectively disable parallax correction for automatically placed probes to keep from bombing the world with obvious spheres
rr);
@ -563,7 +563,7 @@ vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int
v -= c;
v = env_mat * v;
vec3 col = textureLod(irradianceProbes, vec4(v.xyz, refIndex[i].x), 0).rgb * refParams[i].x;
col = mix(amblit, col, min(refParams[i].x, 1.0));
@ -625,7 +625,7 @@ vec3 sampleProbes(vec3 pos, vec3 dir, float lod)
col[1] *= 1.0/wsum[1];
col[0] = vec3(0);
}
return col[1]+col[0];
}
@ -654,7 +654,7 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir, vec3 amblit)
{
continue;
}
{
float w = 0;
float dw = 0;
@ -684,7 +684,7 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir, vec3 amblit)
col[1] *= 1.0/wsum[1];
col[0] = vec3(0);
}
return col[1]+col[0];
}
@ -704,13 +704,13 @@ void tapHeroProbe(inout vec3 glossenv, vec3 pos, vec3 norm, float glossiness)
{
float d = 0;
boxIntersect(pos, norm, heroBox, d, 1.0);
w = max(d, 0);
}
else
{
float r = heroSphere.w;
w = sphereWeight(pos, refnormpersp, heroSphere.xyz, r, vec4(1), dw);
}
@ -851,9 +851,9 @@ void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout
{
float lod = (1.0-glossiness)*reflection_lods;
glossenv = sampleProbes(pos, normalize(refnormpersp), lod);
}
if (envIntensity > 0.0)
{
legacyenv = sampleProbes(pos, normalize(refnormpersp), 0.0);

View File

@ -52,7 +52,7 @@ float random (vec2 uv);
float tapScreenSpaceReflection(int totalSamples, vec2 tc, vec3 viewPos, vec3 n, inout vec4 collectedColor, sampler2D source, float glossiness);
void main()
void main()
{
vec2 tc = vary_fragcoord.xy;
float depth = linearDepth01(getDepth(tc), zNear, zFar);
@ -60,13 +60,13 @@ void main()
vec3 pos = getPositionWithDepth(tc, getDepth(tc)).xyz;
vec4 spec = texture(specularRect, tc);
vec2 hitpixel;
vec4 diffuse = texture(diffuseRect, tc);
vec3 specCol = spec.rgb;
vec4 fcol = texture(diffuseMap, tc);
if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
{
vec3 orm = specCol.rgb;
float perceptualRoughness = orm.g;

View File

@ -105,8 +105,8 @@ vec3 pbrBaseLight(vec3 diffuseColor,
vec3 additive,
vec3 atten);
vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
float perceptualRoughness,
vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
float perceptualRoughness,
float metallic,
vec3 n, // normal
vec3 v, // surface point to camera
@ -169,15 +169,15 @@ void main()
if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
{
vec3 orm = spec.rgb;
vec3 orm = spec.rgb;
float perceptualRoughness = orm.g;
float metallic = orm.b;
float ao = orm.r;
// PBR IBL
float gloss = 1.0 - perceptualRoughness;
sampleReflectionProbes(irradiance, radiance, tc, pos.xyz, norm.xyz, gloss, false, amblit_linear);
adjustIrradiance(irradiance, ambocc);
@ -205,7 +205,7 @@ void main()
{
// legacy shaders are still writng sRGB to gbuffer
baseColor.rgb = srgb_to_linear(baseColor.rgb);
spec.rgb = srgb_to_linear(spec.rgb);
float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0);
@ -224,7 +224,7 @@ void main()
vec3 sun_contrib = min(da, scol) * sunlit_linear;
color.rgb += sun_contrib;
color.rgb *= baseColor.rgb;
vec3 refnormpersp = reflect(pos.xyz, norm.xyz);
if (spec.a > 0.0)
@ -254,7 +254,7 @@ void main()
}
color.rgb = mix(color.rgb, baseColor.rgb, baseColor.a);
if (envIntensity > 0.0)
{ // add environment map
applyLegacyEnv(color, legacyenv, spec, pos.xyz, norm.xyz, envIntensity);

View File

@ -1,28 +1,28 @@
/**
/**
* @file class3\deferred\spotLightF.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, 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$
*/
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@ -83,8 +83,8 @@ vec4 getPosition(vec2 pos_screen);
const float M_PI = 3.14159265;
vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
float perceptualRoughness,
vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
float perceptualRoughness,
float metallic,
vec3 n, // normal
vec3 v, // surface point to camera
@ -112,13 +112,13 @@ void main()
}
float shadow = 1.0;
if (proj_shadow_idx >= 0)
{
vec4 shd = texture(lightMap, tc);
shadow = (proj_shadow_idx==0)?shd.b:shd.a;
shadow += shadow_fade;
shadow = clamp(shadow, 0.0, 1.0);
shadow = clamp(shadow, 0.0, 1.0);
}
vec4 norm = getNorm(tc);
@ -149,7 +149,7 @@ void main()
float metallic = orm.b;
vec3 f0 = vec3(0.04);
vec3 baseColor = diffuse.rgb;
vec3 diffuseColor = baseColor.rgb*(vec3(1.0)-f0);
diffuseColor *= 1.0 - metallic;
@ -167,7 +167,7 @@ void main()
if (nl > 0.0)
{
amb_da += (nl*0.5 + 0.5) * proj_ambiance;
dlit = getProjectedLightDiffuseColor( l_dist, proj_tc.xy );
vec3 intensity = dist_atten * dlit * 3.25 * shadow; // Legacy attenuation, magic number to balance with legacy materials
@ -205,11 +205,11 @@ void main()
// unshadowed for consistency between forward and deferred?
amb_da += (nl*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance;
}
amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, 1.0, proj_tc.xy );
final_color += diffuse.rgb * amb_rgb * max(dot(-normalize(lv), n), 0.0);
}
if (spec.a > 0.0)
{
dlit *= min(nl*6.0, 1.0) * dist_atten;
@ -218,7 +218,7 @@ void main()
float gtdenom = 2 * nh;
float gt = max(0, min(gtdenom * nv / vh, gtdenom * nl / vh));
if (nh > 0.0)
{
float scol = fres*texture(lightFunc, vec2(nh, spec.a)).r*gt/(nh*nl);
@ -226,26 +226,26 @@ void main()
speccol = clamp(speccol, vec3(0), vec3(1));
final_color += speccol;
}
}
}
if (envIntensity > 0.0)
{
vec3 ref = reflect(normalize(pos), n);
//project from point pos in direction ref to plane proj_p, proj_n
vec3 pdelta = proj_p-pos;
float ds = dot(ref, proj_n);
if (ds < 0.0)
{
vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds;
vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0));
if (stc.z > 0.0)
{
stc /= stc.w;
if (stc.x < 1.0 &&
stc.y < 1.0 &&
stc.x > 0.0 &&

View File

@ -43,7 +43,7 @@ void main()
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
@ -60,5 +60,5 @@ void main()
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

@ -198,7 +198,7 @@ void Animation::Sampler::getFrameInfo(Asset& asset, F32 time, U32& frameIndex, F
return;
}
for (U32 i = 0; i < mFrameTimes.size() - 1; i++)
for (U32 i = 0; i < (U32)mFrameTimes.size() - 1; i++)
{
if (time >= mFrameTimes[i] && time < mFrameTimes[i + 1])
{

View File

@ -46,7 +46,7 @@ LLFetchedGLTFMaterial::LLFetchedGLTFMaterial()
LLFetchedGLTFMaterial::~LLFetchedGLTFMaterial()
{
}
LLFetchedGLTFMaterial& LLFetchedGLTFMaterial::operator=(const LLFetchedGLTFMaterial& rhs)
@ -253,4 +253,3 @@ void LLFetchedGLTFMaterial::materialComplete(bool success)
materialCompleteCallbacks.clear();
materialCompleteCallbacks.shrink_to_fit();
}

View File

@ -70,7 +70,7 @@ public:
static LLFetchedGLTFMaterial sDefault;
protected:
// Lifetime management
void materialBegin();
void materialComplete(bool success);

View File

@ -79,14 +79,14 @@ public:
static void flushUpdates(void(*done_callback)(bool) = nullptr);
static void addSelectionUpdateCallback(void(*update_callback)(const LLUUID& object_id, S32 side));
// Queue an explicit LLSD ModifyMaterialParams update apply given override data
// overrides -- LLSD map (or array of maps) in the format:
// object_id UUID(required) id of object
// side integer(required) TE index of face to set, or -1 for all faces
// gltf_json string(optional) override data to set, empty string nulls out override data, omissions of this parameter keeps existing data
// asset_id UUID(optional) id of material asset to set, omission of this parameter keeps existing material asset id
//
//
// NOTE: Unless you already have a gltf_json string you want to send, strongly prefer using queueModify
// If the queue/flush API is insufficient, extend it.
static void queueUpdate(const LLSD& data);

View File

@ -51,18 +51,18 @@ class alignas(16) LLHeroProbeManager
{
LL_ALIGN_NEW
public:
enum class DetailLevel
enum class DetailLevel
{
STATIC_ONLY = 0,
STATIC_AND_DYNAMIC,
REALTIME = 2
};
// allocate an environment map of the given resolution
// allocate an environment map of the given resolution
LLHeroProbeManager();
~LLHeroProbeManager();
// release any GL state
// release any GL state
void cleanup();
// maintain reflection probes
@ -90,11 +90,11 @@ public:
LLVector3 mMirrorPosition;
LLVector3 mMirrorNormal;
HeroProbeData mHeroData;
private:
friend class LLPipeline;
friend class LLReflectionMapManager;
// update UBO used for rendering (call only once per render pipe flush)
void updateUniforms();
@ -103,7 +103,7 @@ private:
// render target for cube snapshots
// used to generate mipmaps without doing a copy-to-texture
LLRenderTarget mRenderTarget;
LLRenderTarget mHeroRenderTarget;
std::vector<LLRenderTarget> mMipChain;
@ -120,7 +120,7 @@ private:
// update the specified face of the specified probe
void updateProbeFace(LLReflectionMap* probe, U32 face, bool is_dynamic, F32 near_clip);
void generateRadiance(LLReflectionMap *probe);
// list of active reflection maps
std::vector<LLPointer<LLReflectionMap>> mProbes;
@ -136,10 +136,10 @@ private:
// resolution of reflection probes
U32 mProbeResolution = 1024;
// maximum LoD of reflection probes (mip levels - 1)
F32 mMaxProbeLOD = 6.f;
F32 mHeroProbeStrength = 1.f;
bool mIsInTransition = false;
@ -148,9 +148,9 @@ private:
bool mRenderingMirror = false;
std::map<int, int> mFaceUpdateList;
U32 mCurrentProbeUpdateFrame = 0;
std::vector<LLPointer<LLVOVolume>> mHeroVOList;
LLPointer<LLVOVolume> mNearestHero;

View File

@ -56,7 +56,7 @@ void LLReflectionMap::update(U32 resolution, U32 face, bool force_dynamic, F32 n
llassert(mCubeArray.notNull());
llassert(mCubeIndex != -1);
//llassert(LLPipeline::sRenderDeferred);
// make sure we don't walk off the edge of the render target
while (resolution > gPipeline.mRT->deferredScreen.getWidth() ||
resolution > gPipeline.mRT->deferredScreen.getHeight())
@ -65,7 +65,7 @@ void LLReflectionMap::update(U32 resolution, U32 face, bool force_dynamic, F32 n
}
F32 clip = (near_clip > 0) ? near_clip : getNearClip();
gViewerWindow->cubeSnapshot(LLVector3(mOrigin), mCubeArray, mCubeIndex, face, clip, getIsDynamic() || force_dynamic, useClipPlane, clipPlane);
}
@ -145,7 +145,7 @@ void LLReflectionMap::autoAdjustOrigin()
LLVector3 origin(fp);
F32 height = LLWorld::instance().resolveLandHeightAgent(origin) + 2.f;
fp[2] = llmax(fp[2], height);
// make sure radius encompasses all objects
LLSimdScalar r2 = 0.0;
for (int i = 0; i < 8; ++i)
@ -165,7 +165,7 @@ void LLReflectionMap::autoAdjustOrigin()
// make sure near clip doesn't poke through ground
fp[2] = llmax(fp[2], height+mRadius*0.5f);
}
}
else if (mViewerObject && !mViewerObject->isDead())
@ -237,7 +237,7 @@ F32 LLReflectionMap::getNearClip()
bool LLReflectionMap::getIsDynamic()
{
if (gSavedSettings.getS32("RenderReflectionProbeDetail") > (S32) LLReflectionMapManager::DetailLevel::STATIC_ONLY &&
mViewerObject &&
mViewerObject &&
mViewerObject->getVolume())
{
return ((LLVOVolume*)mViewerObject)->getReflectionProbeIsDynamic();
@ -247,7 +247,7 @@ bool LLReflectionMap::getIsDynamic()
}
bool LLReflectionMap::getBox(LLMatrix4& box)
{
{
if (mViewerObject)
{
LLVolume* volume = mViewerObject->getVolume();
@ -270,7 +270,7 @@ bool LLReflectionMap::getBox(LLMatrix4& box)
// construct object to camera space (with scale)
mv = mv * rm * scale;
// inverse is camera space to object unit cube
// inverse is camera space to object unit cube
mv = mv.inverse();
box = LLMatrix4(mv.m);
@ -337,7 +337,7 @@ void LLReflectionMap::doOcclusion(const LLVector4a& eye)
mOccluded = false;
return;
}
if (mOcclusionQuery == 0)
{ // no query was previously issued, allocate one and issue
LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("rmdo - glGenQueries");

View File

@ -36,7 +36,7 @@ class alignas(16) LLReflectionMap : public LLRefCount
{
LL_ALIGN_NEW
public:
enum class ProbeType
{
ALL = 0,
@ -44,8 +44,8 @@ public:
IRRADIANCE,
REFLECTION
};
// allocate an environment map of the given resolution
// allocate an environment map of the given resolution
LLReflectionMap();
~LLReflectionMap();
@ -86,7 +86,7 @@ public:
// point at which environment map was last generated from (in agent space)
LLVector4a mOrigin;
// distance from main viewer camera
F32 mDistance = -1.f;
@ -106,7 +106,7 @@ public:
// cube map used to sample this environment map
LLPointer<LLCubeMapArray> mCubeArray;
S32 mCubeIndex = -1; // index into cube map array or -1 if not currently stored in cube map array
// probe has had at least one full update and is ready to render
bool mComplete = false;
@ -136,7 +136,7 @@ public:
GLuint mOcclusionQuery = 0;
bool mOccluded = false;
U32 mOcclusionPendingFrames = 0;
ProbeType mType;
};

View File

@ -67,7 +67,7 @@ public:
// add a probe for the given spatial group
LLReflectionMap* addProbe(LLSpatialGroup* group = nullptr);
// Populate "maps" with the N most relevant Reflection Maps where N is no more than maps.size()
// If less than maps.size() ReflectionMaps are available, will assign trailing elements to nullptr.
// maps -- presized array of Reflection Map pointers
@ -160,7 +160,7 @@ private:
// update the specified face of the specified probe
void updateProbeFace(LLReflectionMap* probe, U32 face);
// list of active reflection maps
std::vector<LLPointer<LLReflectionMap> > mProbes;

View File

@ -2665,7 +2665,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory(
// *HACK: In order to resolve SL-22177, we need to block drags
// from notecards and objects onto other objects.
if ((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
{
return ACCEPT_NO;
}

View File

@ -1,25 +1,25 @@
/**
/**
* @file llvlcomposition.cpp
* @brief Viewer-side representation of a composition layer...
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, 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$
*/
@ -220,7 +220,7 @@ LLTerrainMaterials::Type LLTerrainMaterials::getMaterialType()
{
LL_PROFILE_ZONE_SCOPED;
const BOOL use_textures = texturesReady(false, false) || !materialsReady(false, false);
const bool use_textures = texturesReady(false, false) || !materialsReady(false, false);
return use_textures ? Type::TEXTURE : Type::PBR;
}
@ -428,8 +428,7 @@ const LLUUID (&LLVLComposition::getDefaultTextures())[ASSET_COUNT]
LLVLComposition::LLVLComposition(LLSurface *surfacep, const U32 width, const F32 scale) :
LLTerrainMaterials(),
LLViewerLayer(width, scale),
mParamsReady(false)
LLViewerLayer(width, scale)
{
// Load Terrain Textures - Original ones
const LLUUID (&default_textures)[LLVLComposition::ASSET_COUNT] = LLVLComposition::getDefaultTextures();
@ -471,7 +470,7 @@ bool LLVLComposition::generateHeights(const F32 x, const F32 y,
llassert(mSurfacep);
if (!mSurfacep || !mSurfacep->getRegion())
if (!mSurfacep || !mSurfacep->getRegion())
{
// We don't always have the region yet here....
return false;
@ -539,7 +538,7 @@ bool LLVLComposition::generateHeights(const F32 x, const F32 y,
vec[1] = (F32)(origin_global.mdV[VY]+location.mV[VY])*xyScaleInv;
vec[2] = height*zScaleInv;
//
// Choose material value by adding to the exact height a random value
// Choose material value by adding to the exact height a random value
//
vec1[0] = vec[0]*(0.2222222222f);
vec1[1] = vec[1]*(0.2222222222f);
@ -873,7 +872,7 @@ bool LLVLComposition::generateMinimapTileLand(const F32 x, const F32 y,
U32 st_comps = 3;
U32 st_width = BASE_SIZE;
U32 st_height = BASE_SIZE;
if (tex_comps != st_comps)
{
llassert(false);
@ -978,7 +977,7 @@ bool LLVLComposition::generateMinimapTileLand(const F32 x, const F32 y,
{
unboost_minimap_material(mDetailMaterials[i]);
}
return true;
}

View File

@ -1,25 +1,25 @@
/**
/**
* @file llvlcomposition.h
* @brief Viewer-side representation of a composition layer...
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, 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$
*/
@ -115,8 +115,7 @@ public:
bool generateHeights(const F32 x, const F32 y, const F32 width, const F32 height);
bool generateComposition();
// Generate texture from composition values.
bool generateMinimapTileLand(const F32 x, const F32 y, const F32 width, const F32 height);
bool generateTexture(const F32 x, const F32 y, const F32 width, const F32 height);
bool generateMinimapTileLand(const F32 x, const F32 y, const F32 width, const F32 height);
// Use these as indeces ito the get/setters below that use 'corner'
enum ECorner

View File

@ -6622,7 +6622,7 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LL
LL_DEBUGS("AnimatedObjects") << "adding attachment overrides for " << mesh_id
<< " to root object " << root_object->getID() << LL_ENDL;
}
bool fullRig = jointCnt>=JOINT_COUNT_REQUIRED_FOR_FULLRIG;
bool fullRig = jointCnt >= JOINT_COUNT_REQUIRED_FOR_FULLRIG;
if ( fullRig && !mesh_overrides_loaded )
{
for (unsigned int i = 0; i < jointCnt; ++i)

View File

@ -1877,13 +1877,13 @@ void LLVOCache::removeGenericExtrasForHandle(U64 handle)
auto* entry = mHandleEntryMap[handle];
if (entry)
{
LL_WARNS("GLTF", "VOCache") << "Removing generic extras for handle " << entry->mHandle << "Filename: " << getObjectCacheExtrasFilename(handle) << LL_ENDL;
removeEntry(entry);
}
else
{
//shouldn't happen, but if it does, we should remove the extras file since it's orphaned
LL_WARNS("GLTF", "VOCache") << "Removing generic extras for handle " << entry->mHandle << "Filename: " << getObjectCacheExtrasFilename(handle) << LL_ENDL;
LLFile::remove(getObjectCacheExtrasFilename(entry->mHandle));
LLFile::remove(getObjectCacheExtrasFilename(handle));
}
}
@ -1902,9 +1902,7 @@ void LLVOCache::writeGenericExtrasToCache(U64 handle, const LLUUID& id, const LL
return;
}
// <FS:Beq> FIRE-33808 - Material Override Cache causes long delays
std::string filename = getObjectCacheExtrasFilename(handle);
// </FS:Beq>
llofstream out(filename, std::ios::out | std::ios::binary);
if(!out.good())
{

View File

@ -776,10 +776,6 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY;
if (mRT == &mMainRT)
{ // hacky -- allocate auxillary buffer
gCubeSnapshot = true;
mReflectionMapManager.initReflectionMaps();
mHeroProbeManager.initReflectionMaps();
if (sReflectionProbesEnabled)
{
gCubeSnapshot = true;