summaryrefslogtreecommitdiff
path: root/indra/llprimitive/llmodel.cpp
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2013-08-20 10:37:10 -0400
committerOz Linden <oz@lindenlab.com>2013-08-20 10:37:10 -0400
commitc42a91421ff4691e6d2efa5744fe3f246510649c (patch)
tree0ce60a84e78b802c7f936e3b4cb1503edb2fa945 /indra/llprimitive/llmodel.cpp
parentd2b947c1fa0757e94eb74429a339a8198531dd93 (diff)
parent171089207b528ab80a954292c127ba77254ee927 (diff)
merge changes for 3.6.3-release
Diffstat (limited to 'indra/llprimitive/llmodel.cpp')
-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 28ed051c55..5ed05e2201 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);
}