From bd8d888ceab101db8e350b4b317823a316470ade Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 30 Nov 2010 00:25:44 -0600 Subject: Make importer use 3-light setup all the time --- indra/newview/app_settings/settings.xml | 172 +++++++++++++++++++++++++++++++- indra/newview/llfloatermodelpreview.cpp | 4 +- indra/newview/pipeline.cpp | 55 ++++++++++ indra/newview/pipeline.h | 1 + 4 files changed, 229 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0fc7d41ec7..61d6397109 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6457,7 +6457,177 @@ Value 13 - PrimMediaMasterEnabled + + PreviewAmbientColor + + Comment + Ambient color of preview render. + Persist + 1 + Type + Color4 + Value + + 0.0 + 0.0 + 0.0 + 1.0 + + + + + PreviewDiffuse0 + + Comment + Diffise color of preview light 0. + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 1.0 + 1.0 + + + + PreviewDiffuse1 + + Comment + Diffise color of preview light 1. + Persist + 1 + Type + Color4 + Value + + 0.25 + 0.25 + 0.25 + 1.0 + + + + PreviewDiffuse2 + + Comment + Diffise color of preview light 2. + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 1.0 + 1.0 + + + + PreviewSpecular0 + + Comment + Diffise color of preview light 0. + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 1.0 + 1.0 + + + + PreviewSpecular1 + + Comment + Diffise color of preview light 1. + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 1.0 + 1.0 + + + + PreviewSpecular2 + + Comment + Diffise color of preview light 2. + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 1.0 + 1.0 + + + + + PreviewDirection0 + + Comment + Direction of light 0 for preview render. + Persist + 1 + Type + Vector3 + Value + + -0.35 + 1 + 0.7 + + + + PreviewDirection1 + + Comment + Direction of light 1 for preview render. + Persist + 1 + Type + Vector3 + Value + + -1 + -1 + -0.6 + + + + PreviewDirection2 + + Comment + Direction of light 2 for preview render. + Persist + 1 + Type + Vector3 + Value + + -0.2 + -0.8 + -0.2 + + + + PrimMediaMasterEnabled Comment Whether or not Media on a Prim is enabled. diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 68c7e3c1a2..b82e9dd62f 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3369,6 +3369,8 @@ BOOL LLModelPreview::render() refresh(); } + gPipeline.enableLightsPreview(); + LLQuaternion camera_rot = LLQuaternion(mCameraPitch, LLVector3::y_axis) * LLQuaternion(mCameraYaw, LLVector3::z_axis); @@ -3383,8 +3385,6 @@ BOOL LLModelPreview::render() stop_glerror(); - gPipeline.enableLightsAvatar(); - gGL.pushMatrix(); const F32 BRIGHTNESS = 0.9f; gGL.color3f(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index a189d17dc8..1ebc0a6a09 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -5226,6 +5226,61 @@ void LLPipeline::enableLightsAvatar() enableLights(mask); } +void LLPipeline::enableLightsPreview() +{ + disableLights(); + + glEnable(GL_LIGHTING); + LLColor4 ambient = gSavedSettings.getColor4("PreviewAmbientColor"); + glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambient.mV); + + + LLColor4 diffuse0 = gSavedSettings.getColor4("PreviewDiffuse0"); + LLColor4 specular0 = gSavedSettings.getColor4("PreviewSpecular0"); + LLColor4 diffuse1 = gSavedSettings.getColor4("PreviewDiffuse1"); + LLColor4 specular1 = gSavedSettings.getColor4("PreviewSpecular1"); + LLColor4 diffuse2 = gSavedSettings.getColor4("PreviewDiffuse2"); + LLColor4 specular2 = gSavedSettings.getColor4("PreviewSpecular2"); + + LLVector3 dir0 = gSavedSettings.getVector3("PreviewDirection0"); + LLVector3 dir1 = gSavedSettings.getVector3("PreviewDirection1"); + LLVector3 dir2 = gSavedSettings.getVector3("PreviewDirection2"); + + dir0.normVec(); + dir1.normVec(); + dir2.normVec(); + + LLVector4 light_pos(dir0, 0.0f); + glEnable(GL_LIGHT0); + glLightfv(GL_LIGHT0, GL_POSITION, light_pos.mV); + glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse0.mV); + glLightfv(GL_LIGHT0, GL_AMBIENT, LLColor4::black.mV); + glLightfv(GL_LIGHT0, GL_SPECULAR, specular0.mV); + glLightf (GL_LIGHT0, GL_SPOT_EXPONENT, 0.0f); + glLightf (GL_LIGHT0, GL_SPOT_CUTOFF, 180.0f); + + light_pos = LLVector4(dir1, 0.f); + glEnable(GL_LIGHT1); + glLightfv(GL_LIGHT1, GL_POSITION, light_pos.mV); + glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse1.mV); + glLightfv(GL_LIGHT1, GL_AMBIENT, LLColor4::black.mV); + glLightfv(GL_LIGHT1, GL_SPECULAR, specular1.mV); + glLightf (GL_LIGHT1, GL_SPOT_EXPONENT, 0.0f); + glLightf (GL_LIGHT1, GL_SPOT_CUTOFF, 180.0f); + + light_pos = LLVector4(dir2, 0.f); + glEnable(GL_LIGHT2); + glLightfv(GL_LIGHT2, GL_POSITION, light_pos.mV); + glLightfv(GL_LIGHT2, GL_DIFFUSE, diffuse2.mV); + glLightfv(GL_LIGHT2, GL_AMBIENT, LLColor4::black.mV); + glLightfv(GL_LIGHT2, GL_SPECULAR, specular2.mV); + glLightf (GL_LIGHT2, GL_SPOT_EXPONENT, 0.0f); + glLightf (GL_LIGHT2, GL_SPOT_CUTOFF, 180.0f); + + +} + + void LLPipeline::enableLightsAvatarEdit(const LLColor4& color) { U32 mask = 0x2002; // Avatar backlight only, set ambient diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index e63fbbf147..156a4dd15f 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -279,6 +279,7 @@ public: void enableLightsStatic(); void enableLightsDynamic(); void enableLightsAvatar(); + void enableLightsPreview(); void enableLightsAvatarEdit(const LLColor4& color); void enableLightsFullbright(const LLColor4& color); void disableLights(); -- cgit v1.2.3