FIRE-30979 Fix Ambient Lighting in Mesh preview

and a couple of typo fixes
meow-7.2.2
Beq 2021-05-28 03:58:37 +01:00
parent 99027205df
commit b979ddef7d
4 changed files with 17 additions and 5 deletions

View File

@ -25,6 +25,7 @@
uniform mat3 normal_matrix;
uniform mat4 texture_matrix0;
uniform vec4 ambient_color; // <FS:Beq/> add ambient color to preview shader
uniform mat4 modelview_matrix;
uniform mat4 modelview_projection_matrix;
@ -87,7 +88,7 @@ void main()
vec3 norm = normalize(normal_matrix * normal);
vec4 col = vec4(0,0,0,1);
vec4 col = ambient_color; // <FS:Beq/> add ambient color to preview shader
// Collect normal lights (need to be divided by two, as we later multiply by 2)
col.rgb += light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz);

View File

@ -424,7 +424,7 @@ bool LLModelPreview::matchMaterialOrder(LLModel* lod, LLModel* ref, int& refFace
std::ostringstream out;
out << "material " << ref->mMaterialList[i]
<< " not found in lod adding placeholder";
LL_DEBUGS("MESHSKININFO") << out << LL_ENDL;
LL_DEBUGS("MESHSKININFO") << out.str() << LL_ENDL;
if (mImporterDebug)
{
LLFloaterModelPreview::addStringToLog(out, false);
@ -458,8 +458,8 @@ bool LLModelPreview::matchMaterialOrder(LLModel* lod, LLModel* ref, int& refFace
if (lod->mMaterialList.size() != ref->mMaterialList.size())
{
std::ostringstream out;
out << "Material of LOD model " << lod->getName() << " has more materials than a reference" << ref->getName() << ".";
LL_INFOS("MESHSKININFO") << out << LL_ENDL;
out << "Material of LOD model " << lod->getName() << " has more materials than the reference " << ref->getName() << ".";
LL_INFOS("MESHSKININFO") << out.str() << LL_ENDL;
LLFloaterModelPreview::addStringToLog(out, true);
return false;
}
@ -3371,6 +3371,7 @@ BOOL LLModelPreview::render()
gGL.loadIdentity();
gPipeline.enableLightsPreview();
gObjectPreviewProgram.uniform4fv(LLShaderMgr::AMBIENT, 1, LLPipeline::PreviewAmbientColor.mV); // <FS:Beq> pass ambient setting to shader
LLQuaternion camera_rot = LLQuaternion(mCameraPitch, LLVector3::y_axis) *
LLQuaternion(mCameraYaw, LLVector3::z_axis);

View File

@ -3219,7 +3219,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
if (success)
{
gObjectPreviewProgram.mName = "Simple Shader";
gObjectPreviewProgram.mName = "Preview Shader"; // <FS:Beq> update preview shader name
gObjectPreviewProgram.mFeatures.calculatesLighting = false;
gObjectPreviewProgram.mFeatures.calculatesAtmospherics = false;
gObjectPreviewProgram.mFeatures.hasGamma = false;

View File

@ -1492,6 +1492,16 @@
label="Model Edge"
tool_tip="Edge color for the model in preview window on the Mesh uploader"
name="mesh_preview_edge_color"/>
<color_swatch
control_name="PreviewAmbientColor"
follows="top|left"
left_pad="24"
height="64"
width="120"
can_apply_immediately="true"
label="Ambient Light"
tool_tip="Ambient light level in preview window (also affects animation preview etc)"
name="preview_ambient_color"/>
<text
type="string"
length="1"