diff options
Diffstat (limited to 'indra/newview/llface.cpp')
-rw-r--r-- | indra/newview/llface.cpp | 100 |
1 files changed, 74 insertions, 26 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 432e61f6d8..6dbeae6677 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -496,14 +496,14 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) gGL.pushMatrix(); if (mDrawablep->isActive()) { - glMultMatrixf((GLfloat*)mDrawablep->getRenderMatrix().mMatrix); + gGL.multMatrix((GLfloat*)mDrawablep->getRenderMatrix().mMatrix); } else { - glMultMatrixf((GLfloat*)mDrawablep->getRegion()->mRenderMatrix.mMatrix); + gGL.multMatrix((GLfloat*)mDrawablep->getRegion()->mRenderMatrix.mMatrix); } - glColor4fv(color.mV); + gGL.diffuseColor4fv(color.mV); if (mDrawablep->isState(LLDrawable::RIGGED)) { @@ -515,7 +515,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) { LLGLEnable offset(GL_POLYGON_OFFSET_FILL); glPolygonOffset(-1.f, -1.f); - glMultMatrixf((F32*) volume->getRelativeXform().mMatrix); + gGL.multMatrix((F32*) volume->getRelativeXform().mMatrix); const LLVolumeFace& vol_face = rigged->getVolumeFace(getTEOffset()); LLVertexBuffer::unbind(); glVertexPointer(3, GL_FLOAT, 16, vol_face.mPositions); @@ -524,6 +524,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(2, GL_FLOAT, 8, vol_face.mTexCoords); } + gGL.syncMatrices(); glDrawElements(GL_TRIANGLES, vol_face.mNumIndices, GL_UNSIGNED_SHORT, vol_face.mIndices); glDisableClientState(GL_TEXTURE_COORD_ARRAY); } @@ -557,17 +558,17 @@ void LLFace::renderSelectedUV() // add green dither pattern on top of red/blue gradient gGL.blendFunc(LLRender::BF_ONE, LLRender::BF_ONE); - glMatrixMode(GL_TEXTURE); - glPushMatrix(); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.pushMatrix(); // make green pattern repeat once per texel in red/blue texture - glScalef(256.f, 256.f, 1.f); - glMatrixMode(GL_MODELVIEW); + gGL.scalef(256.f, 256.f, 1.f); + gGL.matrixMode(LLRender::MM_MODELVIEW); renderSelected(green_imagep, LLColor4::white); - glMatrixMode(GL_TEXTURE); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, LLRender::BF_ONE_MINUS_SOURCE_ALPHA); } */ @@ -1055,6 +1056,7 @@ static LLFastTimer::DeclareTimer FTM_FACE_GEOM_POSITION("Position"); static LLFastTimer::DeclareTimer FTM_FACE_GEOM_NORMAL("Normal"); static LLFastTimer::DeclareTimer FTM_FACE_GEOM_TEXTURE("Texture"); static LLFastTimer::DeclareTimer FTM_FACE_GEOM_COLOR("Color"); +static LLFastTimer::DeclareTimer FTM_FACE_GEOM_EMISSIVE("Emissive"); static LLFastTimer::DeclareTimer FTM_FACE_GEOM_WEIGHTS("Weights"); static LLFastTimer::DeclareTimer FTM_FACE_GEOM_BINORMAL("Binormal"); static LLFastTimer::DeclareTimer FTM_FACE_GEOM_INDEX("Index"); @@ -1071,6 +1073,11 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, S32 num_vertices = (S32)vf.mNumVertices; S32 num_indices = (S32) vf.mNumIndices; + if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCTREE)) + { + updateRebuildFlags(); + } + bool map_range = gGLManager.mHasMapBufferRange || gGLManager.mHasFlushBufferRange; if (mVertexBuffer.notNull()) @@ -1124,6 +1131,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, bool rebuild_pos = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_POSITION); bool rebuild_color = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_COLOR); + bool rebuild_emissive = rebuild_color && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE); bool rebuild_tcoord = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_TCOORD); bool rebuild_normal = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_NORMAL); bool rebuild_binormal = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_BINORMAL); @@ -1213,7 +1221,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (map_range) { - mVertexBuffer->setBuffer(0); + mVertexBuffer->flush(); } } @@ -1438,7 +1446,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (map_range) { - mVertexBuffer->setBuffer(0); + mVertexBuffer->flush(); } } else @@ -1585,7 +1593,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (map_range) { - mVertexBuffer->setBuffer(0); + mVertexBuffer->flush(); } if (do_bump) @@ -1622,7 +1630,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (map_range) { - mVertexBuffer->setBuffer(0); + mVertexBuffer->flush(); } } } @@ -1650,6 +1658,8 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, while(dst < end); F32 index = (F32) (mTextureIndex < 255 ? mTextureIndex : 0); + + llassert(index <= LLGLSLShader::sIndexedTextureChannels-1); F32 *index_dst = (F32*) vertices; F32 *index_end = (F32*) end; @@ -1672,7 +1682,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (map_range) { - mVertexBuffer->setBuffer(0); + mVertexBuffer->flush(); } } @@ -1692,7 +1702,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (map_range) { - mVertexBuffer->setBuffer(0); + mVertexBuffer->flush(); } } @@ -1712,7 +1722,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (map_range) { - mVertexBuffer->setBuffer(0); + mVertexBuffer->flush(); } } @@ -1724,7 +1734,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLVector4a::memcpyNonAliased16((F32*) weights, (F32*) vf.mWeights, num_vertices*4*sizeof(F32)); if (map_range) { - mVertexBuffer->setBuffer(0); + mVertexBuffer->flush(); } } @@ -1754,10 +1764,48 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (map_range) { - mVertexBuffer->setBuffer(0); + mVertexBuffer->flush(); } } + if (rebuild_emissive) + { + LLFastTimer t(FTM_FACE_GEOM_EMISSIVE); + LLStrider<LLColor4U> emissive; + mVertexBuffer->getEmissiveStrider(emissive, mGeomIndex, mGeomCount, map_range); + + U8 glow = (U8) llclamp((S32) (getTextureEntry()->getGlow()*255), 0, 255); + + LLVector4a src; + + + U32 glow32 = glow | + (glow << 8) | + (glow << 16) | + (glow << 24); + + U32 vec[4]; + vec[0] = vec[1] = vec[2] = vec[3] = glow32; + + src.loadua((F32*) vec); + + LLVector4a* dst = (LLVector4a*) emissive.get(); + S32 num_vecs = num_vertices/4; + if (num_vertices%4 > 0) + { + ++num_vecs; + } + + for (S32 i = 0; i < num_vecs; i++) + { + dst[i] = src; + } + + if (map_range) + { + mVertexBuffer->flush(); + } + } if (rebuild_tcoord) { mTexExtents[0].setVec(0,0); @@ -2014,7 +2062,7 @@ BOOL LLFace::verify(const U32* indices_array) const } // First, check whether the face data fits within the pool's range. - if ((mGeomIndex + mGeomCount) > mVertexBuffer->getRequestedVerts()) + if ((mGeomIndex + mGeomCount) > mVertexBuffer->getNumVerts()) { ok = FALSE; llinfos << "Face references invalid vertices!" << llendl; @@ -2033,7 +2081,7 @@ BOOL LLFace::verify(const U32* indices_array) const llinfos << "Face has bogus indices count" << llendl; } - if (mIndicesIndex + mIndicesCount > mVertexBuffer->getRequestedIndices()) + if (mIndicesIndex + mIndicesCount > mVertexBuffer->getNumIndices()) { ok = FALSE; llinfos << "Face references invalid indices!" << llendl; @@ -2095,7 +2143,7 @@ void LLFace::renderSetColor() const { const LLColor4* color = &(getRenderColor()); - glColor4fv(color->mV); + gGL.diffuseColor4fv(color->mV); } } @@ -2130,10 +2178,10 @@ S32 LLFace::renderElements(const U16 *index_array) const } else { - glPushMatrix(); - glMultMatrixf((float*)getRenderMatrix().mMatrix); + gGL.pushMatrix(); + gGL.multMatrix((float*)getRenderMatrix().mMatrix); ret = pushVertices(index_array); - glPopMatrix(); + gGL.popMatrix(); } return ret; |