diff options
Diffstat (limited to 'indra/newview/llspatialpartition.cpp')
-rw-r--r-- | indra/newview/llspatialpartition.cpp | 100 |
1 files changed, 51 insertions, 49 deletions
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 65a78d9048..ffb0ce4056 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -48,6 +48,7 @@ #include "llvolumemgr.h" #include "lltextureatlas.h" #include "llglslshader.h" +#include "llviewershadermgr.h" static LLFastTimer::DeclareTimer FTM_FRUSTUM_CULL("Frustum Culling"); static LLFastTimer::DeclareTimer FTM_CULL_REBOUND("Cull Rebound"); @@ -2543,7 +2544,7 @@ void renderOctree(LLSpatialGroup* group) LLGLDepthTest gl_depth(FALSE, FALSE); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - gGL.color4f(1,0,0,group->mBuilt); + gGL.diffuseColor4f(1,0,0,group->mBuilt); gGL.flush(); glLineWidth(5.f); drawBoxOutline(group->mObjectBounds[0], group->mObjectBounds[1]); @@ -2591,7 +2592,7 @@ void renderOctree(LLSpatialGroup* group) } } glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - gGL.color4f(1,1,1,1); + gGL.diffuseColor4f(1,1,1,1); } } else*/ @@ -2607,7 +2608,7 @@ void renderOctree(LLSpatialGroup* group) } } - gGL.color4fv(col.mV); + gGL.diffuseColor4fv(col.mV); LLVector4a fudge; fudge.splat(0.001f); LLVector4a size = group->mObjectBounds[1]; @@ -2624,16 +2625,16 @@ void renderOctree(LLSpatialGroup* group) //if (group->mBuilt <= 0.f) { //draw opaque outline - //gGL.color4f(col.mV[0], col.mV[1], col.mV[2], 1.f); + //gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], 1.f); //drawBoxOutline(group->mObjectBounds[0], group->mObjectBounds[1]); - gGL.color4f(0,1,1,1); + gGL.diffuseColor4f(0,1,1,1); drawBoxOutline(group->mBounds[0],group->mBounds[1]); //draw bounding box for draw info /*if (group->mSpatialPartition->mRenderByGroup) { - gGL.color4f(1.0f, 0.75f, 0.25f, 0.6f); + gGL.diffuseColor4f(1.0f, 0.75f, 0.25f, 0.6f); for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i) { for (LLSpatialGroup::drawmap_elem_t::iterator j = i->second.begin(); j != i->second.end(); ++j) @@ -2652,7 +2653,7 @@ void renderOctree(LLSpatialGroup* group) } // LLSpatialGroup::OctreeNode* node = group->mOctreeNode; -// gGL.color4f(0,1,0,1); +// gGL.diffuseColor4f(0,1,0,1); // drawBoxOutline(LLVector3(node->getCenter()), LLVector3(node->getSize())); } @@ -2665,11 +2666,12 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera) BOOL render_objects = (!LLPipeline::sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) && group->isVisible() && !group->getData().empty(); + if (render_objects) { LLGLDepthTest depth_under(GL_TRUE, GL_FALSE, GL_GREATER); gGL.diffuseColor4f(0, 0.5f, 0, 0.5f); - gGL.color4f(0, 0.5f, 0, 0.5f); + gGL.diffuseColor4f(0, 0.5f, 0, 0.5f); pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX); } @@ -2679,7 +2681,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera) if (render_objects) { gGL.diffuseColor4f(0.f, 0.5f, 0.f,1.f); - gGL.color4f(0.f, 0.5f, 0.f, 1.f); + gGL.diffuseColor4f(0.f, 0.5f, 0.f, 1.f); pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX); } @@ -2688,7 +2690,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera) if (render_objects) { gGL.diffuseColor4f(0.f, 0.75f, 0.f,0.5f); - gGL.color4f(0.f, 0.75f, 0.f, 0.5f); + gGL.diffuseColor4f(0.f, 0.75f, 0.f, 0.5f); pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX); } /*else if (camera && group->mOcclusionVerts.notNull()) @@ -2709,7 +2711,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera) void renderCrossHairs(LLVector3 position, F32 size, LLColor4 color) { - gGL.color4fv(color.mV); + gGL.diffuseColor4fv(color.mV); gGL.begin(LLRender::LINES); { gGL.vertex3fv((position - LLVector3(size, 0.f, 0.f)).mV); @@ -2881,17 +2883,17 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE) { if (drawable->isSpatialBridge()) { - gGL.color4f(1,0.5f,0,1); + gGL.diffuseColor4f(1,0.5f,0,1); } else if (drawable->getVOVolume()) { if (drawable->isRoot()) { - gGL.color4f(1,1,0,1); + gGL.diffuseColor4f(1,1,0,1); } else { - gGL.color4f(0,1,0,1); + gGL.diffuseColor4f(0,1,0,1); } } else if (drawable->getVObj()) @@ -2899,30 +2901,30 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE) switch (drawable->getVObj()->getPCode()) { case LLViewerObject::LL_VO_SURFACE_PATCH: - gGL.color4f(0,1,1,1); + gGL.diffuseColor4f(0,1,1,1); break; case LLViewerObject::LL_VO_CLOUDS: // no longer used break; case LLViewerObject::LL_VO_PART_GROUP: case LLViewerObject::LL_VO_HUD_PART_GROUP: - gGL.color4f(0,0,1,1); + gGL.diffuseColor4f(0,0,1,1); break; case LLViewerObject::LL_VO_VOID_WATER: case LLViewerObject::LL_VO_WATER: - gGL.color4f(0,0.5f,1,1); + gGL.diffuseColor4f(0,0.5f,1,1); break; case LL_PCODE_LEGACY_TREE: - gGL.color4f(0,0.5f,0,1); + gGL.diffuseColor4f(0,0.5f,0,1); break; default: - gGL.color4f(1,0,1,1); + gGL.diffuseColor4f(1,0,1,1); break; } } else { - gGL.color4f(1,0,0,1); + gGL.diffuseColor4f(1,0,0,1); } } @@ -2996,7 +2998,7 @@ void renderNormals(LLDrawable* drawablep) n.setMul(face.mNormals[j], scale); p.setAdd(face.mPositions[j], n); - gGL.color4f(1,1,1,1); + gGL.diffuseColor4f(1,1,1,1); gGL.vertex3fv(face.mPositions[j].getF32ptr()); gGL.vertex3fv(p.getF32ptr()); @@ -3005,7 +3007,7 @@ void renderNormals(LLDrawable* drawablep) n.setMul(face.mBinormals[j], scale); p.setAdd(face.mPositions[j], n); - gGL.color4f(0,1,1,1); + gGL.diffuseColor4f(0,1,1,1); gGL.vertex3fv(face.mPositions[j].getF32ptr()); gGL.vertex3fv(p.getF32ptr()); } @@ -3063,7 +3065,7 @@ void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color, LLCo } else { - gGL.color3f(1,0,1); + gGL.diffuseColor3f(1,0,1); drawBoxOutline(center, size); } } @@ -3179,7 +3181,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) } else { - gGL.color3f(1,1,0); + gGL.diffuseColor3f(1,1,0); drawBoxOutline(center, size); } } @@ -3315,7 +3317,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) LLVector3 vscale = volume->getScale()*2.f; scale.set(scale[0]/vscale[0], scale[1]/vscale[1], scale[2]/vscale[2]); - gGL.color4fv(color.mV); + gGL.diffuseColor4fv(color.mV); drawBox(center, scale); } else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::SPHERE) @@ -3385,7 +3387,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) } else { - gGL.color3f(1,0,1); + gGL.diffuseColor3f(1,0,1); drawBoxOutline(center, size); gMeshRepo.buildHull(volume_params, detail); } @@ -3481,11 +3483,11 @@ void renderTexturePriority(LLDrawable* drawable) F32 t = vsize/sLastMaxTexPriority; LLVector4 col = lerp(cold, hot, t); - gGL.color4fv(col.mV); + gGL.diffuseColor4fv(col.mV); } //else //{ - // gGL.color4f(1,0,1,1); + // gGL.diffuseColor4f(1,0,1,1); //} LLVector4a center; @@ -3504,7 +3506,7 @@ void renderTexturePriority(LLDrawable* drawable) LLVector4 col = lerp(boost_cold, boost_hot, t); LLGLEnable blend_on(GL_BLEND); gGL.blendFunc(GL_SRC_ALPHA, GL_ONE); - gGL.color4fv(col.mV); + gGL.diffuseColor4fv(col.mV); drawBox(center, size); gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); }*/ @@ -3517,7 +3519,7 @@ void renderPoints(LLDrawable* drawablep) if (drawablep->getNumFaces()) { gGL.begin(LLRender::POINTS); - gGL.color3f(1,1,1); + gGL.diffuseColor3f(1,1,1); for (S32 i = 0; i < drawablep->getNumFaces(); i++) { gGL.vertex3fv(drawablep->getFace(i)->mCenterLocal.mV); @@ -3542,7 +3544,7 @@ void renderBatchSize(LLDrawInfo* params) { LLGLEnable offset(GL_POLYGON_OFFSET_FILL); glPolygonOffset(-1.f, 1.f); - glColor3ubv((GLubyte*) &(params->mDebugColor)); + gGL.diffuseColor4ubv((GLubyte*) &(params->mDebugColor)); pushVerts(params, LLVertexBuffer::MAP_VERTEX); } @@ -3611,11 +3613,11 @@ void renderLights(LLDrawable* drawablep) { LLGLDepthTest depth(GL_FALSE, GL_TRUE); - gGL.color4f(1,1,1,1); + gGL.diffuseColor4f(1,1,1,1); drawBoxOutline(pos, size); } - gGL.color4f(1,1,0,1); + gGL.diffuseColor4f(1,1,0,1); F32 rad = drawablep->getVOVolume()->getLightRadius(); drawBoxOutline(pos, LLVector4a(rad)); } @@ -3640,13 +3642,13 @@ public: if (branch->getData().empty()) { - gGL.color3f(1.f,0.2f,0.f); + gGL.diffuseColor3f(1.f,0.2f,0.f); center.set(branch->getCenter().getF32ptr()); size.set(branch->getSize().getF32ptr()); } else { - gGL.color3f(0.75f, 1.f, 0.f); + gGL.diffuseColor3f(0.75f, 1.f, 0.f); center.set(vl->mBounds[0].getF32ptr()); size.set(vl->mBounds[1].getF32ptr()); } @@ -3659,11 +3661,11 @@ public: if (i == 1) { - gGL.color4f(0,1,1,0.5f); + gGL.diffuseColor4f(0,1,1,0.5f); } else { - gGL.color4f(0,0.5f,0.5f, 0.25f); + gGL.diffuseColor4f(0,0.5f,0.5f, 0.25f); drawBoxOutline(center, size); } @@ -3700,7 +3702,7 @@ void renderRaycast(LLDrawable* drawablep) if (drawablep->getNumFaces()) { LLGLEnable blend(GL_BLEND); - gGL.color4f(0,1,1,0.5f); + gGL.diffuseColor4f(0,1,1,0.5f); if (drawablep->getVOVolume()) { @@ -3796,11 +3798,11 @@ void renderRaycast(LLDrawable* drawablep) orient.getRotMatrixToParent(rotation); gGL.multMatrix((float*)rotation.mMatrix); - gGL.color4f(1,0,0,0.5f); + gGL.diffuseColor4f(1,0,0,0.5f); drawBox(LLVector3(0, 0, 0), LLVector3(0.1f, 0.022f, 0.022f)); - gGL.color4f(0,1,0,0.5f); + gGL.diffuseColor4f(0,1,0,0.5f); drawBox(LLVector3(0, 0, 0), LLVector3(0.021f, 0.1f, 0.021f)); - gGL.color4f(0,0,1,0.5f); + gGL.diffuseColor4f(0,0,1,0.5f); drawBox(LLVector3(0, 0, 0), LLVector3(0.02f, 0.02f, 0.1f)); gGL.popMatrix(); @@ -3815,7 +3817,7 @@ void renderRaycast(LLDrawable* drawablep) size.mul(0.5f); LLGLDepthTest depth(GL_FALSE, GL_TRUE); - gGL.color4f(0,0.5f,0.5f,1); + gGL.diffuseColor4f(0,0.5f,0.5f,1); drawBoxOutline(pos, size); } } @@ -3884,7 +3886,7 @@ public: stop_glerror(); gGLLastMatrix = NULL; gGL.popMatrix(); - gGL.color4f(1,1,1,1); + gGL.diffuseColor4f(1,1,1,1); } } } @@ -3908,7 +3910,7 @@ public: { if (!group->getData().empty()) { - gGL.color3f(0,0,1); + gGL.diffuseColor3f(0,0,1); drawBoxOutline(group->mObjectBounds[0], group->mObjectBounds[1]); } @@ -3917,7 +3919,7 @@ public: for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) { LLDrawable* drawable = *i; - + if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_BBOXES)) { renderBoundingBox(drawable); @@ -3932,7 +3934,7 @@ public: { if (drawable->isState(LLDrawable::IN_REBUILD_Q2)) { - gGL.color4f(0.6f, 0.6f, 0.1f, 1.f); + gGL.diffuseColor4f(0.6f, 0.6f, 0.1f, 1.f); const LLVector4a* ext = drawable->getSpatialExtents(); LLVector4a center; center.setAdd(ext[0], ext[1]); @@ -4227,7 +4229,7 @@ void LLSpatialPartition::renderDebug() if (LLGLSLShader::sNoFixedFunction) { - gUIProgram.bind(); + gDebugProgram.bind(); } if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY)) @@ -4261,13 +4263,13 @@ void LLSpatialPartition::renderDebug() if (LLGLSLShader::sNoFixedFunction) { - gUIProgram.unbind(); + gDebugProgram.unbind(); } } void LLSpatialGroup::drawObjectBox(LLColor4 col) { - gGL.color4fv(col.mV); + gGL.diffuseColor4fv(col.mV); LLVector4a size; size = mObjectBounds[1]; size.mul(1.01f); |