llface.inl

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLFACE_INL
00033 #define LL_LLFACE_INL
00034 
00035 #include "llglheaders.h"
00036 
00037 inline BOOL LLFace::getDirty() const
00038 { 
00039         return (mGeneration != mDrawPoolp->mGeneration); 
00040 }
00041 
00042 inline void LLFace::clearDirty()
00043 {
00044         mGeneration = mDrawPoolp->mGeneration;
00045 }
00046 
00047 inline const LLTextureEntry* LLFace::getTextureEntry()   const
00048 {
00049         return mVObjp->getTE(mTEOffset);
00050 }
00051 
00052 inline LLDrawPool* LLFace::getPool()     const
00053 {
00054         return mDrawPoolp;
00055 }
00056 
00057 inline S32 LLFace::getStride()   const
00058 {
00059         return mDrawPoolp->getStride();
00060 }
00061 
00062 inline LLDrawable* LLFace::getDrawable() const
00063 {
00064         return mDrawablep;
00065 }
00066 
00067 inline LLViewerObject* LLFace::getViewerObject() const
00068 {
00069         return mVObjp;
00070 }
00071 
00072 inline S32      LLFace::getColors     (LLStrider<LLColor4U> &colors)
00073 {
00074         if (!mGeomCount)
00075         {
00076                 return -1;
00077         }
00078         LLColor4U *colorp = NULL;
00079         if (isState(BACKLIST))
00080         {
00081                 if (!mBackupMem)
00082                 {
00083                         printDebugInfo();
00084                         llerrs << "No backup memory for face" << llendl;
00085                 }
00086                 colorp = (LLColor4U*)(mBackupMem + (4 * mIndicesCount) + (mGeomCount * mDrawPoolp->getStride()));
00087                 colors = colorp;
00088                 return 0;
00089         }
00090         else
00091         {
00092                 llassert(mGeomIndex >= 0);
00093                 if (!mDrawPoolp->getColorStrider(colors, mGeomIndex))
00094                 {
00095                         printDebugInfo();
00096                         llerrs << "No color pointer for a color strider!" << llendl;
00097                 }
00098                 mDrawPoolp->setDirtyColors();
00099                 return mGeomIndex;
00100         }
00101 }
00102 
00103 inline S32      LLFace::getTexCoords  (LLStrider<LLVector2> &texCoords, S32 pass )
00104 {
00105         if (!mGeomCount)
00106         {
00107                 return -1;
00108         }
00109         if (isState(BACKLIST))
00110         {
00111                 if (!mBackupMem)
00112                 {
00113                         printDebugInfo();
00114                         llerrs << "No backup memory for face" << llendl;
00115                 }
00116                 texCoords = (LLVector2*)(mBackupMem + (4 * mIndicesCount) + mDrawPoolp->mDataOffsets[LLDrawPool::DATA_TEX_COORDS0 + pass]);
00117                 texCoords.setStride( mDrawPoolp->getStride());
00118                 return 0;
00119         }
00120         else
00121         {
00122                 llassert(mGeomIndex >= 0);
00123                 mDrawPoolp->getTexCoordStrider(texCoords, mGeomIndex, pass );
00124                 mDrawPoolp->setDirty();
00125                 return mGeomIndex;
00126         }
00127 }
00128 
00129 inline S32      LLFace::getIndices    (U32*  &indicesp)
00130 {
00131         if (isState(BACKLIST))
00132         {
00133                 indicesp = (U32*)mBackupMem;
00134                 return 0;
00135         }
00136         else
00137         {
00138                 indicesp = mDrawPoolp->getIndices(mIndicesIndex);
00139                 llassert(mGeomIndex >= 0);
00140                 return mGeomIndex;
00141         }
00142 }
00143 
00144 inline const U32* LLFace::getRawIndices() const
00145 {
00146         llassert(!isState(BACKLIST));
00147 
00148         return &mDrawPoolp->mIndices[mIndicesIndex];
00149 }
00150 
00151 
00152 inline void LLFace::bindTexture(S32 stage) const
00153 {
00154         if (mTexture)
00155         {
00156                 mTexture->bindTexture(stage);
00157         }
00158         else
00159         {
00160                 LLImageGL::unbindTexture(stage, GL_TEXTURE_2D);
00161         }
00162 }
00163 
00164 #endif

Generated on Fri May 16 08:33:21 2008 for SecondLife by  doxygen 1.5.5