Skip to content

Commit

Permalink
Intermediary commit #2.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shyotl committed Mar 17, 2019
1 parent 2d8fbb8 commit 3a78568
Show file tree
Hide file tree
Showing 30 changed files with 765 additions and 170 deletions.
1 change: 1 addition & 0 deletions indra/llrender/llgltexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class LLGLTexture : public LLTexture
enum EBoostLevel
{
BOOST_NONE = 0,
BOOST_ALM , //acts like NONE when ALM is on, max discard when ALM is off
BOOST_AVATAR_BAKED ,
BOOST_AVATAR ,
BOOST_CLOUDS ,
Expand Down
2 changes: 2 additions & 0 deletions indra/newview/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ set(viewer_SOURCE_FILES
llsavedsettingsglue.cpp
llscrollingpanelparam.cpp
llscrollingpanelparambase.cpp
llsculptidsize.cpp
llselectmgr.cpp
llshareavatarhandler.cpp
llskinningutil.cpp
Expand Down Expand Up @@ -976,6 +977,7 @@ set(viewer_HEADER_FILES
llsavedsettingsglue.h
llscrollingpanelparam.h
llscrollingpanelparambase.h
llsculptidsize.h
llselectmgr.h
llsimplestat.h
llskinningutil.h
Expand Down
10 changes: 10 additions & 0 deletions indra/newview/llagent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,16 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
{
gSky.mVOGroundp->setRegion(regionp);
}

if (regionp->capabilitiesReceived())
{
regionp->requestSimulatorFeatures();
}
else
{
regionp->setCapabilitiesReceivedCallback(boost::bind(&LLViewerRegion::requestSimulatorFeatures, regionp));
}

}
else
{
Expand Down
24 changes: 24 additions & 0 deletions indra/newview/lldrawable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "material_codes.h"

// viewer includes
#include "llagent.h"
#include "llcriticaldamp.h"
#include "llface.h"
#include "lllightconstants.h"
Expand All @@ -49,6 +50,7 @@
#include "llspatialpartition.h"
#include "llviewerobjectlist.h"
#include "llviewerwindow.h"
#include "lldrawpoolavatar.h"

const F32 MIN_INTERPOLATE_DISTANCE_SQUARED = 0.001f * 0.001f;
const F32 MAX_INTERPOLATE_DISTANCE_SQUARED = 10.f * 10.f;
Expand Down Expand Up @@ -113,6 +115,28 @@ void LLDrawable::init()
initVisible(sCurVisible - 2);//invisible for the current frame and the last frame.
}

void LLDrawable::unload()
{
LLVOVolume *pVVol = getVOVolume();
pVVol->setNoLOD();

for (S32 i = 0; i < getNumFaces(); i++)
{
LLFace* facep = getFace(i);
if (facep->isState(LLFace::RIGGED))
{
LLDrawPoolAvatar* pool = (LLDrawPoolAvatar*)facep->getPool();
if (pool) {
pool->removeRiggedFace(facep);
}
facep->setVertexBuffer(NULL);
}
facep->clearState(LLFace::RIGGED);
}

pVVol->markForUpdate(TRUE);
}

// static
void LLDrawable::initClass()
{
Expand Down
4 changes: 3 additions & 1 deletion indra/newview/lldrawable.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class LLDrawable
void markDead(); // Mark this drawable as dead
BOOL isDead() const { return isState(DEAD); }
BOOL isNew() const { return !isState(BUILT); }

BOOL isUnload() const { return isState(FOR_UNLOAD); }
BOOL isLight() const;

virtual void setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* results = NULL, BOOL for_select = FALSE);
Expand Down Expand Up @@ -155,6 +155,7 @@ class LLDrawable
void mergeFaces(LLDrawable* src);

void init();
void unload();
void destroy();

void update();
Expand Down Expand Up @@ -296,6 +297,7 @@ class LLDrawable
PARTITION_MOVE = 0x10000000,
ANIMATED_CHILD = 0x20000000,
ACTIVE_CHILD = 0x40000000,
FOR_UNLOAD = 0x80000000, //should be unload from memory
} EDrawableFlags;

public:
Expand Down
2 changes: 1 addition & 1 deletion indra/newview/lldrawpoolavatar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ void LLDrawPoolAvatar::renderShadow(S32 pass)
}
LLVOAvatar *avatarp = (LLVOAvatar *)facep->getDrawable()->getVObj().get();

if (avatarp->isDead() || avatarp->mIsDummy || avatarp->mDrawable.isNull())
if (avatarp->isDead() || avatarp->isUIAvatar() || avatarp->mDrawable.isNull())
{
return;
}
Expand Down
89 changes: 31 additions & 58 deletions indra/newview/llface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include "llviewershadermgr.h"
#include "llviewertexture.h"
#include "llvoavatar.h"
#include "llsculptidsize.h"

#define LL_MAX_INDICES_COUNT 1000000

Expand Down Expand Up @@ -851,90 +852,49 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f,
//get bounding box
if (mDrawablep->isState(LLDrawable::REBUILD_VOLUME | LLDrawable::REBUILD_POSITION | LLDrawable::REBUILD_RIGGED))
{
//VECTORIZE THIS
const LLMatrix4a& mat_vert = mat_vert_in;
//mat_vert.loadu(mat_vert_in);

LLVector4a min,max;

if (f >= volume.getNumVolumeFaces())
{
LL_WARNS() << "Generating bounding box for invalid face index!" << LL_ENDL;
f = 0;
}

const LLVolumeFace &face = volume.getVolumeFace(f);
min = face.mExtents[0];
max = face.mExtents[1];

llassert(less_than_max_mag(min));
llassert(less_than_max_mag(max));

//min, max are in volume space, convert to drawable render space

//get 8 corners of bounding box
LLVector4Logical mask[6];

for (U32 i = 0; i < 6; ++i)
// MAINT-8264 - stray vertices, especially in low LODs, cause bounding box errors.
if (face.mNumVertices < 3)
{
mask[i].clear();
LL_DEBUGS("RiggedBox") << "skipping face " << f << ", bad num vertices "
<< face.mNumVertices << " " << face.mNumIndices << " " << face.mWeights << LL_ENDL;
return FALSE;
}

mask[0].setElement<2>(); //001
mask[1].setElement<1>(); //010
mask[2].setElement<1>(); //011
mask[2].setElement<2>();
mask[3].setElement<0>(); //100
mask[4].setElement<0>(); //101
mask[4].setElement<2>();
mask[5].setElement<0>(); //110
mask[5].setElement<1>();

LLVector4a v[8];

v[6] = min;
v[7] = max;

for (U32 i = 0; i < 6; ++i)
{
v[i].setSelectWithMask(mask[i], min, max);
}

LLVector4a tv[8];

//transform bounding box into drawable space
for (U32 i = 0; i < 8; ++i)
{
mat_vert.affineTransform(v[i], tv[i]);
}

//find bounding box
LLVector4a& newMin = mExtents[0];
LLVector4a& newMax = mExtents[1];
//VECTORIZE THIS
LLMatrix4a mat_vert = mat_vert_in;
LLVector4a new_extents[2];

newMin = newMax = tv[0];
llassert(less_than_max_mag(face.mExtents[0]));
llassert(less_than_max_mag(face.mExtents[1]));

for (U32 i = 1; i < 8; ++i)
{
newMin.setMin(newMin, tv[i]);
newMax.setMax(newMax, tv[i]);
}
matMulBoundBox(mat_vert, face.mExtents, mExtents);

if (!mDrawablep->isActive())
{ // Shift position for region
LLVector4a offset;
offset.load3(mDrawablep->getRegion()->getOriginAgent().mV);
newMin.add(offset);
newMax.add(offset);
mExtents[0].add(offset);
mExtents[1].add(offset);
LL_DEBUGS("RiggedBox") << "updating extents for face " << f
<< " not active, added offset " << offset << LL_ENDL;
}

LLVector4a t;
t.setAdd(newMin,newMax);
t.setAdd(mExtents[0],mExtents[1]);
t.mul(0.5f);

mCenterLocal.set(t.getF32ptr());

t.setSub(newMax,newMin);
t.setSub(mExtents[1],mExtents[0]);
mBoundingSphereRadius = t.getLength3().getF32()*0.5f;

updateCenterAgent();
Expand Down Expand Up @@ -2521,12 +2481,25 @@ LLViewerTexture* LLFace::getTexture(U32 ch) const

void LLFace::setVertexBuffer(LLVertexBuffer* buffer)
{
if (buffer)
{
LLSculptIDSize::instance().inc(mDrawablep, buffer->getSize() + buffer->getIndicesSize());
}

if (mVertexBuffer)
{
LLSculptIDSize::instance().dec(mDrawablep);
}
mVertexBuffer = buffer;
llassert(verify());
}

void LLFace::clearVertexBuffer()
{
if (mVertexBuffer)
{
LLSculptIDSize::instance().dec(mDrawablep);
}
mVertexBuffer = NULL;
}

Expand Down
9 changes: 1 addition & 8 deletions indra/newview/llfloaterbvhpreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1308,17 +1308,10 @@ LLPreviewAnimation::LLPreviewAnimation(S32 width, S32 height) : LLViewerDynamicT
mCameraPitch = 0.f;
mCameraZoom = 1.f;

mDummyAvatar = (LLVOAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion());
mDummyAvatar->createDrawable(&gPipeline);
mDummyAvatar->mIsDummy = TRUE;
mDummyAvatar = (LLVOAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), LLViewerObject::CO_FLAG_UI_AVATAR);
mDummyAvatar->mSpecialRenderMode = 1;
mDummyAvatar->setPositionAgent(LLVector3::zero);
mDummyAvatar->slamPosition();
mDummyAvatar->updateJointLODs();
mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable);
mDummyAvatar->startMotion(ANIM_AGENT_STAND, BASE_ANIM_TIME_OFFSET);
mDummyAvatar->hideSkirt();
//gPipeline.markVisible(mDummyAvatar->mDrawable, *LLViewerCamera::getInstance());

// stop extraneous animations
mDummyAvatar->stopMotion( ANIM_AGENT_HEAD_ROT, TRUE );
Expand Down
9 changes: 1 addition & 8 deletions indra/newview/llfloaterimagepreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,15 +621,8 @@ LLImagePreviewAvatar::LLImagePreviewAvatar(S32 width, S32 height) : LLViewerDyna
mCameraPitch = 0.f;
mCameraZoom = 1.f;

mDummyAvatar = (LLVOAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion());
mDummyAvatar->createDrawable(&gPipeline);
mDummyAvatar->mIsDummy = TRUE;
mDummyAvatar = (LLVOAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), LLViewerObject::CO_FLAG_UI_AVATAR);
mDummyAvatar->mSpecialRenderMode = 2;
mDummyAvatar->setPositionAgent(LLVector3::zero);
mDummyAvatar->slamPosition();
mDummyAvatar->updateJointLODs();
mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable);
// gPipeline.markVisible(mDummyAvatar->mDrawable, *LLViewerCamera::getInstance());

mTextureName = 0;
}
Expand Down
9 changes: 5 additions & 4 deletions indra/newview/llmeshrepository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2918,7 +2918,7 @@ LLSD& LLMeshRepoThread::getMeshHeader(const LLUUID& mesh_id)
{
LLMutexLock lock(mHeaderMutex);
mesh_header_map::iterator iter = mMeshHeader.find(mesh_id);
if (iter != mMeshHeader.end())
if (iter != mMeshHeader.end() && mMeshHeaderSize[mesh_id] > 0)
{
return iter->second;
}
Expand All @@ -2944,10 +2944,11 @@ void LLMeshRepository::uploadModel(std::vector<LLModelInstance>& data, LLVector3

S32 LLMeshRepository::getMeshSize(const LLUUID& mesh_id, S32 lod)
{
if (mThread)
if (mThread && mesh_id.notNull() && LLPrimitive::NO_LOD != lod)
{
LLMutexLock lock(mThread->mHeaderMutex);
LLMeshRepoThread::mesh_header_map::iterator iter = mThread->mMeshHeader.find(mesh_id);
if (iter != mThread->mMeshHeader.end())
if (iter != mThread->mMeshHeader.end() && mThread->mMeshHeaderSize[mesh_id] > 0)
{
LLSD& header = iter->second;

Expand Down Expand Up @@ -3087,7 +3088,7 @@ F32 LLMeshRepository::getStreamingCost(LLSD& header, F32 radius, S32* bytes, S32
}
}

F32 max_area = 102932.f; //area of circle that encompasses region
F32 max_area = 102944.f; //area of circle that encompasses region (see MAINT-6559)
F32 min_area = 1.f;

F32 high_area = llmin(F_PI*dmid*dmid, max_area);
Expand Down
Loading

0 comments on commit 3a78568

Please sign in to comment.