aboutsummaryrefslogtreecommitdiffstats
path: root/Samples/CommonSrc/Render/Render_XmlSceneLoader.cpp
diff options
context:
space:
mode:
authorBrad Davis <[email protected]>2013-10-10 23:37:45 -0700
committerBrad Davis <[email protected]>2013-10-10 23:37:45 -0700
commit881daef0cb99477da21235c8d0924de15990441b (patch)
tree26b3393d138711244b3b9ea7ae95980c76ce1d9f /Samples/CommonSrc/Render/Render_XmlSceneLoader.cpp
parente88dfc0fb802102d27d372457299761b39f05fb9 (diff)
parent5eb50183c96f699557f071878efb6e18df24727d (diff)
Merging in official SDK 0.2.5 changes
Diffstat (limited to 'Samples/CommonSrc/Render/Render_XmlSceneLoader.cpp')
-rw-r--r--Samples/CommonSrc/Render/Render_XmlSceneLoader.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/Samples/CommonSrc/Render/Render_XmlSceneLoader.cpp b/Samples/CommonSrc/Render/Render_XmlSceneLoader.cpp
index a871f35..b2b1ac1 100644
--- a/Samples/CommonSrc/Render/Render_XmlSceneLoader.cpp
+++ b/Samples/CommonSrc/Render/Render_XmlSceneLoader.cpp
@@ -239,15 +239,13 @@ bool XmlHandler::ReadFile(const char* fileName, OVR::Render::RenderDevice* pRend
FirstChild()->ToText()->Value();
UPInt stringLength = strlen(indexStr);
- for(UPInt j = 0; j < stringLength;)
+ for(UPInt j = 0; j < stringLength; )
{
UPInt k = j + 1;
for(; k < stringLength; ++k)
{
- if(indexStr[k] == ' ')
- {
- break;
- }
+ if (indexStr[k] == ' ')
+ break;
}
char text[20];
for(UPInt l = 0; l < k - j; ++l)
@@ -255,10 +253,22 @@ bool XmlHandler::ReadFile(const char* fileName, OVR::Render::RenderDevice* pRend
text[l] = indexStr[j + l];
}
text[k - j] = '\0';
- Models[i]->Indices.InsertAt(0, (unsigned short)atoi(text));
+
+ Models[i]->Indices.PushBack((unsigned short)atoi(text));
j = k + 1;
}
+ // Reverse index order to match original expected orientation
+ Array<UInt16>& indices = Models[i]->Indices;
+ UPInt indexCount = indices.GetSize();
+
+ for (UPInt revIndex = 0; revIndex < indexCount/2; revIndex++)
+ {
+ unsigned short itemp = indices[revIndex];
+ indices[revIndex] = indices[indexCount - revIndex - 1];
+ indices[indexCount - revIndex - 1] = itemp;
+ }
+
delete vertices;
delete normals;
delete diffuseUVs;