A few more rigging related things added in. Also fixed vertex weights

This commit is contained in:
Shyotl
2011-08-01 03:53:25 -05:00
parent 2aa4aa78e2
commit 0bd444de5f
7 changed files with 172 additions and 42 deletions

View File

@@ -1753,6 +1753,33 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector3& start, const LLVector3& e
return TRUE;
}
}
#if MESH_ENABLED
if (isSelf())
{
for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
iter != mAttachmentPoints.end();
++iter)
{
LLViewerJointAttachment* attachment = iter->second;
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
LLViewerObject* attached_object = (*attachment_iter);
if (attached_object && !attached_object->isDead() && attachment->getValid())
{
LLDrawable* drawable = attached_object->mDrawable;
if (drawable->isState(LLDrawable::RIGGED))
{ //regenerate octree for rigged attachment
gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_RIGGED, TRUE);
}
}
}
}
}
#endif //MESH_ENABLED
}
LLVector3 position;
@@ -1769,6 +1796,58 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector3& start, const LLVector3& e
return FALSE;
}
#if MESH_ENABLED
LLViewerObject* LLVOAvatar::lineSegmentIntersectRiggedAttachments(const LLVector3& start, const LLVector3& end,
S32 face,
BOOL pick_transparent,
S32* face_hit,
LLVector3* intersection,
LLVector2* tex_coord,
LLVector3* normal,
LLVector3* bi_normal)
{
if (isSelf() && !gAgent.needsRenderAvatar())
{
return NULL;
}
LLViewerObject* hit = NULL;
if (lineSegmentBoundingBox(start, end))
{
LLVector3 local_end = end;
LLVector3 local_intersection;
for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
iter != mAttachmentPoints.end();
++iter)
{
LLViewerJointAttachment* attachment = iter->second;
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
LLViewerObject* attached_object = (*attachment_iter);
if (attached_object->lineSegmentIntersect(start, local_end, face, pick_transparent, face_hit, &local_intersection, tex_coord, normal, bi_normal))
{
local_end = local_intersection;
if (intersection)
{
*intersection = local_intersection;
}
hit = attached_object;
}
}
}
}
return hit;
}
#endif //MESH_ENABLED
//-----------------------------------------------------------------------------
// parseSkeletonFile()
//-----------------------------------------------------------------------------
@@ -7247,6 +7326,7 @@ BOOL LLVOAvatar::attachObject(LLViewerObject *viewer_object)
if (attachment->isObjectAttached(viewer_object))
{
LLCOFMgr::instance().addAttachment(viewer_object->getAttachmentItemID());
updateLODRiggedAttachments();
}
}
@@ -10731,16 +10811,19 @@ U32 LLVOAvatar::getPartitionType() const
//static
void LLVOAvatar::updateImpostors()
{
LLCharacter::sAllowInstancesChange = FALSE ;
for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
iter != LLCharacter::sInstances.end(); ++iter)
iter != LLCharacter::sInstances.end(); ++iter)
{
LLVOAvatar* avatar = (LLVOAvatar*) *iter;
if (!avatar->isDead() && avatar->needsImpostorUpdate() && avatar->isVisible() && avatar->isImpostor())
{
gPipeline.generateImpostor(avatar);
}
}
LLCharacter::sAllowInstancesChange = TRUE ;
}
BOOL LLVOAvatar::isImpostor() const