summaryrefslogtreecommitdiff
path: root/indra/newview/llspatialpartition.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llspatialpartition.cpp')
-rw-r--r--indra/newview/llspatialpartition.cpp319
1 files changed, 196 insertions, 123 deletions
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index faf6f15015..2498a54ada 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -47,6 +47,7 @@
#include "pipeline.h"
#include "llmeshrepository.h"
#include "llrender.h"
+#include "lldrawpool.h"
#include "lloctree.h"
#include "llphysicsshapebuilderutil.h"
#include "llvoavatar.h"
@@ -69,7 +70,7 @@ static F32 sCurMaxTexPriority = 1.f;
//static counter for frame to switch LOD on
-void sg_assert(BOOL expr)
+void sg_assert(bool expr)
{
#if LL_OCTREE_PARANOIA_CHECK
if (!expr)
@@ -135,7 +136,7 @@ void LLSpatialGroup::clearDrawMap()
mDrawMap.clear();
}
-BOOL LLSpatialGroup::isHUDGroup()
+bool LLSpatialGroup::isHUDGroup()
{
return getSpatialPartition() && getSpatialPartition()->isHUDPartition() ;
}
@@ -217,7 +218,7 @@ void LLSpatialGroup::validateDrawMap()
#endif
}
-BOOL LLSpatialGroup::updateInGroup(LLDrawable *drawablep, BOOL immediate)
+bool LLSpatialGroup::updateInGroup(LLDrawable *drawablep, bool immediate)
{
LL_PROFILE_ZONE_SCOPED;
drawablep->updateSpatialExtents();
@@ -232,10 +233,10 @@ BOOL LLSpatialGroup::updateInGroup(LLDrawable *drawablep, BOOL immediate)
unbound();
setState(OBJECT_DIRTY);
//setState(GEOM_DIRTY);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void LLSpatialGroup::expandExtents(const LLVector4a* addingExtents, const LLXformMatrix& currentTransform)
@@ -292,11 +293,11 @@ void LLSpatialGroup::expandExtents(const LLVector4a* addingExtents, const LLXfor
mBounds[1].mul(0.5f);
}
-BOOL LLSpatialGroup::addObject(LLDrawable *drawablep)
+bool LLSpatialGroup::addObject(LLDrawable *drawablep)
{
if(!drawablep)
{
- return FALSE;
+ return false;
}
{
drawablep->setGroup(this);
@@ -313,7 +314,7 @@ BOOL LLSpatialGroup::addObject(LLDrawable *drawablep)
}
}
- return TRUE;
+ return true;
}
void LLSpatialGroup::rebuildGeom()
@@ -406,13 +407,13 @@ LLSpatialGroup* LLSpatialGroup::getParent()
return (LLSpatialGroup*)LLViewerOctreeGroup::getParent();
}
-BOOL LLSpatialGroup::removeObject(LLDrawable *drawablep, BOOL from_octree)
+bool LLSpatialGroup::removeObject(LLDrawable *drawablep, bool from_octree)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
if(!drawablep)
{
- return FALSE;
+ return false;
}
unbound();
@@ -443,7 +444,7 @@ BOOL LLSpatialGroup::removeObject(LLDrawable *drawablep, BOOL from_octree)
clearDrawMap();
}
}
- return TRUE;
+ return true;
}
void LLSpatialGroup::shift(const LLVector4a &offset)
@@ -726,14 +727,14 @@ F32 LLSpatialGroup::getUpdateUrgency() const
}
}
-BOOL LLSpatialGroup::changeLOD()
+bool LLSpatialGroup::changeLOD()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
if (hasState(ALPHA_DIRTY | OBJECT_DIRTY))
{
//a rebuild is going to happen, update distance and LoD
- return TRUE;
+ return true;
}
if (getSpatialPartition()->mSlopRatio > 0.f)
@@ -762,16 +763,16 @@ BOOL LLSpatialGroup::changeLOD()
<< " fab ratio " << fabsf(ratio)
<< " slop " << getSpatialPartition()->mSlopRatio << LL_ENDL;
- return TRUE;
+ return true;
}
}
if (needsUpdate())
{
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void LLSpatialGroup::handleInsertion(const TreeNode* node, LLViewerOctreeEntry* entry)
@@ -783,7 +784,7 @@ void LLSpatialGroup::handleInsertion(const TreeNode* node, LLViewerOctreeEntry*
void LLSpatialGroup::handleRemoval(const TreeNode* node, LLViewerOctreeEntry* entry)
{
- removeObject((LLDrawable*)entry->getDrawable(), TRUE);
+ removeObject((LLDrawable*)entry->getDrawable(), true);
LLViewerOctreeGroup::handleRemoval(node, entry);
}
@@ -910,15 +911,15 @@ void LLSpatialGroup::destroyGLState(bool keep_occlusion)
//==============================================
-LLSpatialPartition::LLSpatialPartition(U32 data_mask, BOOL render_by_group, LLViewerRegion* regionp)
+LLSpatialPartition::LLSpatialPartition(U32 data_mask, bool render_by_group, LLViewerRegion* regionp)
: mRenderByGroup(render_by_group), mBridge(NULL)
{
mRegionp = regionp;
mPartitionType = LLViewerRegion::PARTITION_NONE;
mVertexDataMask = data_mask;
- mDepthMask = FALSE;
+ mDepthMask = false;
mSlopRatio = 0.25f;
- mInfiniteFarClip = FALSE;
+ mInfiniteFarClip = false;
new LLSpatialGroup(mOctree, this);
}
@@ -929,7 +930,7 @@ LLSpatialPartition::~LLSpatialPartition()
cleanup();
}
-LLSpatialGroup *LLSpatialPartition::put(LLDrawable *drawablep, BOOL was_visible)
+LLSpatialGroup *LLSpatialPartition::put(LLDrawable *drawablep, bool was_visible)
{
LL_PROFILE_ZONE_SCOPED;
drawablep->updateSpatialExtents();
@@ -955,7 +956,7 @@ LLSpatialGroup *LLSpatialPartition::put(LLDrawable *drawablep, BOOL was_visible)
return group;
}
-BOOL LLSpatialPartition::remove(LLDrawable *drawablep, LLSpatialGroup *curp)
+bool LLSpatialPartition::remove(LLDrawable *drawablep, LLSpatialGroup *curp)
{
LL_PROFILE_ZONE_SCOPED;
if (!curp->removeObject(drawablep))
@@ -969,10 +970,10 @@ BOOL LLSpatialPartition::remove(LLDrawable *drawablep, LLSpatialGroup *curp)
assert_octree_valid(mOctree);
- return TRUE;
+ return true;
}
-void LLSpatialPartition::move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL immediate)
+void LLSpatialPartition::move(LLDrawable *drawablep, LLSpatialGroup *curp, bool immediate)
{
LL_PROFILE_ZONE_SCOPED;
// sanity check submitted by open source user bushing Spatula
@@ -983,7 +984,7 @@ void LLSpatialPartition::move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL
return;
}
- BOOL was_visible = curp ? curp->isVisible() : FALSE;
+ bool was_visible = curp ? curp->isVisible() : false;
if (curp && curp->getSpatialPartition() != this)
{
@@ -1132,7 +1133,7 @@ class LLOctreeCullVisExtents: public LLOctreeCullShadow
{
public:
LLOctreeCullVisExtents(LLCamera* camera, LLVector4a& min, LLVector4a& max)
- : LLOctreeCullShadow(camera), mMin(min), mMax(max), mEmpty(TRUE) { }
+ : LLOctreeCullShadow(camera), mMin(min), mMax(max), mEmpty(true) { }
virtual bool earlyFail(LLViewerOctreeGroup* base_group)
{
@@ -1185,7 +1186,7 @@ public:
{
if (AABBInFrustumObjectBounds(group) > 0)
{
- mEmpty = FALSE;
+ mEmpty = false;
const LLVector4a* exts = group->getObjectExtents();
update_min_max(mMin, mMax, exts[0]);
update_min_max(mMin, mMax, exts[1]);
@@ -1193,14 +1194,14 @@ public:
}
else
{
- mEmpty = FALSE;
+ mEmpty = false;
const LLVector4a* exts = group->getExtents();
update_min_max(mMin, mMax, exts[0]);
update_min_max(mMin, mMax, exts[1]);
}
}
- BOOL mEmpty;
+ bool mEmpty;
LLVector4a& mMin;
LLVector4a& mMax;
};
@@ -1209,7 +1210,7 @@ class LLOctreeCullDetectVisible: public LLOctreeCullShadow
{
public:
LLOctreeCullDetectVisible(LLCamera* camera)
- : LLOctreeCullShadow(camera), mResult(FALSE) { }
+ : LLOctreeCullShadow(camera), mResult(false) { }
virtual bool earlyFail(LLViewerOctreeGroup* base_group)
{
@@ -1230,11 +1231,11 @@ public:
{
if (base_group->isVisible())
{
- mResult = TRUE;
+ mResult = true;
}
}
- BOOL mResult;
+ bool mResult;
};
class LLOctreeSelect : public LLOctreeCull
@@ -1262,7 +1263,7 @@ public:
{
if (drawable->isSpatialBridge())
{
- drawable->setVisible(*mCamera, mResults, TRUE);
+ drawable->setVisible(*mCamera, mResults, true);
}
else
{
@@ -1378,7 +1379,7 @@ void LLSpatialPartition::restoreGL()
{
}
-BOOL LLSpatialPartition::getVisibleExtents(LLCamera& camera, LLVector3& visMin, LLVector3& visMax)
+bool LLSpatialPartition::getVisibleExtents(LLCamera& camera, LLVector3& visMin, LLVector3& visMax)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL;
LLVector4a visMina, visMaxa;
@@ -1398,14 +1399,14 @@ BOOL LLSpatialPartition::getVisibleExtents(LLCamera& camera, LLVector3& visMin,
return vis.mEmpty;
}
-BOOL LLSpatialPartition::visibleObjectsInFrustum(LLCamera& camera)
+bool LLSpatialPartition::visibleObjectsInFrustum(LLCamera& camera)
{
LLOctreeCullDetectVisible vis(&camera);
vis.traverse(mOctree);
return vis.mResult;
}
-S32 LLSpatialPartition::cull(LLCamera &camera, std::vector<LLDrawable *>* results, BOOL for_select)
+S32 LLSpatialPartition::cull(LLCamera &camera, std::vector<LLDrawable *>* results, bool for_select)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL;
#if LL_OCTREE_PARANOIA_CHECK
@@ -1426,7 +1427,7 @@ S32 LLSpatialPartition::cull(LLCamera &camera, std::vector<LLDrawable *>* result
return 0;
}
-extern BOOL gCubeSnapshot;
+extern bool gCubeSnapshot;
S32 LLSpatialPartition::cull(LLCamera &camera, bool do_occlusion)
{
@@ -1653,7 +1654,7 @@ void renderOctree(LLSpatialGroup* group)
col.setVec(0.1f,0.1f,1,0.1f);
{
- LLGLDepthTest gl_depth(FALSE, FALSE);
+ LLGLDepthTest gl_depth(false, false);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
gGL.diffuseColor4f(1,0,0,group->mBuilt);
@@ -1783,7 +1784,7 @@ std::set<LLSpatialGroup*> visible_selected_groups;
void renderXRay(LLSpatialGroup* group, LLCamera* camera)
{
- BOOL render_objects = (!LLPipeline::sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) && group->isVisible() &&
+ bool render_objects = (!LLPipeline::sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) && group->isVisible() &&
!group->isEmpty();
if (render_objects)
@@ -1875,7 +1876,7 @@ void renderUpdateType(LLDrawable* drawablep)
}
}
-void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE)
+void renderBoundingBox(LLDrawable* drawable, bool set_color = true)
{
if (set_color)
{
@@ -1990,7 +1991,11 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE)
drawBoxOutline(pos,size);
}
}
-
+// *TODO: LLDrawables which are not part of LLVOVolumes fall into a different
+// code path which uses a shader - it was tested to be faster than mapping a
+// vertex buffer in the terrain case. Consider using it for LLVOVolumes as well
+// to simplify and speed up this debug code. Alternatively, a compute shader is
+// likely faster. -Cosmic,2023-09-28
void renderNormals(LLDrawable *drawablep)
{
if (!drawablep->isVisible())
@@ -1998,11 +2003,13 @@ void renderNormals(LLDrawable *drawablep)
LLVertexBuffer::unbind();
+ LLViewerObject* obj = drawablep->getVObj();
LLVOVolume *vol = drawablep->getVOVolume();
- if (vol)
+ if (obj)
{
- LLVolume *volume = vol->getVolume();
+ LLGLEnable blend(GL_BLEND);
+ LLGLDepthTest gl_depth(GL_TRUE, GL_FALSE);
// Drawable's normals & tangents are stored in model space, i.e. before any scaling is applied.
//
@@ -2011,68 +2018,136 @@ void renderNormals(LLDrawable *drawablep)
// transform. We get that effect here by pre-applying the inverse scale (twice, because
// one forward scale will be re-applied via the MVP in the vertex shader)
- LLVector3 scale_v3 = vol->getScale();
- float scale_len = scale_v3.length();
- LLVector4a obj_scale(scale_v3.mV[VX], scale_v3.mV[VY], scale_v3.mV[VZ]);
- obj_scale.normalize3();
+ LLVector4a inv_scale;
+ float scale_len;
+ if (vol)
+ {
+ LLVector3 scale_v3 = vol->getScale();
+ LLVector4a obj_scale(scale_v3.mV[VX], scale_v3.mV[VY], scale_v3.mV[VZ]);
+ obj_scale.normalize3();
- // Normals &tangent line segments get scaled along with the object. Divide by scale length
- // to keep the as-viewed lengths (relatively) constant with the debug setting length
- float draw_length = gSavedSettings.getF32("RenderDebugNormalScale") / scale_len;
+ // Create inverse-scale vector for normals
+ inv_scale.set(1.0 / scale_v3.mV[VX], 1.0 / scale_v3.mV[VY], 1.0 / scale_v3.mV[VZ], 0.0);
+ inv_scale.mul(inv_scale); // Squared, to apply inverse scale twice
- // Create inverse-scale vector for normals
- LLVector4a inv_scale(1.0 / scale_v3.mV[VX], 1.0 / scale_v3.mV[VY], 1.0 / scale_v3.mV[VZ]);
- inv_scale.mul(inv_scale); // Squared, to apply inverse scale twice
- inv_scale.normalize3fast();
+ inv_scale.normalize3fast();
+ scale_len = scale_v3.length();
+ }
+ else
+ {
+ inv_scale.set(1.0, 1.0, 1.0, 0.0);
+ scale_len = 1.0;
+ }
gGL.pushMatrix();
- gGL.multMatrix((F32 *) vol->getRelativeXform().mMatrix);
+ if (vol)
+ {
+ gGL.multMatrix((F32 *) vol->getRelativeXform().mMatrix);
+ }
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)
+ // Normals &tangent line segments get scaled along with the object. Divide by scale length
+ // to keep the as-viewed lengths (relatively) constant with the debug setting length
+ float draw_length = gSavedSettings.getF32("RenderDebugNormalScale") / scale_len;
+
+ std::vector<LLVolumeFace>* faces = nullptr;
+ std::vector<LLFace*>* drawable_faces = nullptr;
+ if (vol)
{
- const LLVolumeFace &face = volume->getVolumeFace(i);
+ LLVolume* volume = vol->getVolume();
+ faces = &volume->getVolumeFaces();
+ }
+ else
+ {
+ drawable_faces = &drawablep->getFaces();
+ }
- gGL.flush();
- gGL.diffuseColor4f(1, 1, 0, 1);
- gGL.begin(LLRender::LINES);
- for (S32 j = 0; j < face.mNumVertices; ++j)
- {
- LLVector4a n, p;
+ if (faces)
+ {
+ for (auto it = faces->begin(); it != faces->end(); ++it)
+ {
+ const LLVolumeFace& face = *it;
- n.setMul(face.mNormals[j], 1.0);
- n.mul(inv_scale); // Pre-scale normal, so it's left with an inverse-transpose xform after MVP
- n.normalize3fast();
- n.mul(draw_length);
- p.setAdd(face.mPositions[j], n);
+ gGL.flush();
+ gGL.diffuseColor4f(1, 1, 0, 1);
+ gGL.begin(LLRender::LINES);
+ for (S32 j = 0; j < face.mNumVertices; ++j)
+ {
+ LLVector4a n, p;
- gGL.vertex3fv(face.mPositions[j].getF32ptr());
- gGL.vertex3fv(p.getF32ptr());
- }
- gGL.end();
+ n.setMul(face.mNormals[j], 1.0);
+ n.mul(inv_scale); // Pre-scale normal, so it's left with an inverse-transpose xform after MVP
+ n.normalize3fast();
+ n.mul(draw_length);
+ p.setAdd(face.mPositions[j], n);
+
+ gGL.vertex3fv(face.mPositions[j].getF32ptr());
+ gGL.vertex3fv(p.getF32ptr());
+ }
+ gGL.end();
+
+ // Tangents are simple vectors and do not require reorientation via pre-scaling
+ if (face.mTangents)
+ {
+ gGL.flush();
+ gGL.diffuseColor4f(0, 1, 1, 1);
+ gGL.begin(LLRender::LINES);
+ for (S32 j = 0; j < face.mNumVertices; ++j)
+ {
+ LLVector4a t, p;
- // Tangents are simple vectors and do not require reorientation via pre-scaling
- if (face.mTangents)
+ t.setMul(face.mTangents[j], 1.0f);
+ t.normalize3fast();
+ t.mul(draw_length);
+ p.setAdd(face.mPositions[j], t);
+
+ gGL.vertex3fv(face.mPositions[j].getF32ptr());
+ gGL.vertex3fv(p.getF32ptr());
+ }
+ gGL.end();
+ }
+ }
+ }
+ else if (drawable_faces)
+ {
+ // *HACK: Prepare to restore previous shader as other debug code depends on a simpler shader being present
+ llassert(LLGLSLShader::sCurBoundShaderPtr == &gDebugProgram);
+ LLGLSLShader* prev_shader = LLGLSLShader::sCurBoundShaderPtr;
+ for (auto it = drawable_faces->begin(); it != drawable_faces->end(); ++it)
{
- gGL.flush();
- gGL.diffuseColor4f(0, 1, 1, 1);
- gGL.begin(LLRender::LINES);
- for (S32 j = 0; j < face.mNumVertices; ++j)
+ LLFace* facep = *it;
+ LLFace& face = **it;
+ LLVertexBuffer* buf = face.getVertexBuffer();
+ if (!buf) { continue; }
+ U32 mask_vn = LLVertexBuffer::TYPE_VERTEX | LLVertexBuffer::TYPE_NORMAL;
+ if ((buf->getTypeMask() & mask_vn) != mask_vn) { continue; }
+
+ LLGLSLShader* shader;
+ if ((buf->getTypeMask() & LLVertexBuffer::TYPE_TANGENT) != LLVertexBuffer::TYPE_TANGENT)
{
- LLVector4a t, p;
+ shader = &gNormalDebugProgram[NORMAL_DEBUG_SHADER_DEFAULT];
+ }
+ else
+ {
+ shader = &gNormalDebugProgram[NORMAL_DEBUG_SHADER_WITH_TANGENTS];
+ }
+ shader->bind();
- t.setMul(face.mTangents[j], 1.0f);
- t.normalize3fast();
- t.mul(draw_length);
- p.setAdd(face.mPositions[j], t);
+ shader->uniform1f(LLShaderMgr::DEBUG_NORMAL_DRAW_LENGTH, draw_length);
- gGL.vertex3fv(face.mPositions[j].getF32ptr());
- gGL.vertex3fv(p.getF32ptr());
- }
- gGL.end();
+ LLRenderPass::applyModelMatrix(&facep->getDrawable()->getRegion()->mRenderMatrix);
+
+ buf->setBuffer();
+ // *NOTE: The render type in the vertex shader is TRIANGLES, but gets converted to LINES in the geometry shader
+ // *NOTE: For terrain normal debug, this seems to also include vertices for water, which is technically not part of the terrain. Should fix that at some point.
+ buf->drawRange(LLRender::TRIANGLES, face.getGeomIndex(), face.getGeomIndex() + face.getGeomCount()-1, face.getIndicesCount(), face.getIndicesStart());
}
- }
+ if (prev_shader)
+ {
+ prev_shader->bind();
+ }
+ }
gGL.popMatrix();
}
@@ -2682,7 +2757,7 @@ void renderTexelDensity(LLDrawable* drawable)
checkerboard_matrix.initScale(LLVector3(texturep->getWidth(discard_level) / 8, texturep->getHeight(discard_level) / 8, 1.f));
- gGL.getTexUnit(0)->bind(LLViewerTexture::sCheckerBoardImagep, TRUE);
+ gGL.getTexUnit(0)->bind(LLViewerTexture::sCheckerBoardImagep, true);
gGL.matrixMode(LLRender::MM_TEXTURE);
gGL.loadMatrix((GLfloat*)&checkerboard_matrix.mMatrix);
@@ -2735,7 +2810,7 @@ void renderTexelDensity(LLDrawable* drawable)
// //gGL.matrixMode(LLRender::MM_TEXTURE);
// glLoadMatrixf((GLfloat*) checkboard_matrix.mMatrix);
- // gGL.getTexUnit(i)->bind(LLViewerTexture::sCheckerBoardImagep, TRUE);
+ // gGL.getTexUnit(i)->bind(LLViewerTexture::sCheckerBoardImagep, true);
// pushVerts(params, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_NORMAL );
@@ -2791,10 +2866,8 @@ void renderLights(LLDrawable* drawablep)
class LLRenderOctreeRaycast : public LLOctreeTriangleRayIntersect
{
public:
-
-
LLRenderOctreeRaycast(const LLVector4a& start, const LLVector4a& dir, F32* closest_t)
- : LLOctreeTriangleRayIntersect(start, dir, NULL, closest_t, NULL, NULL, NULL, NULL)
+ : LLOctreeTriangleRayIntersect(start, dir, nullptr, closest_t, NULL, NULL, NULL, NULL)
{
}
@@ -2818,7 +2891,7 @@ public:
size.set(vl->mBounds[1].getF32ptr());
}
- drawBoxOutline(center, size);
+ drawBoxOutline(center, size);
for (U32 i = 0; i < 2; i++)
{
@@ -2862,6 +2935,13 @@ public:
}
};
+void renderOctreeRaycast(const LLVector4a& start, const LLVector4a& end, const LLVolumeOctree* octree)
+{
+ F32 t = 1.f;
+ LLRenderOctreeRaycast render(start, end, &t);
+ render.traverse(octree);
+}
+
void renderRaycast(LLDrawable* drawablep)
{
if (drawablep->getNumFaces())
@@ -2919,29 +2999,22 @@ void renderRaycast(LLDrawable* drawablep)
dir.setSub(end, start);
gGL.flush();
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
{
//render face positions
- LLVertexBuffer::unbind();
- gGL.diffuseColor4f(0,1,1,0.5f);
- glVertexPointer(3, GL_FLOAT, sizeof(LLVector4a), face.mPositions);
- gGL.syncMatrices();
- glDrawElements(GL_TRIANGLES, face.mNumIndices, GL_UNSIGNED_SHORT, face.mIndices);
+ //gGL.diffuseColor4f(0,1,1,0.5f);
+ //LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mPositions, nullptr, face.mNumIndices, face.mIndices);
}
if (!volume->isUnique())
{
- F32 t = 1.f;
-
if (!face.getOctree())
{
((LLVolumeFace*) &face)->createOctree();
}
- LLRenderOctreeRaycast render(start, dir, &t);
-
- render.traverse(face.getOctree());
+ renderOctreeRaycast(start, end, face.getOctree());
}
gGL.popMatrix();
@@ -3374,7 +3447,7 @@ public:
{
continue;
}
- renderBoundingBox(drawable, FALSE);
+ renderBoundingBox(drawable, false);
}
}
};
@@ -3563,14 +3636,14 @@ bool LLSpatialPartition::isHUDPartition()
return mPartitionType == LLViewerRegion::PARTITION_HUD ;
}
-BOOL LLSpatialPartition::isVisible(const LLVector3& v)
+bool LLSpatialPartition::isVisible(const LLVector3& v)
{
if (!LLViewerCamera::getInstance()->sphereInFrustum(v, 4.0f))
{
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
LL_ALIGN_PREFIX(16)
@@ -3586,12 +3659,12 @@ public:
LLVector4a *mNormal;
LLVector4a *mTangent;
LLDrawable* mHit;
- BOOL mPickTransparent;
- BOOL mPickRigged;
- BOOL mPickUnselectable;
- BOOL mPickReflectionProbe;
+ bool mPickTransparent;
+ bool mPickRigged;
+ bool mPickUnselectable;
+ bool mPickReflectionProbe;
- LLOctreeIntersect(const LLVector4a& start, const LLVector4a& end, BOOL pick_transparent, BOOL pick_rigged, BOOL pick_unselectable, BOOL pick_reflection_probe,
+ LLOctreeIntersect(const LLVector4a& start, const LLVector4a& end, bool pick_transparent, bool pick_rigged, bool pick_unselectable, bool pick_reflection_probe,
S32* face_hit, LLVector4a* intersection, LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent)
: mStart(start),
mEnd(end),
@@ -3712,7 +3785,7 @@ public:
}
if (!skip_check && vobj->lineSegmentIntersect(mStart, mEnd, -1,
- (mPickReflectionProbe && vobj->isReflectionProbe()) ? TRUE : mPickTransparent, // always pick transparent when picking selection probe
+ (mPickReflectionProbe && vobj->isReflectionProbe()) ? true : mPickTransparent, // always pick transparent when picking selection probe
mPickRigged, mPickUnselectable, mFaceHit, &intersection, mTexCoord, mNormal, mTangent))
{
mEnd = intersection; // shorten ray so we only find CLOSER hits
@@ -3731,10 +3804,10 @@ public:
} LL_ALIGN_POSTFIX(16);
LLDrawable* LLSpatialPartition::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
- BOOL pick_transparent,
- BOOL pick_rigged,
- BOOL pick_unselectable,
- BOOL pick_reflection_probe,
+ bool pick_transparent,
+ bool pick_rigged,
+ bool pick_unselectable,
+ bool pick_reflection_probe,
S32* face_hit, // return the face hit
LLVector4a* intersection, // return the intersection point
LLVector2* tex_coord, // return the texture coordinates of the intersection point
@@ -3750,10 +3823,10 @@ LLDrawable* LLSpatialPartition::lineSegmentIntersect(const LLVector4a& start, co
}
LLDrawable* LLSpatialGroup::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
- BOOL pick_transparent,
- BOOL pick_rigged,
- BOOL pick_unselectable,
- BOOL pick_reflection_probe,
+ bool pick_transparent,
+ bool pick_rigged,
+ bool pick_unselectable,
+ bool pick_reflection_probe,
S32* face_hit, // return the face hit
LLVector4a* intersection, // return the intersection point
LLVector2* tex_coord, // return the texture coordinates of the intersection point