diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/newview/lldrawpoolbump.cpp | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/lldrawpoolbump.cpp | 248 |
1 files changed, 210 insertions, 38 deletions
diff --git a/linden/indra/newview/lldrawpoolbump.cpp b/linden/indra/newview/lldrawpoolbump.cpp index 56f1e4d..b11dcc1 100644 --- a/linden/indra/newview/lldrawpoolbump.cpp +++ b/linden/indra/newview/lldrawpoolbump.cpp | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -70,13 +71,14 @@ LLBumpImageList gBumpImageList; | |||
70 | const S32 STD_BUMP_LATEST_FILE_VERSION = 1; | 71 | const S32 STD_BUMP_LATEST_FILE_VERSION = 1; |
71 | 72 | ||
72 | const U32 VERTEX_MASK_SHINY = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_COLOR; | 73 | const U32 VERTEX_MASK_SHINY = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_COLOR; |
73 | const U32 VERTEX_MASK_BUMP = LLVertexBuffer::MAP_VERTEX |LLVertexBuffer::MAP_TEXCOORD | LLVertexBuffer::MAP_TEXCOORD2; | 74 | const U32 VERTEX_MASK_BUMP = LLVertexBuffer::MAP_VERTEX |LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1; |
74 | 75 | ||
75 | U32 LLDrawPoolBump::sVertexMask = VERTEX_MASK_SHINY; | 76 | U32 LLDrawPoolBump::sVertexMask = VERTEX_MASK_SHINY; |
76 | 77 | ||
77 | static LLGLSLShader* shader = NULL; | 78 | static LLGLSLShader* shader = NULL; |
78 | static S32 cube_channel = -1; | 79 | static S32 cube_channel = -1; |
79 | static S32 diffuse_channel = -1; | 80 | static S32 diffuse_channel = -1; |
81 | static S32 bump_channel = -1; | ||
80 | 82 | ||
81 | // static | 83 | // static |
82 | void LLStandardBumpmap::init() | 84 | void LLStandardBumpmap::init() |
@@ -145,7 +147,8 @@ void LLStandardBumpmap::restoreGL() | |||
145 | TRUE, | 147 | TRUE, |
146 | FALSE, | 148 | FALSE, |
147 | 0, | 149 | 0, |
148 | 0); | 150 | 0); |
151 | gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL ); | ||
149 | LLStandardBumpmap::sStandardBumpmapCount++; | 152 | LLStandardBumpmap::sStandardBumpmapCount++; |
150 | } | 153 | } |
151 | 154 | ||
@@ -317,7 +320,7 @@ void LLDrawPoolBump::beginShiny(bool invisible) | |||
317 | // Second pass: environment map | 320 | // Second pass: environment map |
318 | if (!invisible && mVertexShaderLevel > 1) | 321 | if (!invisible && mVertexShaderLevel > 1) |
319 | { | 322 | { |
320 | sVertexMask = VERTEX_MASK_SHINY | LLVertexBuffer::MAP_TEXCOORD; | 323 | sVertexMask = VERTEX_MASK_SHINY | LLVertexBuffer::MAP_TEXCOORD0; |
321 | } | 324 | } |
322 | 325 | ||
323 | if (LLPipeline::sUnderWaterRender) | 326 | if (LLPipeline::sUnderWaterRender) |
@@ -431,15 +434,7 @@ void LLDrawPoolBump::endShiny(bool invisible) | |||
431 | shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); | 434 | shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); |
432 | } | 435 | } |
433 | } | 436 | } |
434 | |||
435 | shader->unbind(); | 437 | shader->unbind(); |
436 | gGL.getTexUnit(0)->activate(); | ||
437 | gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); | ||
438 | } | ||
439 | if (cube_channel >= 0) | ||
440 | { | ||
441 | gGL.getTexUnit(cube_channel)->enable(LLTexUnit::TT_TEXTURE); | ||
442 | gGL.getTexUnit(cube_channel)->setTextureBlendType(LLTexUnit::TB_MULT); | ||
443 | } | 438 | } |
444 | } | 439 | } |
445 | gGL.getTexUnit(diffuse_channel)->disable(); | 440 | gGL.getTexUnit(diffuse_channel)->disable(); |
@@ -461,7 +456,7 @@ void LLDrawPoolBump::beginFullbrightShiny() | |||
461 | return; | 456 | return; |
462 | } | 457 | } |
463 | 458 | ||
464 | sVertexMask = VERTEX_MASK_SHINY | LLVertexBuffer::MAP_TEXCOORD; | 459 | sVertexMask = VERTEX_MASK_SHINY | LLVertexBuffer::MAP_TEXCOORD0; |
465 | 460 | ||
466 | // Second pass: environment map | 461 | // Second pass: environment map |
467 | 462 | ||
@@ -560,6 +555,10 @@ void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL | |||
560 | 555 | ||
561 | applyModelMatrix(params); | 556 | applyModelMatrix(params); |
562 | 557 | ||
558 | if (params.mGroup) | ||
559 | { | ||
560 | params.mGroup->rebuildMesh(); | ||
561 | } | ||
563 | params.mVertexBuffer->setBuffer(mask); | 562 | params.mVertexBuffer->setBuffer(mask); |
564 | params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); | 563 | params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); |
565 | gPipeline.addTrianglesDrawn(params.mCount/3); | 564 | gPipeline.addTrianglesDrawn(params.mCount/3); |
@@ -568,7 +567,7 @@ void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL | |||
568 | 567 | ||
569 | 568 | ||
570 | // static | 569 | // static |
571 | BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params) | 570 | BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel) |
572 | { | 571 | { |
573 | LLImageGL* bump = NULL; | 572 | LLImageGL* bump = NULL; |
574 | 573 | ||
@@ -599,10 +598,19 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params) | |||
599 | 598 | ||
600 | if (bump) | 599 | if (bump) |
601 | { | 600 | { |
602 | gGL.getTexUnit(1)->bind(bump); | 601 | if (channel == -2) |
603 | gGL.getTexUnit(0)->bind(bump); | 602 | { |
603 | gGL.getTexUnit(1)->bind(bump); | ||
604 | gGL.getTexUnit(0)->bind(bump); | ||
605 | } | ||
606 | else | ||
607 | { | ||
608 | gGL.getTexUnit(channel)->bind(bump); | ||
609 | } | ||
610 | |||
604 | return TRUE; | 611 | return TRUE; |
605 | } | 612 | } |
613 | |||
606 | return FALSE; | 614 | return FALSE; |
607 | } | 615 | } |
608 | 616 | ||
@@ -690,6 +698,73 @@ void LLDrawPoolBump::endBump() | |||
690 | gGL.setSceneBlendType(LLRender::BT_ALPHA); | 698 | gGL.setSceneBlendType(LLRender::BT_ALPHA); |
691 | } | 699 | } |
692 | 700 | ||
701 | void LLDrawPoolBump::beginDeferredPass(S32 pass) | ||
702 | { | ||
703 | if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP)) | ||
704 | { | ||
705 | return; | ||
706 | } | ||
707 | LLFastTimer ftm(LLFastTimer::FTM_RENDER_BUMP); | ||
708 | mShiny = TRUE; | ||
709 | gDeferredBumpProgram.bind(); | ||
710 | diffuse_channel = gDeferredBumpProgram.enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); | ||
711 | bump_channel = gDeferredBumpProgram.enableTexture(LLViewerShaderMgr::BUMP_MAP); | ||
712 | gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE); | ||
713 | gGL.getTexUnit(bump_channel)->unbind(LLTexUnit::TT_TEXTURE); | ||
714 | } | ||
715 | |||
716 | void LLDrawPoolBump::endDeferredPass(S32 pass) | ||
717 | { | ||
718 | if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP)) | ||
719 | { | ||
720 | return; | ||
721 | } | ||
722 | LLFastTimer ftm(LLFastTimer::FTM_RENDER_BUMP); | ||
723 | mShiny = FALSE; | ||
724 | gDeferredBumpProgram.disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); | ||
725 | gDeferredBumpProgram.disableTexture(LLViewerShaderMgr::BUMP_MAP); | ||
726 | gDeferredBumpProgram.unbind(); | ||
727 | gGL.getTexUnit(0)->activate(); | ||
728 | } | ||
729 | |||
730 | void LLDrawPoolBump::renderDeferred(S32 pass) | ||
731 | { | ||
732 | if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP)) | ||
733 | { | ||
734 | return; | ||
735 | } | ||
736 | LLFastTimer ftm(LLFastTimer::FTM_RENDER_BUMP); | ||
737 | |||
738 | U32 type = LLRenderPass::PASS_BUMP; | ||
739 | LLCullResult::drawinfo_list_t::iterator begin = gPipeline.beginRenderMap(type); | ||
740 | LLCullResult::drawinfo_list_t::iterator end = gPipeline.endRenderMap(type); | ||
741 | |||
742 | U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_BINORMAL | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_COLOR; | ||
743 | |||
744 | for (LLCullResult::drawinfo_list_t::iterator i = begin; i != end; ++i) | ||
745 | { | ||
746 | LLDrawInfo& params = **i; | ||
747 | |||
748 | LLDrawPoolBump::bindBumpMap(params, bump_channel); | ||
749 | pushBatch(params, mask, TRUE); | ||
750 | } | ||
751 | } | ||
752 | |||
753 | void LLDrawPoolBump::beginPostDeferredPass(S32 pass) | ||
754 | { | ||
755 | beginFullbrightShiny(); | ||
756 | } | ||
757 | |||
758 | void LLDrawPoolBump::endPostDeferredPass(S32 pass) | ||
759 | { | ||
760 | endFullbrightShiny(); | ||
761 | } | ||
762 | |||
763 | void LLDrawPoolBump::renderPostDeferred(S32 pass) | ||
764 | { | ||
765 | renderFullbrightShiny(); | ||
766 | } | ||
767 | |||
693 | //////////////////////////////////////////////////////////////// | 768 | //////////////////////////////////////////////////////////////// |
694 | // List of one-component bump-maps created from other texures. | 769 | // List of one-component bump-maps created from other texures. |
695 | 770 | ||
@@ -747,6 +822,7 @@ void LLBumpImageList::addTextureStats(U8 bump, const LLUUID& base_image_id, F32 | |||
747 | 822 | ||
748 | void LLBumpImageList::updateImages() | 823 | void LLBumpImageList::updateImages() |
749 | { | 824 | { |
825 | llpushcallstacks ; | ||
750 | for (bump_image_map_t::iterator iter = mBrightnessEntries.begin(); iter != mBrightnessEntries.end(); ) | 826 | for (bump_image_map_t::iterator iter = mBrightnessEntries.begin(); iter != mBrightnessEntries.end(); ) |
751 | { | 827 | { |
752 | bump_image_map_t::iterator curiter = iter++; | 828 | bump_image_map_t::iterator curiter = iter++; |
@@ -773,7 +849,7 @@ void LLBumpImageList::updateImages() | |||
773 | } | 849 | } |
774 | } | 850 | } |
775 | } | 851 | } |
776 | 852 | llpushcallstacks ; | |
777 | for (bump_image_map_t::iterator iter = mDarknessEntries.begin(); iter != mDarknessEntries.end(); ) | 853 | for (bump_image_map_t::iterator iter = mDarknessEntries.begin(); iter != mDarknessEntries.end(); ) |
778 | { | 854 | { |
779 | bump_image_map_t::iterator curiter = iter++; | 855 | bump_image_map_t::iterator curiter = iter++; |
@@ -800,7 +876,7 @@ void LLBumpImageList::updateImages() | |||
800 | } | 876 | } |
801 | } | 877 | } |
802 | } | 878 | } |
803 | 879 | llpushcallstacks ; | |
804 | } | 880 | } |
805 | 881 | ||
806 | 882 | ||
@@ -885,6 +961,71 @@ void LLBumpImageList::onSourceDarknessLoaded( BOOL success, LLViewerImage *src_v | |||
885 | } | 961 | } |
886 | } | 962 | } |
887 | 963 | ||
964 | void LLBumpImageList::onSourceStandardLoaded( BOOL success, LLViewerImage* src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata) | ||
965 | { | ||
966 | if (success && LLPipeline::sRenderDeferred) | ||
967 | { | ||
968 | LLPointer<LLImageRaw> nrm_image = new LLImageRaw(src->getWidth(), src->getHeight(), 4); | ||
969 | generateNormalMapFromAlpha(src, nrm_image); | ||
970 | src_vi->setExplicitFormat(GL_RGBA, GL_RGBA); | ||
971 | src_vi->createGLTexture(0, nrm_image); | ||
972 | } | ||
973 | } | ||
974 | |||
975 | void LLBumpImageList::generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nrm_image) | ||
976 | { | ||
977 | U8* nrm_data = nrm_image->getData(); | ||
978 | S32 resX = src->getWidth(); | ||
979 | S32 resY = src->getHeight(); | ||
980 | |||
981 | U8* src_data = src->getData(); | ||
982 | |||
983 | S32 src_cmp = src->getComponents(); | ||
984 | |||
985 | F32 norm_scale = gSavedSettings.getF32("RenderNormalMapScale"); | ||
986 | |||
987 | U32 idx = 0; | ||
988 | //generate normal map from pseudo-heightfield | ||
989 | for (S32 j = 0; j < resY; ++j) | ||
990 | { | ||
991 | for (S32 i = 0; i < resX; ++i) | ||
992 | { | ||
993 | S32 rX = (i+1)%resX; | ||
994 | S32 rY = (j+1)%resY; | ||
995 | S32 lX = (i-1)%resX; | ||
996 | S32 lY = (j-1)%resY; | ||
997 | |||
998 | if (lX < 0) | ||
999 | { | ||
1000 | lX += resX; | ||
1001 | } | ||
1002 | if (lY < 0) | ||
1003 | { | ||
1004 | lY += resY; | ||
1005 | } | ||
1006 | |||
1007 | F32 cH = (F32) src_data[(j*resX+i)*src_cmp+src_cmp-1]; | ||
1008 | |||
1009 | LLVector3 right = LLVector3(norm_scale, 0, (F32) src_data[(j*resX+rX)*src_cmp+src_cmp-1]-cH); | ||
1010 | LLVector3 left = LLVector3(-norm_scale, 0, (F32) src_data[(j*resX+lX)*src_cmp+src_cmp-1]-cH); | ||
1011 | LLVector3 up = LLVector3(0, -norm_scale, (F32) src_data[(rY*resX+i)*src_cmp+src_cmp-1]-cH); | ||
1012 | LLVector3 down = LLVector3(0, norm_scale, (F32) src_data[(lY*resX+i)*src_cmp+src_cmp-1]-cH); | ||
1013 | |||
1014 | LLVector3 norm = right%down + down%left + left%up + up%right; | ||
1015 | |||
1016 | norm.normVec(); | ||
1017 | |||
1018 | norm *= 0.5f; | ||
1019 | norm += LLVector3(0.5f,0.5f,0.5f); | ||
1020 | |||
1021 | idx = (j*resX+i)*4; | ||
1022 | nrm_data[idx+0]= (U8) (norm.mV[0]*255); | ||
1023 | nrm_data[idx+1]= (U8) (norm.mV[1]*255); | ||
1024 | nrm_data[idx+2]= (U8) (norm.mV[2]*255); | ||
1025 | nrm_data[idx+3]= src_data[(j*resX+i)*src_cmp+src_cmp-1]; | ||
1026 | } | ||
1027 | } | ||
1028 | } | ||
888 | 1029 | ||
889 | // static | 1030 | // static |
890 | void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLUUID& source_asset_id, EBumpEffect bump_code ) | 1031 | void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLUUID& source_asset_id, EBumpEffect bump_code ) |
@@ -1004,14 +1145,26 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerImage *src_vi, LLIma | |||
1004 | } | 1145 | } |
1005 | 1146 | ||
1006 | //--------------------------------------------------- | 1147 | //--------------------------------------------------- |
1007 | LLImageGL* bump = new LLImageGL( TRUE); | ||
1008 | //immediately assign bump to a global smart pointer in case some local smart pointer | 1148 | //immediately assign bump to a global smart pointer in case some local smart pointer |
1009 | //accidently releases it. | 1149 | //accidently releases it. |
1150 | LLPointer<LLImageGL> bump = new LLImageGL( TRUE); | ||
1151 | |||
1152 | if (!LLPipeline::sRenderDeferred) | ||
1153 | { | ||
1154 | bump->setExplicitFormat(GL_ALPHA8, GL_ALPHA); | ||
1155 | bump->createGLTexture(0, dst_image); | ||
1156 | } | ||
1157 | else | ||
1158 | { | ||
1159 | LLPointer<LLImageRaw> nrm_image = new LLImageRaw(src->getWidth(), src->getHeight(), 4); | ||
1160 | generateNormalMapFromAlpha(src, nrm_image); | ||
1161 | bump->setExplicitFormat(GL_RGBA, GL_RGBA); | ||
1162 | bump->createGLTexture(0, nrm_image); | ||
1163 | } | ||
1164 | |||
1165 | |||
1010 | iter->second = bump; // derefs (and deletes) old image | 1166 | iter->second = bump; // derefs (and deletes) old image |
1011 | //--------------------------------------------------- | 1167 | //--------------------------------------------------- |
1012 | |||
1013 | bump->setExplicitFormat(GL_ALPHA8, GL_ALPHA); | ||
1014 | bump->createGLTexture(0, dst_image); | ||
1015 | } | 1168 | } |
1016 | else | 1169 | else |
1017 | { | 1170 | { |
@@ -1039,21 +1192,6 @@ void LLDrawPoolBump::renderBump(U32 type, U32 mask) | |||
1039 | } | 1192 | } |
1040 | } | 1193 | } |
1041 | 1194 | ||
1042 | void LLDrawPoolBump::renderGroupBump(LLSpatialGroup* group, U32 type, U32 mask) | ||
1043 | { | ||
1044 | LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[type]; | ||
1045 | |||
1046 | for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k) | ||
1047 | { | ||
1048 | LLDrawInfo& params = **k; | ||
1049 | |||
1050 | if (LLDrawPoolBump::bindBumpMap(params)) | ||
1051 | { | ||
1052 | pushBatch(params, mask, FALSE); | ||
1053 | } | ||
1054 | } | ||
1055 | } | ||
1056 | |||
1057 | void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture) | 1195 | void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture) |
1058 | { | 1196 | { |
1059 | applyModelMatrix(params); | 1197 | applyModelMatrix(params); |
@@ -1087,10 +1225,14 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture) | |||
1087 | } | 1225 | } |
1088 | else | 1226 | else |
1089 | { | 1227 | { |
1090 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); | 1228 | gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE); |
1091 | } | 1229 | } |
1092 | } | 1230 | } |
1093 | 1231 | ||
1232 | if (params.mGroup) | ||
1233 | { | ||
1234 | params.mGroup->rebuildMesh(); | ||
1235 | } | ||
1094 | params.mVertexBuffer->setBuffer(mask); | 1236 | params.mVertexBuffer->setBuffer(mask); |
1095 | params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); | 1237 | params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); |
1096 | gPipeline.addTrianglesDrawn(params.mCount/3); | 1238 | gPipeline.addTrianglesDrawn(params.mCount/3); |
@@ -1130,3 +1272,33 @@ void LLDrawPoolInvisible::render(S32 pass) | |||
1130 | } | 1272 | } |
1131 | } | 1273 | } |
1132 | 1274 | ||
1275 | void LLDrawPoolInvisible::beginDeferredPass(S32 pass) | ||
1276 | { | ||
1277 | beginRenderPass(pass); | ||
1278 | } | ||
1279 | |||
1280 | void LLDrawPoolInvisible::endDeferredPass( S32 pass ) | ||
1281 | { | ||
1282 | endRenderPass(pass); | ||
1283 | } | ||
1284 | |||
1285 | void LLDrawPoolInvisible::renderDeferred( S32 pass ) | ||
1286 | { //render invisiprims; this doesn't work becaue it also blocks all the post-deferred stuff | ||
1287 | LLFastTimer t(LLFastTimer::FTM_RENDER_INVISIBLE); | ||
1288 | |||
1289 | U32 invisi_mask = LLVertexBuffer::MAP_VERTEX; | ||
1290 | glStencilMask(0); | ||
1291 | glStencilOp(GL_ZERO, GL_KEEP, GL_REPLACE); | ||
1292 | gGL.setColorMask(false, false); | ||
1293 | pushBatches(LLRenderPass::PASS_INVISIBLE, invisi_mask, FALSE); | ||
1294 | gGL.setColorMask(true, true); | ||
1295 | glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); | ||
1296 | glStencilMask(0xFFFFFFFF); | ||
1297 | |||
1298 | if (gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY)) | ||
1299 | { | ||
1300 | beginShiny(true); | ||
1301 | renderShiny(true); | ||
1302 | endShiny(true); | ||
1303 | } | ||
1304 | } | ||