diff options
| author | Dave Parks <davep@lindenlab.com> | 2023-02-28 12:08:46 -0600 | 
|---|---|---|
| committer | Dave Parks <davep@lindenlab.com> | 2023-02-28 12:08:46 -0600 | 
| commit | 9a024172da94871716791174079c7f9f5eb23f45 (patch) | |
| tree | 09181115e44a29b5850f845e252223bdfa94f3e9 /indra/newview | |
| parent | 36f37ebf8a97cf1d5dacf6c8df41bf08375ac002 (diff) | |
| parent | 4478decbe8d085d1de02813712d8d55952e6c4b2 (diff) | |
Merge branch 'DRTVWR-559' of github.com:secondlife/viewer into DRTVWR-559
Diffstat (limited to 'indra/newview')
5 files changed, 49 insertions, 81 deletions
| diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl index a9e114dddc..e9515a9187 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl @@ -44,18 +44,10 @@ uniform mat4 modelview_matrix;  out vec3 vary_position; -uniform vec2 texture_base_color_scale; -uniform float texture_base_color_rotation; -uniform vec2 texture_base_color_offset; -uniform vec2 texture_normal_scale; -uniform float texture_normal_rotation; -uniform vec2 texture_normal_offset; -uniform vec2 texture_metallic_roughness_scale; -uniform float texture_metallic_roughness_rotation; -uniform vec2 texture_metallic_roughness_offset; -uniform vec2 texture_emissive_scale; -uniform float texture_emissive_rotation; -uniform vec2 texture_emissive_offset; +uniform vec4[2] texture_base_color_transform; +uniform vec4[2] texture_normal_transform; +uniform vec4[2] texture_metallic_roughness_transform; +uniform vec4[2] texture_emissive_transform;  out vec3 vary_fragcoord; @@ -78,7 +70,7 @@ out vec3 vary_tangent;  flat out float vary_sign;  out vec3 vary_normal; -vec2 texture_transform(vec2 vertex_texcoord, vec2 khr_gltf_scale, float khr_gltf_rotation, vec2 khr_gltf_offset, mat4 sl_animation_transform); +vec2 texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform, mat4 sl_animation_transform);  void main() @@ -97,10 +89,10 @@ void main()      vary_fragcoord.xyz = vert.xyz + vec3(0,0,near_clip); -	base_color_texcoord = texture_transform(texcoord0, texture_base_color_scale, texture_base_color_rotation, texture_base_color_offset, texture_matrix0); -	normal_texcoord = texture_transform(texcoord0, texture_normal_scale, texture_normal_rotation, texture_normal_offset, texture_matrix0); -	metallic_roughness_texcoord = texture_transform(texcoord0, texture_metallic_roughness_scale, texture_metallic_roughness_rotation, texture_metallic_roughness_offset, texture_matrix0); -	emissive_texcoord = texture_transform(texcoord0, texture_emissive_scale, texture_emissive_rotation, texture_emissive_offset, texture_matrix0); +    base_color_texcoord = texture_transform(texcoord0, texture_base_color_transform, texture_matrix0); +    normal_texcoord = texture_transform(texcoord0, texture_normal_transform, texture_matrix0); +    metallic_roughness_texcoord = texture_transform(texcoord0, texture_metallic_roughness_transform, texture_matrix0); +    emissive_texcoord = texture_transform(texcoord0, texture_emissive_transform, texture_matrix0);  #ifdef HAS_SKIN  	vec3 n = (mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz; @@ -133,12 +125,8 @@ uniform mat4 modelview_matrix;  out vec3 vary_position; -uniform vec2 texture_base_color_scale; -uniform float texture_base_color_rotation; -uniform vec2 texture_base_color_offset; -uniform vec2 texture_emissive_scale; -uniform float texture_emissive_rotation; -uniform vec2 texture_emissive_offset; +uniform vec4[2] texture_base_color_transform; +uniform vec4[2] texture_emissive_transform;  in vec3 position;  in vec4 diffuse_color; @@ -149,7 +137,7 @@ out vec2 emissive_texcoord;  out vec4 vertex_color; -vec2 texture_transform(vec2 vertex_texcoord, vec2 khr_gltf_scale, float khr_gltf_rotation, vec2 khr_gltf_offset, mat4 sl_animation_transform); +vec2 texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform, mat4 sl_animation_transform);  void main() @@ -159,8 +147,8 @@ void main()      gl_Position = vert;      vary_position = vert.xyz; -	base_color_texcoord = texture_transform(texcoord0, texture_base_color_scale, texture_base_color_rotation, texture_base_color_offset, texture_matrix0); -	emissive_texcoord = texture_transform(texcoord0, texture_emissive_scale, texture_emissive_rotation, texture_emissive_offset, texture_matrix0); +    base_color_texcoord = texture_transform(texcoord0, texture_base_color_transform, texture_matrix0); +    emissive_texcoord = texture_transform(texcoord0, texture_emissive_transform, texture_matrix0);  	vertex_color = diffuse_color;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrglowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrglowV.glsl index b73d08cf0d..82a50a115c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbrglowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbrglowV.glsl @@ -34,12 +34,8 @@ uniform mat4 modelview_projection_matrix;  uniform mat4 texture_matrix0; -uniform vec2 texture_base_color_scale; -uniform float texture_base_color_rotation; -uniform vec2 texture_base_color_offset; -uniform vec2 texture_emissive_scale; -uniform float texture_emissive_rotation; -uniform vec2 texture_emissive_offset; +uniform vec4[2] texture_base_color_transform; +uniform vec4[2] texture_emissive_transform;  in vec3 position;  in vec4 emissive; @@ -51,7 +47,7 @@ out vec2 emissive_texcoord;  out vec4 vertex_emissive; -vec2 texture_transform(vec2 vertex_texcoord, vec2 khr_gltf_scale, float khr_gltf_rotation, vec2 khr_gltf_offset, mat4 sl_animation_transform); +vec2 texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform, mat4 sl_animation_transform);  void main()  { @@ -68,8 +64,8 @@ void main()      gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);   #endif -    base_color_texcoord = texture_transform(texcoord0, texture_base_color_scale, texture_base_color_rotation, texture_base_color_offset, texture_matrix0); -    emissive_texcoord = texture_transform(texcoord0, texture_emissive_scale, texture_emissive_rotation, texture_emissive_offset, texture_matrix0); +    base_color_texcoord = texture_transform(texcoord0, texture_base_color_transform, texture_matrix0); +    emissive_texcoord = texture_transform(texcoord0, texture_emissive_transform, texture_matrix0);      vertex_emissive = emissive;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl index 6f50aefdab..e2c23ac8f0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl @@ -38,18 +38,10 @@ uniform mat4 modelview_projection_matrix;  #endif  uniform mat4 texture_matrix0; -uniform vec2 texture_base_color_scale; -uniform float texture_base_color_rotation; -uniform vec2 texture_base_color_offset; -uniform vec2 texture_normal_scale; -uniform float texture_normal_rotation; -uniform vec2 texture_normal_offset; -uniform vec2 texture_metallic_roughness_scale; -uniform float texture_metallic_roughness_rotation; -uniform vec2 texture_metallic_roughness_offset; -uniform vec2 texture_emissive_scale; -uniform float texture_emissive_rotation; -uniform vec2 texture_emissive_offset; +uniform vec4[2] texture_base_color_transform; +uniform vec4[2] texture_normal_transform; +uniform vec4[2] texture_metallic_roughness_transform; +uniform vec4[2] texture_emissive_transform;  in vec3 position;  in vec4 diffuse_color; @@ -68,7 +60,7 @@ out vec3 vary_tangent;  flat out float vary_sign;  out vec3 vary_normal; -vec2 texture_transform(vec2 vertex_texcoord, vec2 khr_gltf_scale, float khr_gltf_rotation, vec2 khr_gltf_offset, mat4 sl_animation_transform); +vec2 texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform, mat4 sl_animation_transform);  void main()  { @@ -86,10 +78,10 @@ void main()  	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);   #endif -    base_color_texcoord = texture_transform(texcoord0, texture_base_color_scale, texture_base_color_rotation, texture_base_color_offset, texture_matrix0); -    normal_texcoord = texture_transform(texcoord0, texture_normal_scale, texture_normal_rotation, texture_normal_offset, texture_matrix0); -    metallic_roughness_texcoord = texture_transform(texcoord0, texture_metallic_roughness_scale, texture_metallic_roughness_rotation, texture_metallic_roughness_offset, texture_matrix0); -    emissive_texcoord = texture_transform(texcoord0, texture_emissive_scale, texture_emissive_rotation, texture_emissive_offset, texture_matrix0); +    base_color_texcoord = texture_transform(texcoord0, texture_base_color_transform, texture_matrix0); +    normal_texcoord = texture_transform(texcoord0, texture_normal_transform, texture_matrix0); +    metallic_roughness_texcoord = texture_transform(texcoord0, texture_metallic_roughness_transform, texture_matrix0); +    emissive_texcoord = texture_transform(texcoord0, texture_emissive_transform, texture_matrix0);  #ifdef HAS_SKIN  	vec3 n = (mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz; @@ -114,18 +106,10 @@ uniform mat4 modelview_projection_matrix;  uniform mat4 texture_matrix0; -uniform vec2 texture_base_color_scale; -uniform float texture_base_color_rotation; -uniform vec2 texture_base_color_offset; -uniform vec2 texture_normal_scale; -uniform float texture_normal_rotation; -uniform vec2 texture_normal_offset; -uniform vec2 texture_metallic_roughness_scale; -uniform float texture_metallic_roughness_rotation; -uniform vec2 texture_metallic_roughness_offset; -uniform vec2 texture_emissive_scale; -uniform float texture_emissive_rotation; -uniform vec2 texture_emissive_offset; +uniform vec4[2] texture_base_color_transform; +uniform vec4[2] texture_normal_transform; +uniform vec4[2] texture_metallic_roughness_transform; +uniform vec4[2] texture_emissive_transform;  in vec3 position;  in vec4 diffuse_color; @@ -136,15 +120,15 @@ out vec2 emissive_texcoord;  out vec4 vertex_color; -vec2 texture_transform(vec2 vertex_texcoord, vec2 khr_gltf_scale, float khr_gltf_rotation, vec2 khr_gltf_offset, mat4 sl_animation_transform); +vec2 texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform, mat4 sl_animation_transform);  void main()  {      //transform vertex      gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);  -    base_color_texcoord = texture_transform(texcoord0, texture_base_color_scale, texture_base_color_rotation, texture_base_color_offset, texture_matrix0); -    emissive_texcoord = texture_transform(texcoord0, texture_emissive_scale, texture_emissive_rotation, texture_emissive_offset, texture_matrix0); +    base_color_texcoord = texture_transform(texcoord0, texture_base_color_transform, texture_matrix0); +    emissive_texcoord = texture_transform(texcoord0, texture_emissive_transform, texture_matrix0);      vertex_color = diffuse_color;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/textureUtilV.glsl b/indra/newview/app_settings/shaders/class1/deferred/textureUtilV.glsl index 39cc07d2d1..71f7ec52c4 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/textureUtilV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/textureUtilV.glsl @@ -58,7 +58,7 @@ vec2 khr_texture_transform(vec2 texcoord, vec2 scale, float rotation, vec2 offse  //     animations, available through LSL script functions such as  //     LlSetTextureAnim. It assumes a right-handed UV coordinate system.  // texcoord - The final texcoord to use for image sampling -vec2 texture_transform(vec2 vertex_texcoord, vec2 khr_gltf_scale, float khr_gltf_rotation, vec2 khr_gltf_offset, mat4 sl_animation_transform) +vec2 texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform, mat4 sl_animation_transform)  {      vec2 texcoord = vertex_texcoord; @@ -67,7 +67,7 @@ vec2 texture_transform(vec2 vertex_texcoord, vec2 khr_gltf_scale, float khr_gltf      // Convert to left-handed coordinate system. The offset of 1 is necessary      // for rotations to be applied correctly.      texcoord.y = 1.0 - texcoord.y; -    texcoord = khr_texture_transform(texcoord, khr_gltf_scale, khr_gltf_rotation, khr_gltf_offset); +    texcoord = khr_texture_transform(texcoord, khr_gltf_transform[0].xy, khr_gltf_transform[0].z, khr_gltf_transform[1].xy);      // Convert back to right-handed coordinate system      texcoord.y = 1.0 - texcoord.y; diff --git a/indra/newview/llfetchedgltfmaterial.cpp b/indra/newview/llfetchedgltfmaterial.cpp index 2f2c58aa3a..80074cc655 100644 --- a/indra/newview/llfetchedgltfmaterial.cpp +++ b/indra/newview/llfetchedgltfmaterial.cpp @@ -110,21 +110,21 @@ void LLFetchedGLTFMaterial::bind(LLViewerTexture* media_tex)          shader->uniform1f(LLShaderMgr::METALLIC_FACTOR, mMetallicFactor);          shader->uniform3fv(LLShaderMgr::EMISSIVE_COLOR, 1, mEmissiveColor.mV); -        shader->uniform2fv(LLShaderMgr::TEXTURE_BASE_COLOR_SCALE, 1, (F32*)mTextureTransform[GLTF_TEXTURE_INFO_BASE_COLOR].mScale.mV); -        shader->uniform1f(LLShaderMgr::TEXTURE_BASE_COLOR_ROTATION, mTextureTransform[GLTF_TEXTURE_INFO_BASE_COLOR].mRotation); -        shader->uniform2fv(LLShaderMgr::TEXTURE_BASE_COLOR_OFFSET, 1, (F32*)mTextureTransform[GLTF_TEXTURE_INFO_BASE_COLOR].mOffset.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); -        shader->uniform2fv(LLShaderMgr::TEXTURE_NORMAL_SCALE, 1, (F32*)mTextureTransform[GLTF_TEXTURE_INFO_NORMAL].mScale.mV); -        shader->uniform1f(LLShaderMgr::TEXTURE_NORMAL_ROTATION, mTextureTransform[GLTF_TEXTURE_INFO_NORMAL].mRotation); -        shader->uniform2fv(LLShaderMgr::TEXTURE_NORMAL_OFFSET, 1, (F32*)mTextureTransform[GLTF_TEXTURE_INFO_NORMAL].mOffset.mV); +        F32 normal_packed[8]; +        mTextureTransform[GLTF_TEXTURE_INFO_NORMAL].getPacked(normal_packed); +        shader->uniform4fv(LLShaderMgr::TEXTURE_NORMAL_TRANSFORM, 2, (F32*)normal_packed); -        shader->uniform2fv(LLShaderMgr::TEXTURE_METALLIC_ROUGHNESS_SCALE, 1, (F32*)mTextureTransform[GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS].mScale.mV); -        shader->uniform1f(LLShaderMgr::TEXTURE_METALLIC_ROUGHNESS_ROTATION, mTextureTransform[GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS].mRotation); -        shader->uniform2fv(LLShaderMgr::TEXTURE_METALLIC_ROUGHNESS_OFFSET, 1, (F32*)mTextureTransform[GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS].mOffset.mV); +        F32 metallic_roughness_packed[8]; +        mTextureTransform[GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS].getPacked(metallic_roughness_packed); +        shader->uniform4fv(LLShaderMgr::TEXTURE_METALLIC_ROUGHNESS_TRANSFORM, 2, (F32*)metallic_roughness_packed); -        shader->uniform2fv(LLShaderMgr::TEXTURE_EMISSIVE_SCALE, 1, (F32*)mTextureTransform[GLTF_TEXTURE_INFO_EMISSIVE].mScale.mV); -        shader->uniform1f(LLShaderMgr::TEXTURE_EMISSIVE_ROTATION, mTextureTransform[GLTF_TEXTURE_INFO_EMISSIVE].mRotation); -        shader->uniform2fv(LLShaderMgr::TEXTURE_EMISSIVE_OFFSET, 1, (F32*)mTextureTransform[GLTF_TEXTURE_INFO_EMISSIVE].mOffset.mV); +        F32 emissive_packed[8]; +        mTextureTransform[GLTF_TEXTURE_INFO_EMISSIVE].getPacked(emissive_packed); +        shader->uniform4fv(LLShaderMgr::TEXTURE_EMISSIVE_TRANSFORM, 2, (F32*)emissive_packed);      }  } | 
