diff options
-rw-r--r-- | indra/newview/lldrawpoolavatar.cpp | 214 | ||||
-rw-r--r-- | indra/newview/lldrawpoolavatar.h | 13 | ||||
-rw-r--r-- | indra/newview/llface.h | 2 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 21 |
4 files changed, 212 insertions, 38 deletions
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 8227e8ede2..866aea42c4 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -364,7 +364,7 @@ S32 LLDrawPoolAvatar::getNumPasses() } else if (getVertexShaderLevel() > 0) { - return 7; + return 10; } else { @@ -419,6 +419,15 @@ void LLDrawPoolAvatar::beginRenderPass(S32 pass) case 6: beginRiggedFullbrightShiny(); break; + case 7: + beginRiggedAlpha(); + break; + case 8: + beginRiggedFullbrightAlpha(); + break; + case 9: + beginRiggedGlow(); + break; } } @@ -455,6 +464,15 @@ void LLDrawPoolAvatar::endRenderPass(S32 pass) case 6: endRiggedFullbrightShiny(); break; + case 7: + endRiggedAlpha(); + break; + case 8: + endRiggedFullbrightAlpha(); + break; + case 9: + endRiggedGlow(); + break; } } @@ -656,6 +674,55 @@ void LLDrawPoolAvatar::endRiggedSimple() LLVertexBuffer::sWeight4Loc = -1; } +void LLDrawPoolAvatar::beginRiggedAlpha() +{ + sVertexProgram = &gSkinnedObjectSimpleProgram; + diffuse_channel = 0; + sVertexProgram->bind(); + LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT); +} + +void LLDrawPoolAvatar::endRiggedAlpha() +{ + sVertexProgram->unbind(); + sVertexProgram = NULL; + LLVertexBuffer::unbind(); + LLVertexBuffer::sWeight4Loc = -1; +} + + +void LLDrawPoolAvatar::beginRiggedFullbrightAlpha() +{ + sVertexProgram = &gSkinnedObjectFullbrightProgram; + diffuse_channel = 0; + sVertexProgram->bind(); + LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT); +} + +void LLDrawPoolAvatar::endRiggedFullbrightAlpha() +{ + sVertexProgram->unbind(); + sVertexProgram = NULL; + LLVertexBuffer::unbind(); + LLVertexBuffer::sWeight4Loc = -1; +} + +void LLDrawPoolAvatar::beginRiggedGlow() +{ + sVertexProgram = &gSkinnedObjectFullbrightProgram; + diffuse_channel = 0; + sVertexProgram->bind(); + LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT); +} + +void LLDrawPoolAvatar::endRiggedGlow() +{ + sVertexProgram->unbind(); + sVertexProgram = NULL; + LLVertexBuffer::unbind(); + LLVertexBuffer::sWeight4Loc = -1; +} + void LLDrawPoolAvatar::beginRiggedFullbright() { sVertexProgram = &gSkinnedObjectFullbrightProgram; @@ -888,6 +955,48 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) return; } + if (pass >= 7 && pass <= 9) + { + LLGLEnable blend(GL_BLEND); + + gGL.setColorMask(true, true); + gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, + LLRender::BF_ONE_MINUS_SOURCE_ALPHA, + LLRender::BF_ZERO, + LLRender::BF_ONE_MINUS_SOURCE_ALPHA); + + + if (pass == 7) + { + renderRiggedAlpha(avatarp); + return; + } + + if (pass == 8) + { + renderRiggedFullbrightAlpha(avatarp); + return; + } + } + + if (pass == 9) + { + LLGLEnable blend(GL_BLEND); + LLGLDisable test(GL_ALPHA_TEST); + gGL.flush(); + + LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(-1.0f, -1.0f); + gGL.setSceneBlendType(LLRender::BT_ADD); + + LLGLDepthTest depth(GL_TRUE, GL_FALSE); + gGL.setColorMask(false, true); + + renderRiggedGlow(avatarp); + gGL.setColorMask(true, false); + gGL.setSceneBlendType(LLRender::BT_ALPHA); + } + if (sShaderLevel > 0) { @@ -958,7 +1067,7 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLFace* face, const LLMeshSk } } -void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, const U32 data_mask) +void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, const U32 data_mask, bool glow) { for (U32 i = 0; i < mRiggedFace[type].size(); ++i) { @@ -1031,6 +1140,11 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, const U32 data S32 offset = face->getIndicesStart(); U32 count = face->getIndicesCount(); + if (glow) + { + glColor4f(0,0,0,face->getTextureEntry()->getGlow()); + } + gGL.getTexUnit(0)->bind(face->getTexture()); buff->drawRange(LLRender::TRIANGLES, start, end, count, offset); } @@ -1081,6 +1195,39 @@ void LLDrawPoolAvatar::renderRiggedFullbrightShiny(LLVOAvatar* avatar) renderRigged(avatar, RIGGED_FULLBRIGHT_SHINY, data_mask); } +void LLDrawPoolAvatar::renderRiggedAlpha(LLVOAvatar* avatar) +{ + const U32 data_mask = LLVertexBuffer::MAP_VERTEX | + LLVertexBuffer::MAP_NORMAL | + LLVertexBuffer::MAP_TEXCOORD0 | + LLVertexBuffer::MAP_COLOR | + LLVertexBuffer::MAP_WEIGHT4; + + renderRigged(avatar, RIGGED_ALPHA, data_mask); +} + +void LLDrawPoolAvatar::renderRiggedFullbrightAlpha(LLVOAvatar* avatar) +{ + const U32 data_mask = LLVertexBuffer::MAP_VERTEX | + LLVertexBuffer::MAP_TEXCOORD0 | + LLVertexBuffer::MAP_COLOR | + LLVertexBuffer::MAP_WEIGHT4; + + renderRigged(avatar, RIGGED_FULLBRIGHT_ALPHA, data_mask); +} + +void LLDrawPoolAvatar::renderRiggedGlow(LLVOAvatar* avatar) +{ + const U32 data_mask = LLVertexBuffer::MAP_VERTEX | + LLVertexBuffer::MAP_TEXCOORD0 | + LLVertexBuffer::MAP_WEIGHT4; + + renderRigged(avatar, RIGGED_GLOW, data_mask, true); +} + + + + //----------------------------------------------------------------------------- // renderForSelect() //----------------------------------------------------------------------------- @@ -1181,60 +1328,57 @@ LLColor3 LLDrawPoolAvatar::getDebugColor() const void LLDrawPoolAvatar::addRiggedFace(LLFace* facep, U32 type) { - if (facep->getReferenceIndex() != -1) + if (facep->mRiggedIndex.empty()) { - llerrs << "Tried to add a rigged face that's referenced elsewhere." << llendl; - } + facep->mRiggedIndex.resize(LLDrawPoolAvatar::NUM_RIGGED_PASSES); + for (U32 i = 0; i < facep->mRiggedIndex.size(); ++i) + { + facep->mRiggedIndex[i] = -1; + } + } if (type >= NUM_RIGGED_PASSES) { llerrs << "Invalid rigged face type." << llendl; } - facep->setReferenceIndex(mRiggedFace[type].size()); + if (facep->mRiggedIndex[type] != -1) + { + llerrs << "Tried to add a rigged face that's referenced elsewhere." << llendl; + } + + + facep->mRiggedIndex[type] = mRiggedFace[type].size(); facep->mDrawPoolp = this; mRiggedFace[type].push_back(facep); } -void LLDrawPoolAvatar::removeRiggedFace(LLFace* facep, U32 type) +void LLDrawPoolAvatar::removeRiggedFace(LLFace* facep) { - S32 index = facep->getReferenceIndex(); - if (index == -1) - { - llerrs << "Tried to remove rigged face with invalid index." << llendl; - } - - if (type > RIGGED_UNKNOWN) - { - llerrs << "Invalid rigged face type." << llendl; - } - - facep->setReferenceIndex(-1); + facep->mDrawPoolp = NULL; - if (type == RIGGED_UNKNOWN) + for (U32 i = 0; i < NUM_RIGGED_PASSES; ++i) { - for (U32 i = 0; i < NUM_RIGGED_PASSES; ++i) + S32 index = facep->mRiggedIndex[i]; + + if (index > -1) { if (mRiggedFace[i].size() > index && mRiggedFace[i][index] == facep) { - type = i; - break; + facep->mRiggedIndex[i] = -1; + mRiggedFace[i].erase(mRiggedFace[i].begin()+index); + for (U32 j = index; j < mRiggedFace[i].size(); ++j) + { //bump indexes down for faces referenced after erased face + mRiggedFace[i][j]->mRiggedIndex[i] = j; + } + } + else + { + llerrs << "Face reference data corrupt for rigged type " << i << llendl; } } } - - if (type >= NUM_RIGGED_PASSES) - { - llerrs << "Could not find face for removal from current drawpool." << llendl; - } - - mRiggedFace[type].erase(mRiggedFace[type].begin()+index); - - for (S32 i = index; i < mRiggedFace[type].size(); ++i) - { //bump indexes of currently held faces down after removal - mRiggedFace[type][i]->setReferenceIndex(i); - } } LLVertexBufferAvatar::LLVertexBufferAvatar() diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h index d758bb07f0..59f9cf7ddb 100644 --- a/indra/newview/lldrawpoolavatar.h +++ b/indra/newview/lldrawpoolavatar.h @@ -100,6 +100,9 @@ public: void beginRiggedFullbright(); void beginRiggedFullbrightShiny(); void beginRiggedShinySimple(); + void beginRiggedAlpha(); + void beginRiggedFullbrightAlpha(); + void beginRiggedGlow(); void endRigid(); void endImpostor(); @@ -108,6 +111,9 @@ public: void endRiggedFullbright(); void endRiggedFullbrightShiny(); void endRiggedShinySimple(); + void endRiggedAlpha(); + void endRiggedFullbrightAlpha(); + void endRiggedGlow(); void beginDeferredImpostor(); void beginDeferredRigid(); @@ -125,11 +131,14 @@ public: const LLVolumeFace& vol_face, U32 data_mask); - void renderRigged(LLVOAvatar* avatar, U32 type, const U32 data_mask); + void renderRigged(LLVOAvatar* avatar, U32 type, const U32 data_mask, bool glow = false); void renderRiggedSimple(LLVOAvatar* avatar); + void renderRiggedAlpha(LLVOAvatar* avatar); + void renderRiggedFullbrightAlpha(LLVOAvatar* avatar); void renderRiggedFullbright(LLVOAvatar* avatar); void renderRiggedShinySimple(LLVOAvatar* avatar); void renderRiggedFullbrightShiny(LLVOAvatar* avatar); + void renderRiggedGlow(LLVOAvatar* avatar); /*virtual*/ LLViewerTexture *getDebugTexture(); /*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display @@ -151,7 +160,7 @@ public: void addRiggedFace(LLFace* facep, U32 type); - void removeRiggedFace(LLFace* facep, U32 type = RIGGED_UNKNOWN); + void removeRiggedFace(LLFace* facep); std::vector<LLFace*> mRiggedFace[NUM_RIGGED_PASSES]; diff --git a/indra/newview/llface.h b/indra/newview/llface.h index 2b8fdf2e58..f9e9c3e078 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -260,6 +260,8 @@ private: S32 mTEOffset; S32 mReferenceIndex; + std::vector<S32> mRiggedIndex; + F32 mVSize; F32 mPixelArea; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 43252c553c..e263f8d937 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3545,7 +3545,21 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } //add face to new pool - if (te->getShiny()) + LLViewerTexture* tex = facep->getTexture(); + U32 type = gPipeline.getPoolTypeFromTE(te, tex); + + if (type == LLDrawPool::POOL_ALPHA) + { + if (te->getFullbright()) + { + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA); + } + else + { + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_ALPHA); + } + } + else if (te->getShiny()) { if (te->getFullbright()) { @@ -3567,6 +3581,11 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SIMPLE); } } + + if (te->getGlow()) + { + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_GLOW); + } } } |