Better fix for DEV-42153.
parent
3b98043d22
commit
e477a74feb
|
|
@ -1640,38 +1640,19 @@ bool LLVOVolume::hasMedia() const
|
|||
|
||||
LLVector3 LLVOVolume::getApproximateFaceNormal(U8 face_id)
|
||||
{
|
||||
LLVector3 result = LLVector3::zero;
|
||||
|
||||
LLFace* facep = mDrawable->getFace(face_id);
|
||||
if(facep)
|
||||
LLVolume* volume = getVolume();
|
||||
LLVector3 result;
|
||||
|
||||
if (volume && face_id < volume->getNumVolumeFaces())
|
||||
{
|
||||
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))
|
||||
const LLVolumeFace& face = volume->getVolumeFace(face_id);
|
||||
for (S32 i = 0; i < face.mVertices.size(); ++i)
|
||||
{
|
||||
U16 count = facep->getGeomCount();
|
||||
U16 i;
|
||||
|
||||
for(i=0; i < count; i++)
|
||||
{
|
||||
LLVector3 normal = *normalsp++;
|
||||
// llinfos << "adding " << normal << llendl;
|
||||
result += normal;
|
||||
}
|
||||
result += face.mVertices[i].mNormal;
|
||||
}
|
||||
}
|
||||
|
||||
if(!result.isNull())
|
||||
{
|
||||
// llinfos << "before conversion: " << result << llendl;
|
||||
|
||||
result = volumeDirectionToAgent(result);
|
||||
result.normalize();
|
||||
// llinfos << "after conversion: " << result << llendl;
|
||||
result.normVec();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Reference in New Issue