summaryrefslogtreecommitdiff
path: root/indra/newview/llvovolume.cpp
diff options
context:
space:
mode:
authorDmitry Zaporozhan <dzaporozhan@productengine.com>2009-11-10 17:03:48 +0200
committerDmitry Zaporozhan <dzaporozhan@productengine.com>2009-11-10 17:03:48 +0200
commitebfb32f35bfeb796b4971f66bd1a9ebdf88be854 (patch)
tree12a2fd956a69147758226f49a437a137f065410f /indra/newview/llvovolume.cpp
parent15372bbc342a7b4c7a8d9b2e1bedd52655232ba7 (diff)
parent5377f8628e7f3eda9f497db1c367099ca04726d0 (diff)
Merge
--HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rw-r--r--indra/newview/llvovolume.cpp43
1 files changed, 14 insertions, 29 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 021fc74648..c987dd1764 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -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)
- {
- 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))
+ LLVolume* volume = getVolume();
+ LLVector3 result;
+
+ if (volume && face_id < volume->getNumVolumeFaces())
+ {
+ const LLVolumeFace& face = volume->getVolumeFace(face_id);
+ for (S32 i = 0; i < (S32)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;
@@ -1752,6 +1733,10 @@ void LLVOVolume::syncMediaData(S32 texture_index, const LLSD &media_data, bool m
addMediaImpl(media_impl, texture_index) ;
}
+ else
+ {
+ removeMediaImpl(texture_index);
+ }
//llinfos << "AFTER: texture_index = " << texture_index
// << " hasMedia = " << te->hasMedia() << " : "