fixing MSVC 2013 warning C4244: & C4305

conversion from 'const float' to 'int', possible loss of data
conversion from 'double' to 'int', possible loss of data
conversion from 'float' to 'int', possible loss of data
This commit is contained in:
dteviot 2015-03-08 13:07:29 +13:00
parent f2ac939e61
commit e197f5318b
100 changed files with 457 additions and 474 deletions

View file

@ -108,8 +108,8 @@ namespace Terrain
storage->getBounds(mMinX, mMaxX, mMinY, mMaxY);
int origSizeX = mMaxX-mMinX;
int origSizeY = mMaxY-mMinY;
int origSizeX = static_cast<int>(mMaxX - mMinX);
int origSizeY = static_cast<int>(mMaxY - mMinY);
// Dividing a quad tree only works well for powers of two, so round up to the nearest one
int size = nextPowerOfTwo(std::max(origSizeX, origSizeY));
@ -124,7 +124,7 @@ namespace Terrain
LayersRequestData data;
data.mPack = getShadersEnabled();
mRootNode = new QuadTreeNode(this, Root, size, Ogre::Vector2(centerX, centerY), NULL);
mRootNode = new QuadTreeNode(this, Root, static_cast<float>(size), Ogre::Vector2(centerX, centerY), NULL);
buildQuadTree(mRootNode, data.mNodes);
//loadingListener->indicateProgress();
mRootNode->initAabb();
@ -160,7 +160,7 @@ namespace Terrain
float minZ,maxZ;
Ogre::Vector2 center = node->getCenter();
float cellWorldSize = getStorage()->getCellWorldSize();
if (mStorage->getMinMaxHeights(node->getSize(), center, minZ, maxZ))
if (mStorage->getMinMaxHeights(static_cast<float>(node->getSize()), center, minZ, maxZ))
{
Ogre::AxisAlignedBox bounds(Ogre::Vector3(-halfSize*cellWorldSize, -halfSize*cellWorldSize, minZ),
Ogre::Vector3(halfSize*cellWorldSize, halfSize*cellWorldSize, maxZ));
@ -275,7 +275,7 @@ namespace Terrain
LoadResponseData* responseData = new LoadResponseData();
getStorage()->fillVertexBuffers(node->getNativeLodLevel(), node->getSize(), node->getCenter(), getAlign(),
getStorage()->fillVertexBuffers(node->getNativeLodLevel(), static_cast<float>(node->getSize()), node->getCenter(), getAlign(),
responseData->mPositions, responseData->mNormals, responseData->mColours);
return OGRE_NEW Ogre::WorkQueue::Response(req, true, Ogre::Any(responseData));