Merge branch 'DRTVWR-559' of https://github.com/secondlife/viewer
commit
f9c0e60c49
|
|
@ -43,7 +43,7 @@ const char* const GLTF_FILE_EXTENSION_TRANSFORM_ROTATION = "rotation";
|
|||
// special UUID that indicates a null UUID in override data
|
||||
static const LLUUID GLTF_OVERRIDE_NULL_UUID = LLUUID("ffffffff-ffff-ffff-ffff-ffffffffffff");
|
||||
|
||||
void LLGLTFMaterial::TextureTransform::getPacked(F32 (&packed)[8])
|
||||
void LLGLTFMaterial::TextureTransform::getPacked(F32 (&packed)[8]) const
|
||||
{
|
||||
packed[0] = mScale.mV[VX];
|
||||
packed[1] = mScale.mV[VY];
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public:
|
|||
LLVector2 mScale = { 1.f, 1.f };
|
||||
F32 mRotation = 0.f;
|
||||
|
||||
void getPacked(F32 (&packed)[8]);
|
||||
void getPacked(F32 (&packed)[8]) const;
|
||||
|
||||
bool operator==(const TextureTransform& other) const;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ uniform sampler2D exposureMap;
|
|||
|
||||
uniform vec2 screen_res;
|
||||
VARYING vec2 vary_fragcoord;
|
||||
uniform float display_gamma;
|
||||
|
||||
vec3 linear_to_srgb(vec3 cl);
|
||||
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@ out vec4 frag_color;
|
|||
|
||||
uniform sampler2D diffuseMap;
|
||||
|
||||
VARYING vec4 post_pos;
|
||||
VARYING float target_pos_x;
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
in vec4 post_pos;
|
||||
in float target_pos_x;
|
||||
in vec4 vertex_color;
|
||||
in vec2 vary_texcoord0;
|
||||
uniform float minimum_alpha;
|
||||
|
||||
void main()
|
||||
|
|
|
|||
|
|
@ -27,26 +27,27 @@ uniform mat4 texture_matrix0;
|
|||
#if defined(HAS_SKIN)
|
||||
uniform mat4 modelview_matrix;
|
||||
uniform mat4 projection_matrix;
|
||||
mat4 getObjectSkinnedTransform();
|
||||
#else
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
#endif
|
||||
|
||||
uniform vec4[2] texture_base_color_transform;
|
||||
vec2 texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform, mat4 sl_animation_transform);
|
||||
|
||||
uniform float shadow_target_width;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
ATTRIBUTE vec4 diffuse_color;
|
||||
ATTRIBUTE vec2 texcoord0;
|
||||
in vec3 position;
|
||||
in vec4 diffuse_color;
|
||||
in vec2 texcoord0;
|
||||
|
||||
VARYING vec4 post_pos;
|
||||
VARYING float target_pos_x;
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
out vec4 post_pos;
|
||||
out float target_pos_x;
|
||||
out vec4 vertex_color;
|
||||
out vec2 vary_texcoord0;
|
||||
|
||||
void passTextureIndex();
|
||||
|
||||
#if defined(HAS_SKIN)
|
||||
mat4 getObjectSkinnedTransform();
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
|
|
@ -69,6 +70,6 @@ void main()
|
|||
|
||||
passTextureIndex();
|
||||
|
||||
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
|
||||
vary_texcoord0 = texture_transform(texcoord0, texture_base_color_transform, texture_matrix0);
|
||||
vertex_color = diffuse_color;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -651,12 +651,11 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir)
|
|||
return col[1]+col[0];
|
||||
}
|
||||
|
||||
void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
|
||||
void doProbeSample(inout vec3 ambenv, inout vec3 glossenv,
|
||||
vec2 tc, vec3 pos, vec3 norm, float glossiness)
|
||||
{
|
||||
// TODO - don't hard code lods
|
||||
float reflection_lods = max_probe_lod;
|
||||
preProbeSample(pos);
|
||||
|
||||
vec3 refnormpersp = reflect(pos.xyz, norm.xyz);
|
||||
|
||||
|
|
@ -676,10 +675,24 @@ void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
|
|||
#endif
|
||||
}
|
||||
|
||||
void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
|
||||
vec2 tc, vec3 pos, vec3 norm, float glossiness)
|
||||
{
|
||||
preProbeSample(pos);
|
||||
doProbeSample(ambenv, glossenv, tc, pos, norm, glossiness);
|
||||
}
|
||||
|
||||
void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv,
|
||||
vec2 tc, vec3 pos, vec3 norm, float glossiness)
|
||||
{
|
||||
sampleReflectionProbes(ambenv, glossenv, tc, pos, norm, glossiness);
|
||||
// don't sample automatic probes for water
|
||||
sample_automatic = false;
|
||||
preProbeSample(pos);
|
||||
sample_automatic = true;
|
||||
// always include void probe on water
|
||||
probeIndex[probeInfluences++] = 0;
|
||||
|
||||
doProbeSample(ambenv, glossenv, tc, pos, norm, glossiness);
|
||||
|
||||
// fudge factor to get PBR water at a similar luminance ot legacy water
|
||||
glossenv *= 0.4;
|
||||
|
|
|
|||
|
|
@ -527,7 +527,7 @@ void LLRenderPass::pushRiggedGLTFBatch(LLDrawInfo& params, LLVOAvatar*& lastAvat
|
|||
pushGLTFBatch(params);
|
||||
}
|
||||
|
||||
void LLRenderPass::pushBatches(U32 type, bool texture, bool batch_textures)
|
||||
void LLRenderPass::pushBatches(U32 type, bool texture, bool batch_textures, bool reset_gltf)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
//std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{};
|
||||
|
|
@ -548,11 +548,12 @@ void LLRenderPass::pushBatches(U32 type, bool texture, bool batch_textures)
|
|||
//}
|
||||
// </FS:Beq>
|
||||
|
||||
pushBatch(*pparams, texture, batch_textures);
|
||||
pushBatch(*pparams, texture, batch_textures, reset_gltf);
|
||||
reset_gltf = false;
|
||||
}
|
||||
}
|
||||
|
||||
void LLRenderPass::pushRiggedBatches(U32 type, bool texture, bool batch_textures)
|
||||
void LLRenderPass::pushRiggedBatches(U32 type, bool texture, bool batch_textures, bool reset_gltf)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
LLVOAvatar* lastAvatar = nullptr;
|
||||
|
|
@ -583,11 +584,12 @@ void LLRenderPass::pushRiggedBatches(U32 type, bool texture, bool batch_textures
|
|||
lastMeshId = pparams->mSkinInfo->mHash;
|
||||
}
|
||||
|
||||
pushBatch(*pparams, texture, batch_textures);
|
||||
pushBatch(*pparams, texture, batch_textures, reset_gltf);
|
||||
reset_gltf = false;
|
||||
}
|
||||
}
|
||||
|
||||
void LLRenderPass::pushMaskBatches(U32 type, bool texture, bool batch_textures)
|
||||
void LLRenderPass::pushMaskBatches(U32 type, bool texture, bool batch_textures, bool reset_gltf)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
//std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{};
|
||||
|
|
@ -608,11 +610,12 @@ void LLRenderPass::pushMaskBatches(U32 type, bool texture, bool batch_textures)
|
|||
//}
|
||||
// </FS:Beq>
|
||||
LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(pparams->mAlphaMaskCutoff);
|
||||
pushBatch(*pparams, texture, batch_textures);
|
||||
pushBatch(*pparams, texture, batch_textures, reset_gltf);
|
||||
reset_gltf = false;
|
||||
}
|
||||
}
|
||||
|
||||
void LLRenderPass::pushRiggedMaskBatches(U32 type, bool texture, bool batch_textures)
|
||||
void LLRenderPass::pushRiggedMaskBatches(U32 type, bool texture, bool batch_textures, bool reset_gltf)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
LLVOAvatar* lastAvatar = nullptr;
|
||||
|
|
@ -653,7 +656,8 @@ void LLRenderPass::pushRiggedMaskBatches(U32 type, bool texture, bool batch_text
|
|||
lastMeshId = pparams->mSkinInfo->mHash;
|
||||
}
|
||||
|
||||
pushBatch(*pparams, texture, batch_textures);
|
||||
pushBatch(*pparams, texture, batch_textures, reset_gltf);
|
||||
reset_gltf = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -672,7 +676,14 @@ void LLRenderPass::applyModelMatrix(const LLDrawInfo& params)
|
|||
}
|
||||
}
|
||||
|
||||
void LLRenderPass::pushBatch(LLDrawInfo& params, bool texture, bool batch_textures)
|
||||
void LLRenderPass::resetGLTFTextureTransform()
|
||||
{
|
||||
F32 ignore_gltf_transform[8];
|
||||
LLGLTFMaterial::sDefault.mTextureTransform[LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR].getPacked(ignore_gltf_transform);
|
||||
LLGLSLShader::sCurBoundShaderPtr->uniform4fv(LLShaderMgr::TEXTURE_BASE_COLOR_TRANSFORM, 2, (F32*)ignore_gltf_transform);
|
||||
}
|
||||
|
||||
void LLRenderPass::pushBatch(LLDrawInfo& params, bool texture, bool batch_textures, bool reset_gltf)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
if (!params.mCount)
|
||||
|
|
@ -681,6 +692,7 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, bool texture, bool batch_textur
|
|||
}
|
||||
|
||||
applyModelMatrix(params);
|
||||
if (reset_gltf) { resetGLTFTextureTransform(); }
|
||||
|
||||
bool tex_setup = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -349,15 +349,17 @@ public:
|
|||
void resetDrawOrders() { }
|
||||
|
||||
static void applyModelMatrix(const LLDrawInfo& params);
|
||||
virtual void pushBatches(U32 type, bool texture = true, bool batch_textures = false);
|
||||
virtual void pushRiggedBatches(U32 type, bool texture = true, bool batch_textures = false);
|
||||
static void resetGLTFTextureTransform();
|
||||
virtual void pushBatches(U32 type, bool texture = true, bool batch_textures = false, bool reset_gltf = false);
|
||||
virtual void pushRiggedBatches(U32 type, bool texture = true, bool batch_textures = false, bool reset_gltf = false);
|
||||
void pushGLTFBatches(U32 type);
|
||||
void pushGLTFBatch(LLDrawInfo& params);
|
||||
void pushRiggedGLTFBatches(U32 type);
|
||||
void pushRiggedGLTFBatch(LLDrawInfo& params, LLVOAvatar*& lastAvatar, U64& lastMeshId);
|
||||
virtual void pushMaskBatches(U32 type, bool texture = true, bool batch_textures = false);
|
||||
virtual void pushRiggedMaskBatches(U32 type, bool texture = true, bool batch_textures = false);
|
||||
virtual void pushBatch(LLDrawInfo& params, bool texture, bool batch_textures = false);
|
||||
virtual void pushMaskBatches(U32 type, bool texture = true, bool batch_textures = false, bool reset_gltf = false);
|
||||
virtual void pushRiggedMaskBatches(U32 type, bool texture = true, bool batch_textures = false, bool reset_gltf = false);
|
||||
// reset_gltf: batch is interleaved with GLTF batches that share the same shader
|
||||
virtual void pushBatch(LLDrawInfo& params, bool texture, bool batch_textures = false, bool reset_gltf = false);
|
||||
static bool uploadMatrixPalette(LLDrawInfo& params);
|
||||
static bool uploadMatrixPalette(LLVOAvatar* avatar, LLMeshSkinInfo* skinInfo);
|
||||
virtual void renderGroup(LLSpatialGroup* group, U32 type, bool texture = true);
|
||||
|
|
|
|||
|
|
@ -1259,13 +1259,15 @@ void LLDrawPoolBump::pushBumpBatches(U32 type)
|
|||
}
|
||||
}
|
||||
|
||||
void LLDrawPoolBump::pushBatch(LLDrawInfo& params, bool texture, bool batch_textures)
|
||||
void LLDrawPoolBump::pushBatch(LLDrawInfo& params, bool texture, bool batch_textures, bool reset_gltf)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
applyModelMatrix(params);
|
||||
|
||||
bool tex_setup = false;
|
||||
|
||||
if (reset_gltf) { LLRenderPass::resetGLTFTextureTransform(); }
|
||||
|
||||
if (batch_textures && params.mTextureList.size() > 1)
|
||||
{
|
||||
for (U32 i = 0; i < params.mTextureList.size(); ++i)
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public:
|
|||
LLDrawPoolBump();
|
||||
|
||||
/*virtual*/ void prerender() override;
|
||||
void pushBatch(LLDrawInfo& params, bool texture, bool batch_textures = false) override;
|
||||
void pushBatch(LLDrawInfo& params, bool texture, bool batch_textures = false, bool reset_gltf = false) override;
|
||||
|
||||
void pushBumpBatches(U32 type);
|
||||
void renderGroup(LLSpatialGroup* group, U32 type, bool texture) override;
|
||||
|
|
|
|||
|
|
@ -90,6 +90,10 @@ void LLFetchedGLTFMaterial::bind(LLViewerTexture* media_tex)
|
|||
gGL.getTexUnit(0)->bindFast(LLViewerFetchedTexture::sWhiteImagep);
|
||||
}
|
||||
|
||||
F32 base_color_packed[8];
|
||||
mTextureTransform[GLTF_TEXTURE_INFO_BASE_COLOR].getPacked(base_color_packed);
|
||||
shader->uniform4fv(LLShaderMgr::TEXTURE_BASE_COLOR_TRANSFORM, 2, (F32*)base_color_packed);
|
||||
|
||||
if (!LLPipeline::sShadowRender)
|
||||
{
|
||||
if (mNormalTexture.notNull() && mNormalTexture->getDiscardLevel() <= 4)
|
||||
|
|
@ -125,10 +129,6 @@ void LLFetchedGLTFMaterial::bind(LLViewerTexture* media_tex)
|
|||
shader->uniform1f(LLShaderMgr::METALLIC_FACTOR, mMetallicFactor);
|
||||
shader->uniform3fv(LLShaderMgr::EMISSIVE_COLOR, 1, mEmissiveColor.mV);
|
||||
|
||||
F32 base_color_packed[8];
|
||||
mTextureTransform[GLTF_TEXTURE_INFO_BASE_COLOR].getPacked(base_color_packed);
|
||||
shader->uniform4fv(LLShaderMgr::TEXTURE_BASE_COLOR_TRANSFORM, 2, (F32*)base_color_packed);
|
||||
|
||||
F32 normal_packed[8];
|
||||
mTextureTransform[GLTF_TEXTURE_INFO_NORMAL].getPacked(normal_packed);
|
||||
shader->uniform4fv(LLShaderMgr::TEXTURE_NORMAL_TRANSFORM, 2, (F32*)normal_packed);
|
||||
|
|
|
|||
|
|
@ -716,6 +716,16 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
|
|||
|
||||
LLColor3 ambient(getTotalAmbient());
|
||||
|
||||
F32 g = getGamma();
|
||||
if (ambient != LLColor3::black && getReflectionProbeAmbiance() == 0.f)
|
||||
{ //desaturate ambient for legacy compatibility
|
||||
F32 h, s, l;
|
||||
ambient.calcHSL(&h, &s, &l);
|
||||
s *= 0.5f;
|
||||
l *= 1.f / (g + llmax(g-1.f, 0.f));
|
||||
ambient.setHSL(h, s, l);
|
||||
}
|
||||
|
||||
if (irradiance_pass)
|
||||
{ // during an irradiance map update, disable ambient lighting (direct lighting only) and desaturate sky color (avoid tinting the world blue)
|
||||
shader->uniform3fv(LLShaderMgr::AMBIENT_LINEAR, LLVector3::zero.mV);
|
||||
|
|
@ -755,11 +765,7 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
|
|||
|
||||
shader->uniform1f(LLShaderMgr::HAZE_DENSITY_LINEAR, sRGBtoLinear(getHazeDensity()));
|
||||
|
||||
F32 g = getGamma();
|
||||
F32 display_gamma = gSavedSettings.getF32("RenderDeferredDisplayGamma");
|
||||
|
||||
shader->uniform1f(LLShaderMgr::GAMMA, g);
|
||||
shader->uniform1f(LLShaderMgr::DISPLAY_GAMMA, display_gamma);
|
||||
}
|
||||
|
||||
LLSettingsSky::parammapping_t LLSettingsVOSky::getParameterMap() const
|
||||
|
|
|
|||
|
|
@ -6947,7 +6947,7 @@ void LLPipeline::renderAlphaObjects(bool rigged)
|
|||
lastMeshId = pparams->mSkinInfo->mHash;
|
||||
}
|
||||
|
||||
mSimplePool->pushBatch(*pparams, true, true);
|
||||
mSimplePool->pushBatch(*pparams, true, true, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -6958,7 +6958,7 @@ void LLPipeline::renderAlphaObjects(bool rigged)
|
|||
}
|
||||
else
|
||||
{
|
||||
mSimplePool->pushBatch(*pparams, true, true);
|
||||
mSimplePool->pushBatch(*pparams, true, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6975,11 +6975,11 @@ void LLPipeline::renderMaskedObjects(U32 type, bool texture, bool batch_texture,
|
|||
gGLLastMatrix = NULL;
|
||||
if (rigged)
|
||||
{
|
||||
mAlphaMaskPool->pushRiggedMaskBatches(type+1, texture, batch_texture);
|
||||
mAlphaMaskPool->pushRiggedMaskBatches(type+1, texture, batch_texture, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
mAlphaMaskPool->pushMaskBatches(type, texture, batch_texture);
|
||||
mAlphaMaskPool->pushMaskBatches(type, texture, batch_texture, true);
|
||||
}
|
||||
gGL.loadMatrix(gGLModelView);
|
||||
gGLLastMatrix = NULL;
|
||||
|
|
@ -6993,11 +6993,11 @@ void LLPipeline::renderFullbrightMaskedObjects(U32 type, bool texture, bool batc
|
|||
gGLLastMatrix = NULL;
|
||||
if (rigged)
|
||||
{
|
||||
mFullbrightAlphaMaskPool->pushRiggedMaskBatches(type+1, texture, batch_texture);
|
||||
mFullbrightAlphaMaskPool->pushRiggedMaskBatches(type+1, texture, batch_texture, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
mFullbrightAlphaMaskPool->pushMaskBatches(type, texture, batch_texture);
|
||||
mFullbrightAlphaMaskPool->pushMaskBatches(type, texture, batch_texture, true);
|
||||
}
|
||||
gGL.loadMatrix(gGLModelView);
|
||||
gGLLastMatrix = NULL;
|
||||
|
|
@ -7192,7 +7192,7 @@ void LLPipeline::gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst) {
|
|||
|
||||
static LLCachedControl<F32> exposure(gSavedSettings, "RenderExposure", 1.f);
|
||||
|
||||
F32 e = llclamp(exposure(), 0.5f, 4.f);
|
||||
F32 e = llclamp(exposure(), 0.5f, 4.f);
|
||||
|
||||
static LLStaticHashedString s_exposure("exposure");
|
||||
|
||||
|
|
|
|||
|
|
@ -729,7 +729,7 @@
|
|||
name="1"
|
||||
value="1"/>
|
||||
<combo_box.item
|
||||
label="Manual + terrain and water"
|
||||
label="Manual + terrain"
|
||||
name="2"
|
||||
value="2"/>
|
||||
<combo_box.item
|
||||
|
|
|
|||
Loading…
Reference in New Issue