diff options
author | Dave Parks <davep@lindenlab.com> | 2011-05-29 00:40:57 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-05-29 00:40:57 -0500 |
commit | 1fd46831f0ea7309d83c1fa2eecc611b3bada719 (patch) | |
tree | 8e6708b1e25f12156c0a65cf6487c5f3df6c4873 /indra/newview/llface.cpp | |
parent | 35c4635dca83708a09ac8f15e30aec146210fba7 (diff) |
SH-1682 Work in progress on using texture indexes to improve batch size (wow, super fast so far)
Diffstat (limited to 'indra/newview/llface.cpp')
-rw-r--r-- | indra/newview/llface.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 9f9e50ad0a..e30522d380 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -165,6 +165,7 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp) mIndexInTex = 0; mTexture = NULL; mTEOffset = -1; + mTextureIndex = 255; setDrawable(drawablep); mVObjp = objp; @@ -386,6 +387,26 @@ void LLFace::setGeomIndex(U16 idx) } } +void LLFace::setTextureIndex(U8 index) +{ + if (index != mTextureIndex) + { + mTextureIndex = index; + + if (mTextureIndex != 255) + { + mDrawablep->setState(LLDrawable::REBUILD_POSITION); + } + else + { + if (mDrawInfo && !mDrawInfo->mTextureList.empty()) + { + llerrs << "Face with no texture index references indexed texture draw info." << llendl; + } + } + } +} + void LLFace::setIndicesIndex(S32 idx) { if (mIndicesIndex != idx) @@ -1573,6 +1594,20 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, mat_vert.affineTransform(*src++, *dst++); } while(dst < end); + + F32 index = (F32) (mTextureIndex < 255 ? mTextureIndex : 0); + F32 *index_dst = (F32*) vertices; + F32 *index_end = (F32*) end; + + index_dst += 3; + index_end += 3; + do + { + *index_dst = index; + index_dst += 4; + } + while (index_dst < index_end); + } if (rebuild_normal) |