diff options
-rw-r--r-- | indra/newview/llmodelpreview.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 20 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.h | 1 |
3 files changed, 32 insertions, 0 deletions
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index b60fabb01b..c7f56de4ed 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -3285,6 +3285,14 @@ BOOL LLModelPreview::render() if (!physics.mMesh.empty()) { //render hull instead of mesh + // SL-16993 physics.mMesh[i].mNormals were being used to light the exploded + // analyzed physics shape but the drawArrays() interface changed + // causing normal data <0,0,0> to be passed to the shader. + // The Phyics Preview shader uses plain vertex coloring so the physics hull is full lit. + // We could also use interface/ui shaders. + gObjectPreviewProgram.unbind(); + gPhysicsPreviewProgram.bind(); + for (U32 i = 0; i < physics.mMesh.size(); ++i) { if (explode > 0.f) @@ -3312,6 +3320,9 @@ BOOL LLModelPreview::render() gGL.popMatrix(); } } + + gPhysicsPreviewProgram.unbind(); + gObjectPreviewProgram.bind(); } } } diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index c97b1d914b..a8e0f576ca 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -102,6 +102,7 @@ LLGLSLShader gSkinnedObjectSimpleProgram; LLGLSLShader gObjectSimpleImpostorProgram; LLGLSLShader gSkinnedObjectSimpleImpostorProgram; LLGLSLShader gObjectPreviewProgram; +LLGLSLShader gPhysicsPreviewProgram; LLGLSLShader gObjectSimpleWaterProgram; LLGLSLShader gSkinnedObjectSimpleWaterProgram; LLGLSLShader gObjectSimpleAlphaMaskProgram; @@ -758,6 +759,7 @@ void LLViewerShaderMgr::unloadShaders() gObjectSimpleImpostorProgram.unload(); gSkinnedObjectSimpleImpostorProgram.unload(); gObjectPreviewProgram.unload(); + gPhysicsPreviewProgram.unload(); gImpostorProgram.unload(); gObjectSimpleAlphaMaskProgram.unload(); gSkinnedObjectSimpleAlphaMaskProgram.unload(); @@ -3023,6 +3025,24 @@ BOOL LLViewerShaderMgr::loadShadersObject() if (success) { + gPhysicsPreviewProgram.mName = "Preview Physics Shader"; + gPhysicsPreviewProgram.mFeatures.calculatesLighting = false; + gPhysicsPreviewProgram.mFeatures.calculatesAtmospherics = false; + gPhysicsPreviewProgram.mFeatures.hasGamma = false; + gPhysicsPreviewProgram.mFeatures.hasAtmospherics = false; + gPhysicsPreviewProgram.mFeatures.hasLighting = false; + gPhysicsPreviewProgram.mFeatures.mIndexedTextureChannels = 0; + gPhysicsPreviewProgram.mFeatures.disableTextureIndex = true; + gPhysicsPreviewProgram.mShaderFiles.clear(); + gPhysicsPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewPhysicsV.glsl", GL_VERTEX_SHADER_ARB)); + gPhysicsPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewPhysicsF.glsl", GL_FRAGMENT_SHADER_ARB)); + gPhysicsPreviewProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT]; + success = gPhysicsPreviewProgram.createShader(NULL, NULL); + gPhysicsPreviewProgram.mFeatures.hasLighting = false; + } + + if (success) + { gObjectSimpleProgram.mName = "Simple Shader"; gObjectSimpleProgram.mFeatures.calculatesLighting = true; gObjectSimpleProgram.mFeatures.calculatesAtmospherics = true; diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 297cfb6e68..93bb29a355 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -181,6 +181,7 @@ extern LLGLSLShader gOneTextureNoColorProgram; extern LLGLSLShader gObjectSimpleProgram; extern LLGLSLShader gObjectSimpleImpostorProgram; extern LLGLSLShader gObjectPreviewProgram; +extern LLGLSLShader gPhysicsPreviewProgram; extern LLGLSLShader gObjectSimpleAlphaMaskProgram; extern LLGLSLShader gObjectSimpleWaterProgram; extern LLGLSLShader gObjectSimpleWaterAlphaMaskProgram; |