Skip to content
Snippets Groups Projects
Commit 5fba55f5 authored by Monroe Linden's avatar Monroe Linden
Browse files

Partial fix for DEV-42153.

This code seems to work on some objects and not on others.  I suspect I'm not doing something quite right in LLVOVolume::getApproximateFaceNormal().
parent fcbad172
No related branches found
No related tags found
No related merge requests found
...@@ -499,8 +499,14 @@ void LLViewerMediaFocus::focusZoomOnMedia(LLUUID media_id) ...@@ -499,8 +499,14 @@ void LLViewerMediaFocus::focusZoomOnMedia(LLUUID media_id)
S32 face = obj->getFaceIndexWithMediaImpl(impl, -1); S32 face = obj->getFaceIndexWithMediaImpl(impl, -1);
// We don't have a proper pick normal here, and finding a face's real normal is... complicated. // We don't have a proper pick normal here, and finding a face's real normal is... complicated.
// For now, use +z to look at the top of the object. LLVector3 normal = obj->getApproximateFaceNormal(face);
LLVector3 normal(0.0f, 0.0f, 1.0f); if(normal.isNull())
{
// If that didn't work, use the inverse of the camera "look at" axis, which should keep the camera pointed in the same direction.
// llinfos << "approximate face normal invalid, using camera direction." << llendl;
normal = LLViewerCamera::getInstance()->getAtAxis();
normal *= (F32)-1.0f;
}
// Attempt to focus/zoom on that face. // Attempt to focus/zoom on that face.
setFocusFace(obj, face, impl, normal); setFocusFace(obj, face, impl, normal);
......
...@@ -1638,6 +1638,45 @@ bool LLVOVolume::hasMedia() const ...@@ -1638,6 +1638,45 @@ bool LLVOVolume::hasMedia() const
return result; return result;
} }
LLVector3 LLVOVolume::getApproximateFaceNormal(U8 face_id)
{
LLVector3 result = LLVector3::zero;
LLFace* facep = mDrawable->getFace(face_id);
if(facep)
{
LLStrider<LLVector3> verticesp;
LLStrider<LLVector3> normalsp;
LLStrider<LLVector2> texCoordsp;
LLStrider<U16> indicesp;
S32 index_offset;
index_offset = facep->getGeometry(verticesp,normalsp,texCoordsp, indicesp);
if(index_offset != -1 && (normalsp.get() != NULL))
{
U16 count = facep->getGeomCount();
U16 i;
for(i=0; i < count; i++)
{
LLVector3 normal = *normalsp++;
// llinfos << "adding " << normal << llendl;
result += normal;
}
}
}
if(!result.isNull())
{
// llinfos << "before conversion: " << result << llendl;
result = volumeDirectionToAgent(result);
result.normalize();
// llinfos << "after conversion: " << result << llendl;
}
return result;
}
void LLVOVolume::requestMediaDataUpdate() void LLVOVolume::requestMediaDataUpdate()
{ {
sObjectMediaClient->fetchMedia(new LLMediaDataClientObjectImpl(this)); sObjectMediaClient->fetchMedia(new LLMediaDataClientObjectImpl(this));
......
...@@ -263,6 +263,8 @@ class LLVOVolume : public LLViewerObject ...@@ -263,6 +263,8 @@ class LLVOVolume : public LLViewerObject
F64 getTotalMediaInterest() const; F64 getTotalMediaInterest() const;
bool hasMedia() const; bool hasMedia() const;
LLVector3 getApproximateFaceNormal(U8 face_id);
protected: protected:
S32 computeLODDetail(F32 distance, F32 radius); S32 computeLODDetail(F32 distance, F32 radius);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment