summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2013-08-19 16:12:07 -0600
committerXiaohong Bao <bao@lindenlab.com>2013-08-19 16:12:07 -0600
commit1616b73ef30bcb3e99be68fb7ccc05f0be78ddf6 (patch)
treee22c94948ed8d8c7f35422fc064172ea3662b264 /indra/llprimitive
parentea45b8acd25785bd2789c2c1928e223c9a8e2fbd (diff)
parentd8c02bf06250015b8cb0bcc9c0d8445cfb6acf1c (diff)
Automated merge with http://bitbucket.org/lindenlab/viewer-interesting
Diffstat (limited to 'indra/llprimitive')
-rwxr-xr-xindra/llprimitive/llmodel.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index e48613b8ca..3526b22532 100755
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -628,25 +628,41 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac
if (v)
{
U32 v_idx = idx[j*stride+v_offset]*3;
+ v_idx = llclamp(v_idx, (U32) 0, (U32) v->getCount());
vert.getPosition().set(v->get(v_idx),
v->get(v_idx+1),
v->get(v_idx+2));
}
- if (n)
+ //bounds check n and t lookups because some FBX to DAE converters
+ //use negative indices and empty arrays to indicate data does not exist
+ //for a particular channel
+ if (n && n->getCount() > 0)
{
U32 n_idx = idx[j*stride+n_offset]*3;
+ n_idx = llclamp(n_idx, (U32) 0, (U32) n->getCount());
vert.getNormal().set(n->get(n_idx),
n->get(n_idx+1),
n->get(n_idx+2));
}
+ else
+ {
+ vert.getNormal().clear();
+ }
+
- if (t)
+ if (t && t->getCount() > 0)
{
U32 t_idx = idx[j*stride+t_offset]*2;
+ t_idx = llclamp(t_idx, (U32) 0, (U32) t->getCount());
vert.mTexCoord.setVec(t->get(t_idx),
t->get(t_idx+1));
}
+ else
+ {
+ vert.mTexCoord.clear();
+ }
+
verts.push_back(vert);
}