Some minor cleanup. Bringing stuff in-line with current to ensure it all works before mesh is actually plugged in.

This commit is contained in:
Shyotl
2011-07-23 03:24:10 -05:00
parent 07c892480a
commit 179193d173
10 changed files with 121 additions and 79 deletions

View File

@@ -3980,7 +3980,6 @@ S32 LLVolume::getNumTriangles() const
//-----------------------------------------------------------------------------
void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
std::vector<LLVector3> &normals,
std::vector<S32> &segments,
const LLVector3& obj_cam_vec_in,
const LLMatrix4& mat_in,
const LLMatrix3& norm_mat_in,
@@ -3999,7 +3998,6 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
vertices.clear();
normals.clear();
segments.clear();
S32 cur_index = 0;
//for each face
@@ -4084,13 +4082,11 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
vertices.push_back(face.mVertices[j].getPosition() + face.mVertices[j].getNormal()*0.1f);
normals.push_back(LLVector3(0,0,1));
normals.push_back(LLVector3(0,0,1));
segments.push_back(vertices.size());
#if DEBUG_SILHOUETTE_BINORMALS
vertices.push_back(face.mVertices[j].getPosition());
vertices.push_back(face.mVertices[j].getPosition() + face.mVertices[j].mBinormal*0.1f);
normals.push_back(LLVector3(0,0,1));
normals.push_back(LLVector3(0,0,1));
segments.push_back(vertices.size());
#endif
}
@@ -4196,7 +4192,6 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
t.normalize3fast();
normals.push_back(LLVector3(t[0], t[1], t[2]));
segments.push_back(vertices.size());
}
}
}

View File

@@ -992,7 +992,6 @@ public:
void generateSilhouetteVertices(std::vector<LLVector3> &vertices,
std::vector<LLVector3> &normals,
std::vector<S32> &segments,
const LLVector3& view_vec,
const LLMatrix4& mat,
const LLMatrix3& norm_mat,

View File

@@ -471,6 +471,8 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture)
{
applyModelMatrix(params);
bool tex_setup = false;
if (texture)
{
if (params.mTexture.notNull())
@@ -479,6 +481,7 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture)
gGL.getTexUnit(0)->bind(params.mTexture, TRUE) ;
if (params.mTextureMatrix)
{
tex_setup = true;
glMatrixMode(GL_TEXTURE);
glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
gPipeline.mTextureMatrixOps++;
@@ -501,7 +504,7 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture)
gPipeline.addTrianglesDrawn(params.mCount/3);
}
if (params.mTextureMatrix && texture && params.mTexture.notNull())
if (tex_setup)
{
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);

View File

@@ -324,7 +324,6 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
LLRenderPass::applyModelMatrix(params);
{
if (params.mFullbright)
{
// Turn off lighting if it hasn't already been so.
@@ -394,6 +393,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
params.mGroup->rebuildMesh();
}
bool tex_setup = false;
if (params.mTexture.notNull())
{
@@ -404,13 +404,13 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
}
if (params.mTextureMatrix)
{
tex_setup = true;
gGL.getTexUnit(0)->activate();
glMatrixMode(GL_TEXTURE);
glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
gPipeline.mTextureMatrixOps++;
}
}
}
params.mVertexBuffer->setBuffer(mask);
params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
gPipeline.addTrianglesDrawn(params.mCount/3);
@@ -435,7 +435,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor);
}
if (params.mTextureMatrix && params.mTexture.notNull())
if (tex_setup)
{
gGL.getTexUnit(0)->activate();
glLoadIdentity();

View File

@@ -367,6 +367,24 @@ void LLFace::setSize(S32 num_vertices, const S32 num_indices, bool align)
llassert(verify());
}
void LLFace::setGeomIndex(U16 idx)
{
if (mGeomIndex != idx)
{
mGeomIndex = idx;
mVertexBuffer = NULL;
}
}
void LLFace::setIndicesIndex(S32 idx)
{
if (mIndicesIndex != idx)
{
mIndicesIndex = idx;
mVertexBuffer = NULL;
}
}
//============================================================================
U16 LLFace::getGeometryAvatar(
@@ -1505,7 +1523,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
LLVector4a normal;
mat_normal.rotate(vf.mNormals[i], normal);
normal.normalize3fast();
normals[i].set(normal.getF32ptr());
normals[i].set(normal.getF32ptr());
}
}
@@ -1516,7 +1534,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
LLVector4a binormal;
mat_normal.rotate(vf.mBinormals[i], binormal);
binormal.normalize3fast();
binormals[i].set(binormal.getF32ptr());
binormals[i].set(binormal.getF32ptr());
}
}

View File

@@ -202,8 +202,8 @@ public:
BOOL verify(const U32* indices_array = NULL) const;
void printDebugInfo() const;
void setGeomIndex(U16 idx) { mGeomIndex = idx; }
void setIndicesIndex(S32 idx) { mIndicesIndex = idx; }
void setGeomIndex(U16 idx);
void setIndicesIndex(S32 idx);
void setDrawInfo(LLDrawInfo* draw_info);
F32 getTextureVirtualSize() ;

View File

@@ -5224,7 +5224,6 @@ LLSelectNode::LLSelectNode(const LLSelectNode& nodep)
mSilhouetteVertices = nodep.mSilhouetteVertices;
mSilhouetteNormals = nodep.mSilhouetteNormals;
mSilhouetteSegments = nodep.mSilhouetteSegments;
mSilhouetteExists = nodep.mSilhouetteExists;
mObject = nodep.mObject;
@@ -5536,17 +5535,15 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
gGL.begin(LLRender::LINES);
{
S32 i = 0;
for (S32 seg_num = 0; seg_num < (S32)mSilhouetteSegments.size(); seg_num++)
for(S32 i = 0; i < (S32)mSilhouetteVertices.size(); i += 2)
{
for(; i < mSilhouetteSegments[seg_num]; i++)
{
u_coord += u_divisor * LLSelectMgr::sHighlightUScale;
gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f);
gGL.texCoord2f( u_coord, v_coord );
gGL.vertex3fv( mSilhouetteVertices[i].mV );
}
u_coord += u_divisor * LLSelectMgr::sHighlightUScale;
gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f);
gGL.texCoord2f( u_coord, v_coord );
gGL.vertex3fv( mSilhouetteVertices[i].mV);
u_coord += u_divisor * LLSelectMgr::sHighlightUScale;
gGL.texCoord2f( u_coord, v_coord );
gGL.vertex3fv(mSilhouetteVertices[i+1].mV);
}
}
gGL.end();
@@ -5557,51 +5554,50 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
gGL.setSceneBlendType(LLRender::BT_ALPHA);
gGL.begin(LLRender::TRIANGLES);
{
S32 i = 0;
for (S32 seg_num = 0; seg_num < (S32)mSilhouetteSegments.size(); seg_num++)
for(S32 i = 0; i < (S32)mSilhouetteVertices.size(); i+=2)
{
S32 first_i = i;
LLVector3 v;
LLVector2 t;
for(; i < mSilhouetteSegments[seg_num]; i++)
{
if (i == first_i) {
LLVector3 vert = (mSilhouetteNormals[i]) * silhouette_thickness;
vert += mSilhouetteVertices[i];
gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.0f); //LLSelectMgr::sHighlightAlpha);
gGL.texCoord2f( u_coord, v_coord + LLSelectMgr::sHighlightVScale );
gGL.vertex3fv( vert.mV );
u_coord += u_divisor * LLSelectMgr::sHighlightUScale;
gGL.color4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2);
gGL.texCoord2f( u_coord, v_coord );
gGL.vertex3fv( mSilhouetteVertices[i].mV );
v = mSilhouetteVertices[i];
t = LLVector2(u_coord, v_coord);
}
else {
LLVector3 vert = (mSilhouetteNormals[i]) * silhouette_thickness;
vert += mSilhouetteVertices[i];
gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.0f); //LLSelectMgr::sHighlightAlpha);
gGL.texCoord2f( u_coord, v_coord + LLSelectMgr::sHighlightVScale );
gGL.vertex3fv( vert.mV );
gGL.vertex3fv( vert.mV );
gGL.texCoord2fv(t.mV);
u_coord += u_divisor * LLSelectMgr::sHighlightUScale;
gGL.color4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2);
gGL.vertex3fv(v.mV);
gGL.texCoord2f( u_coord, v_coord );
gGL.vertex3fv( mSilhouetteVertices[i].mV );
}
if (!mSilhouetteNormals[i].isFinite() ||
!mSilhouetteNormals[i+1].isFinite())
{ //skip skewed segments
continue;
}
LLVector3 v[4];
LLVector2 tc[4];
v[0] = mSilhouetteVertices[i] + (mSilhouetteNormals[i] * silhouette_thickness);
tc[0].set(u_coord, v_coord + LLSelectMgr::sHighlightVScale);
v[1] = mSilhouetteVertices[i];
tc[1].set(u_coord, v_coord);
u_coord += u_divisor * LLSelectMgr::sHighlightUScale;
v[2] = mSilhouetteVertices[i+1] + (mSilhouetteNormals[i+1] * silhouette_thickness);
tc[2].set(u_coord, v_coord + LLSelectMgr::sHighlightVScale);
v[3] = mSilhouetteVertices[i+1];
tc[3].set(u_coord,v_coord);
gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.0f); //LLSelectMgr::sHighlightAlpha);
gGL.texCoord2fv(tc[0].mV);
gGL.vertex3fv( v[0].mV );
gGL.color4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2);
gGL.texCoord2fv( tc[1].mV );
gGL.vertex3fv( v[1].mV );
gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.0f); //LLSelectMgr::sHighlightAlpha);
gGL.texCoord2fv( tc[2].mV );
gGL.vertex3fv( v[2].mV );
gGL.vertex3fv( v[2].mV );
gGL.color4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2);
gGL.texCoord2fv( tc[1].mV );
gGL.vertex3fv( v[1].mV );
gGL.texCoord2fv( tc[3].mV );
gGL.vertex3fv( v[3].mV );
}
}
gGL.end();

View File

@@ -186,7 +186,6 @@ public:
std::vector<LLVector3> mTextureScaleRatios;
std::vector<LLVector3> mSilhouetteVertices; // array of vertices to render silhouette of object
std::vector<LLVector3> mSilhouetteNormals; // array of normals to render silhouette of object
std::vector<S32> mSilhouetteSegments; // array of normals to render silhouette of object
BOOL mSilhouetteExists; // need to generate silhouette?
protected:

View File

@@ -421,6 +421,29 @@ public:
addText(xpos, ypos, "Shaders Disabled");
ypos += y_inc;
}
if (gGLManager.mHasATIMemInfo)
{
S32 meminfo[4];
glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, meminfo);
addText(xpos, ypos, llformat("%.2f MB Texture Memory Free", meminfo[0]/1024.f));
ypos += y_inc;
if (gGLManager.mHasVertexBufferObject)
{
glGetIntegerv(GL_VBO_FREE_MEMORY_ATI, meminfo);
addText(xpos, ypos, llformat("%.2f MB VBO Memory Free", meminfo[0]/1024.f));
ypos += y_inc;
}
}
else if (gGLManager.mHasNVXMemInfo)
{
S32 free_memory;
glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &free_memory);
addText(xpos, ypos, llformat("%.2f MB Video Memory Free", free_memory/1024.f));
ypos += y_inc;
}
addText(xpos, ypos, llformat("%d MB Vertex Data", LLVertexBuffer::sAllocatedBytes/(1024*1024)));
ypos += y_inc;
@@ -469,6 +492,12 @@ public:
ypos += y_inc;
if (!LLSpatialGroup::sPendingQueries.empty())
{
addText(xpos,ypos, llformat("%d Queries pending", LLSpatialGroup::sPendingQueries.size()));
ypos += y_inc;
}
addText(xpos,ypos, llformat("%d Avatars visible", LLVOAvatar::sNumVisibleAvatars));

View File

@@ -2440,27 +2440,29 @@ void LLVOAvatar::updateMeshData()
bool terse_update = false;
facep->setGeomIndex(0);
facep->setIndicesIndex(0);
LLVertexBuffer* buff = facep->getVertexBuffer();
if(!facep->getVertexBuffer())
{
LLVertexBuffer *buff = new LLVertexBufferAvatar();
buff = new LLVertexBufferAvatar();
buff->allocateBuffer(num_vertices, num_indices, TRUE);
facep->setVertexBuffer(buff);
}
else
{
if (facep->getVertexBuffer()->getRequestedIndices() == num_indices &&
facep->getVertexBuffer()->getRequestedVerts() == num_vertices)
if (buff->getRequestedIndices() == num_indices &&
buff->getRequestedVerts() == num_vertices)
{
terse_update = true;
}
else
{
facep->getVertexBuffer()->resizeBuffer(num_vertices, num_indices) ;
buff->resizeBuffer(num_vertices, num_indices);
}
}
facep->setGeomIndex(0);
facep->setIndicesIndex(0);
// This is a hack! Avatars have their own pool, so we are detecting
// the case of more than one avatar in the pool (thus > 0 instead of >= 0)
@@ -2475,7 +2477,7 @@ void LLVOAvatar::updateMeshData()
}
stop_glerror();
facep->getVertexBuffer()->setBuffer(0);
buff->setBuffer(0);
if(!f_num)
{
@@ -3237,7 +3239,7 @@ void LLVOAvatar::idleUpdateLoadingEffect()
particle_parameters.mPartImageID = cloud->getID();
particle_parameters.mMaxAge = 0.f;
particle_parameters.mPattern = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE;
particle_parameters.mInnerAngle = 3.14159f;
particle_parameters.mInnerAngle = F_PI;
particle_parameters.mOuterAngle = 0.f;
particle_parameters.mBurstRate = 0.02f;
particle_parameters.mBurstRadius = 0.0f;
@@ -7140,7 +7142,8 @@ void LLVOAvatar::lazyAttach()
void LLVOAvatar::resetHUDAttachments()
{
for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
iter != mAttachmentPoints.end(); iter++)
iter != mAttachmentPoints.end();
++iter)
{
LLViewerJointAttachment* attachment = iter->second;
if (attachment->getIsHUDAttachment())