summaryrefslogtreecommitdiffstats
path: root/tools/gfx/model.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2018-09-17 09:18:57 -0400
committerGitHub <noreply@github.com>2018-09-17 09:18:57 -0400
commit24ad492a98dc99abfbf7523b50bbdb13274c097e (patch)
treea84e609f8bf2e5add2b5e009b42fa564149cefdd /tools/gfx/model.cpp
parent3c505c22673701339d35eb2151f01c16eb3c78c3 (diff)
Hotfix/fixing warnings (#636)
* * Remove dispose from IRInst * Use MemoryArena instead of MemoryPool * Make all IRInst not require Dtor - by having ref counted array store ptrs that need freeing * Increase block size - typically compilation is 2Mb of IR space(!) * Fix issues around StringRepresentation::equal because null has special meaning. * Don't bother to construct as String to compare StringRepresentation, just used UnownedStringSlice. * Added fromLiteral support to UnownedStringSlice and use instead of strlen version. * Use more conventional way to test StringRepresentation against a String. * Fix gcc/clang template problem with cast. * Fix warnings.
Diffstat (limited to 'tools/gfx/model.cpp')
-rw-r--r--tools/gfx/model.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/tools/gfx/model.cpp b/tools/gfx/model.cpp
index 0173ce950..62e6ec1fd 100644
--- a/tools/gfx/model.cpp
+++ b/tools/gfx/model.cpp
@@ -141,7 +141,7 @@ RefPtr<TextureResource> loadTextureImage(
int prevExtentX = extentX;
int prevExtentY = extentY;
stbi_uc* prevData = data;
- ptrdiff_t prevStride = stride;
+ int prevStride = int(stride);
for(;;)
{
@@ -155,7 +155,7 @@ RefPtr<TextureResource> loadTextureImage(
if(!newExtentY) newExtentY = 1;
stbi_uc* newData = (stbi_uc*) malloc(newExtentX * newExtentY * channelCount * sizeof(stbi_uc));
- ptrdiff_t newStride = newExtentX * channelCount * sizeof(stbi_uc);
+ int newStride = int(newExtentX * channelCount * sizeof(stbi_uc));
stbir_resize_uint8_srgb(
prevData, prevExtentX, prevExtentY, prevStride,
@@ -303,8 +303,8 @@ Result ModelLoader::load(
size_t objFaceCounter = 0;
for(auto objFaceVertexCount : objShape.mesh.num_face_vertices)
{
- size_t flatFaceIndex = flatFaceCounter++;
- size_t objFaceIndex = objFaceCounter++;
+ const size_t flatFaceIndex = flatFaceCounter++;
+ const size_t objFaceIndex = objFaceCounter++;
size_t smoothingGroup = objShape.mesh.smoothing_group_ids[objFaceIndex];
if(!smoothingGroup)
{
@@ -330,7 +330,7 @@ Result ModelLoader::load(
smoothedVertexNormals.insert(std::make_pair(smoothVertexID, normalID));
- objIndex.normal_index = normalID;
+ objIndex.normal_index = int(normalID);
}
}
}
@@ -348,9 +348,9 @@ Result ModelLoader::load(
size_t objFaceCounter = 0;
for(auto objFaceVertexCount : objShape.mesh.num_face_vertices)
{
- size_t flatFaceIndex = flatFaceCounter++;
- size_t objFaceIndex = objFaceCounter++;
- unsigned int smoothingGroup = objShape.mesh.smoothing_group_ids[objFaceIndex];
+ const size_t flatFaceIndex = flatFaceCounter++;
+ const size_t objFaceIndex = objFaceCounter++;
+ size_t smoothingGroup = objShape.mesh.smoothing_group_ids[objFaceIndex];
if(!smoothingGroup)
{
smoothingGroup = ~flatFaceIndex;
@@ -506,7 +506,7 @@ Result ModelLoader::load(
objVertexAttributes.texcoords[2 * objIndex.texcoord_index + 1]);
}
- flatIndex = flatVertices.size();
+ flatIndex = uint32_t(flatVertices.size());
mapObjIndexToFlatIndex.insert(std::make_pair(objIndexKey, flatIndex));
flatVertices.push_back(flatVertex);
}
@@ -528,7 +528,7 @@ Result ModelLoader::load(
modelData.vertexCount = (int)flatVertices.size();
modelData.indexCount = (int)flatIndices.size();
- modelData.meshCount = meshes.size();
+ modelData.meshCount = int(meshes.size());
modelData.meshes = meshes.data();
BufferResource::Desc vertexBufferDesc;