diff options
author | Dave Parks <davep@lindenlab.com> | 2010-05-01 01:55:21 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2010-05-01 01:55:21 -0500 |
commit | 2f95a549a365ca2bedf7824014a687b3af88e20f (patch) | |
tree | 26d87b108ffd4730d29ae9ebed2f34154c904e86 /indra/newview | |
parent | ad8fb0e1bb6c242cc84aa3d2cfaabc9ee36e39b6 (diff) |
Fullbrigt skinned and fix for silly crash from not removing face references.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/objects/shinyV.glsl | 2 | ||||
-rw-r--r-- | indra/newview/lldrawpoolavatar.cpp | 40 | ||||
-rw-r--r-- | indra/newview/lldrawpoolavatar.h | 5 | ||||
-rw-r--r-- | indra/newview/llface.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 19 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.h | 1 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 9 |
7 files changed, 81 insertions, 8 deletions
diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl index c2e1ddf734..101458c438 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl @@ -12,7 +12,7 @@ uniform vec4 origin; void main() { //transform vertex - gl_Position = ftransform(); //gl_ModelViewProjectionMatrix * gl_Vertex; + gl_Position = ftransform(); vec4 pos = (gl_ModelViewMatrix * gl_Vertex); vec3 norm = normalize(gl_NormalMatrix * gl_Normal); diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 02c7e3bb6f..9463be6059 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -364,7 +364,7 @@ S32 LLDrawPoolAvatar::getNumPasses() } else if (getVertexShaderLevel() > 0) { - return 5; + return 6; } else { @@ -411,6 +411,9 @@ void LLDrawPoolAvatar::beginRenderPass(S32 pass) beginRiggedSimple(); break; case 4: + beginRiggedFullbright(); + break; + case 5: beginRiggedShinySimple(); break; } @@ -441,6 +444,9 @@ void LLDrawPoolAvatar::endRenderPass(S32 pass) endRiggedSimple(); break; case 4: + endRiggedFullbright(); + break; + case 5: endRiggedShinySimple(); break; } @@ -644,6 +650,22 @@ void LLDrawPoolAvatar::endRiggedSimple() LLVertexBuffer::sWeight4Loc = -1; } +void LLDrawPoolAvatar::beginRiggedFullbright() +{ + sVertexProgram = &gSkinnedObjectFullbrightProgram; + diffuse_channel = 0; + gSkinnedObjectFullbrightProgram.bind(); + LLVertexBuffer::sWeight4Loc = gSkinnedObjectFullbrightProgram.getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT); +} + +void LLDrawPoolAvatar::endRiggedFullbright() +{ + sVertexProgram = NULL; + LLVertexBuffer::unbind(); + gSkinnedObjectFullbrightProgram.unbind(); + LLVertexBuffer::sWeight4Loc = -1; +} + void LLDrawPoolAvatar::beginRiggedShinySimple() { sVertexProgram = &gSkinnedObjectShinySimpleProgram; @@ -826,6 +848,12 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) if (pass == 4) { + renderRiggedFullbright(avatarp); + return; + } + + if (pass == 5) + { renderRiggedShinySimple(avatarp); return; } @@ -990,6 +1018,16 @@ void LLDrawPoolAvatar::renderRiggedSimple(LLVOAvatar* avatar) renderRigged(avatar, RIGGED_SIMPLE, data_mask); } +void LLDrawPoolAvatar::renderRiggedFullbright(LLVOAvatar* avatar) +{ + const U32 data_mask = LLVertexBuffer::MAP_VERTEX | + LLVertexBuffer::MAP_TEXCOORD0 | + LLVertexBuffer::MAP_COLOR | + LLVertexBuffer::MAP_WEIGHT4; + + renderRigged(avatar, RIGGED_FULLBRIGHT, data_mask); +} + void LLDrawPoolAvatar::renderRiggedShinySimple(LLVOAvatar* avatar) { diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h index 0ebb035f2a..8443069376 100644 --- a/indra/newview/lldrawpoolavatar.h +++ b/indra/newview/lldrawpoolavatar.h @@ -97,12 +97,14 @@ public: void beginImpostor(); void beginSkinned(); void beginRiggedSimple(); + void beginRiggedFullbright(); void beginRiggedShinySimple(); void endRigid(); void endImpostor(); void endSkinned(); void endRiggedSimple(); + void endRiggedFullbright(); void endRiggedShinySimple(); void beginDeferredImpostor(); @@ -123,6 +125,7 @@ public: void renderRigged(LLVOAvatar* avatar, U32 type, const U32 data_mask); void renderRiggedSimple(LLVOAvatar* avatar); + void renderRiggedFullbright(LLVOAvatar* avatar); void renderRiggedShinySimple(LLVOAvatar* avatar); /*virtual*/ LLViewerTexture *getDebugTexture(); @@ -133,11 +136,11 @@ public: typedef enum { RIGGED_SIMPLE = 0, + RIGGED_FULLBRIGHT, RIGGED_SHINY_SIMPLE, RIGGED_SHINY_FULLBRIGHT, RIGGED_SHINY_BUMP, RIGGED_BUMP, - RIGGED_FULLBRIGHT, RIGGED_ALPHA, NUM_RIGGED_PASSES, RIGGED_UNKNOWN, diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 0e0b8447ca..9df692e787 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -41,6 +41,7 @@ #include "m3math.h" #include "v3color.h" +#include "lldrawpoolavatar.h" #include "lldrawpoolbump.h" #include "llgl.h" #include "llrender.h" @@ -207,10 +208,14 @@ void LLFace::destroy() LLFastTimer t(FTM_DESTROY_DRAWPOOL); if (this->isState(LLFace::RIGGED) && mDrawPoolp->getType() == LLDrawPool::POOL_AVATAR) - mDrawPoolp->removeFace(this); - - - + { + ((LLDrawPoolAvatar*) mDrawPoolp)->removeRiggedFace(this); + } + else + { + mDrawPoolp->removeFace(this); + } + mDrawPoolp = NULL; } diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index fe68d6eaa4..3cc5b4357a 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -79,6 +79,7 @@ LLGLSLShader gObjectShinyWaterProgram; //object hardware skinning shaders LLGLSLShader gSkinnedObjectSimpleProgram; +LLGLSLShader gSkinnedObjectFullbrightProgram; LLGLSLShader gSkinnedObjectShinySimpleProgram; //environment shaders @@ -155,6 +156,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gObjectFullbrightProgram); mShaderList.push_back(&gObjectFullbrightShinyProgram); mShaderList.push_back(&gSkinnedObjectSimpleProgram); + mShaderList.push_back(&gSkinnedObjectFullbrightProgram); mShaderList.push_back(&gSkinnedObjectShinySimpleProgram); mShaderList.push_back(&gTerrainProgram); mShaderList.push_back(&gTerrainWaterProgram); @@ -562,6 +564,7 @@ void LLViewerShaderMgr::unloadShaders() gObjectShinyWaterProgram.unload(); gSkinnedObjectSimpleProgram.unload(); + gSkinnedObjectFullbrightProgram.unload(); gSkinnedObjectShinySimpleProgram.unload(); @@ -1258,6 +1261,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectFullbrightProgram.unload(); gObjectFullbrightWaterProgram.unload(); gSkinnedObjectSimpleProgram.unload(); + gSkinnedObjectFullbrightProgram.unload(); gSkinnedObjectShinySimpleProgram.unload(); return FALSE; @@ -1387,6 +1391,21 @@ BOOL LLViewerShaderMgr::loadShadersObject() if (success) { + gSkinnedObjectFullbrightProgram.mName = "Skinned Fullbright Shader"; + gSkinnedObjectFullbrightProgram.mFeatures.calculatesAtmospherics = true; + gSkinnedObjectFullbrightProgram.mFeatures.hasGamma = true; + gSkinnedObjectFullbrightProgram.mFeatures.hasTransport = true; + gSkinnedObjectFullbrightProgram.mFeatures.isFullbright = true; + gSkinnedObjectFullbrightProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectFullbrightProgram.mShaderFiles.clear(); + gSkinnedObjectFullbrightProgram.mShaderFiles.push_back(make_pair("objects/fullbrightSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); + gSkinnedObjectFullbrightProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB)); + gSkinnedObjectFullbrightProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + success = gSkinnedObjectFullbrightProgram.createShader(NULL, NULL); + } + + if (success) + { gSkinnedObjectShinySimpleProgram.mName = "Skinned Shiny Simple Shader"; gSkinnedObjectShinySimpleProgram.mFeatures.calculatesLighting = true; gSkinnedObjectShinySimpleProgram.mFeatures.calculatesAtmospherics = true; diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index beac5462e2..b4fc336bf3 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -315,6 +315,7 @@ extern LLGLSLShader gObjectShinyProgram; extern LLGLSLShader gObjectShinyWaterProgram; extern LLGLSLShader gSkinnedObjectSimpleProgram; +extern LLGLSLShader gSkinnedObjectFullbrightProgram; extern LLGLSLShader gSkinnedObjectShinySimpleProgram; //environment shaders diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index e49b33bd80..3449c05be8 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3551,7 +3551,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } else { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SIMPLE); + if (te->getFullbright()) + { + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT); + } + else + { + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SIMPLE); + } } } |