[SOLVED] Uint double reference under linux

Nodrev

06-04-2008 18:49:20

Hello, i encounter some problems to compiling Paged Geometry on linux:jeff@pcJeffLinux:~/programmation/linux/librairies/eihort/PagedGeometry$ make
Scanning dependencies of target PagedGeometry
[ 6%] Building CXX object source/CMakeFiles/PagedGeometry.dir/BatchedGeometry.o
Dans le fichier inclus à partir de /home/jeff/programmation/linux/librairies/eihort/PagedGeometry/source/BatchedGeometry.cpp:16:
/home/jeff/programmation/linux/librairies/eihort/PagedGeometry/source/../include/BatchedGeometry.h:134:7: attention : pas de retour chariot à la fin du fichier
/home/jeff/programmation/linux/librairies/eihort/PagedGeometry/source/BatchedGeometry.cpp: In member function «void BatchedGeometry::addEntity(Ogre::Entity*, const Ogre::Vector3&, const Ogre::Quaternion&, const Ogre::Vector3&, const Ogre::ColourValue&)":
/home/jeff/programmation/linux/librairies/eihort/PagedGeometry/source/BatchedGeometry.cpp:60: erreur: reference to «uint" is ambiguous
/usr/include/sys/types.h:153: erreur: candidates are: typedef unsigned int uint
/usr/local/include/OGRE/OgrePrerequisites.h:131: erreur: typedef unsigned int Ogre::uint
/home/jeff/programmation/linux/librairies/eihort/PagedGeometry/source/BatchedGeometry.cpp:60: erreur: reference to «uint" is ambiguous
/usr/include/sys/types.h:153: erreur: candidates are: typedef unsigned int uint
/usr/local/include/OGRE/OgrePrerequisites.h:131: erreur: typedef unsigned int Ogre::uint
/home/jeff/programmation/linux/librairies/eihort/PagedGeometry/source/BatchedGeometry.cpp:60: erreur: expected `;' before «i"
/home/jeff/programmation/linux/librairies/eihort/PagedGeometry/source/BatchedGeometry.cpp:60: erreur: «i" was not declared in this scope
/home/jeff/programmation/linux/librairies/eihort/PagedGeometry/source/BatchedGeometry.cpp: In member function «void BatchedGeometry::SubBatch::build()":
/home/jeff/programmation/linux/librairies/eihort/PagedGeometry/source/BatchedGeometry.cpp:464: attention : converting to «Ogre::uint8" from «float"
/home/jeff/programmation/linux/librairies/eihort/PagedGeometry/source/BatchedGeometry.cpp:465: attention : converting to «Ogre::uint8" from «float"
/home/jeff/programmation/linux/librairies/eihort/PagedGeometry/source/BatchedGeometry.cpp:466: attention : converting to «Ogre::uint8" from «float"
/home/jeff/programmation/linux/librairies/eihort/PagedGeometry/source/BatchedGeometry.cpp:508: attention : converting to «Ogre::uint8" from «float"
/home/jeff/programmation/linux/librairies/eihort/PagedGeometry/source/BatchedGeometry.cpp:509: attention : converting to «Ogre::uint8" from «float"
/home/jeff/programmation/linux/librairies/eihort/PagedGeometry/source/BatchedGeometry.cpp:510: attention : converting to «Ogre::uint8" from «float"
make[2]: *** [source/CMakeFiles/PagedGeometry.dir/BatchedGeometry.o] Erreur 1
make[1]: *** [source/CMakeFiles/PagedGeometry.dir/all] Erreur 2
make: *** [all] Erreur 2

But, i don't see any variable typed as uint in those files... neither in OgreMesh or OgreSubMesh...

Any Ideas ?

Nodrev

06-04-2008 21:57:40

:shock: my bad....
I was viewing an hold source file that i was keeping in reference...
anyway, here comes the diff result
diff -aur PagedGeometry/examples/source/HeightFunction.h _PagedGeometry/examples/source/HeightFunction.h
--- PagedGeometry/examples/source/HeightFunction.h 2008-01-14 10:43:30.000000000 +0100
+++ _PagedGeometry/examples/source/HeightFunction.h 2008-04-06 22:13:35.000000000 +0200
@@ -54,4 +54,5 @@

return raySceneQueryListener->resultDistance;
}
-}
+}
+
diff -aur PagedGeometry/include/BatchedGeometry.h _PagedGeometry/include/BatchedGeometry.h
--- PagedGeometry/include/BatchedGeometry.h 2008-01-16 18:23:38.000000000 +0100
+++ _PagedGeometry/include/BatchedGeometry.h 2008-04-06 21:07:16.000000000 +0200
@@ -131,4 +131,5 @@



-#endif
+#endif
+
diff -aur PagedGeometry/include/GrassLoader.h _PagedGeometry/include/GrassLoader.h
--- PagedGeometry/include/GrassLoader.h 2008-01-14 10:59:14.000000000 +0100
+++ _PagedGeometry/include/GrassLoader.h 2008-04-06 21:23:32.000000000 +0200
@@ -179,9 +179,9 @@
friend class GrassLayer;

//Helper functions
- Ogre::Mesh *GrassLoader::generateGrass_QUAD(PageInfo &page, GrassLayer *layer, float *grassPositions, unsigned int grassCount);
- Ogre::Mesh *GrassLoader::generateGrass_CROSSQUADS(PageInfo &page, GrassLayer *layer, float *grassPositions, unsigned int grassCount);
- Ogre::Mesh *GrassLoader::generateGrass_SPRITE(PageInfo &page, GrassLayer *layer, float *grassPositions, unsigned int grassCount);
+ Ogre::Mesh *generateGrass_QUAD(PageInfo &page, GrassLayer *layer, float *grassPositions, unsigned int grassCount);
+ Ogre::Mesh *generateGrass_CROSSQUADS(PageInfo &page, GrassLayer *layer, float *grassPositions, unsigned int grassCount);
+ Ogre::Mesh *generateGrass_SPRITE(PageInfo &page, GrassLayer *layer, float *grassPositions, unsigned int grassCount);

//List of grass types
std::list<GrassLayer*> layerList;
diff -aur PagedGeometry/include/ImpostorPage.h _PagedGeometry/include/ImpostorPage.h
--- PagedGeometry/include/ImpostorPage.h 2008-01-16 17:41:28.000000000 +0100
+++ _PagedGeometry/include/ImpostorPage.h 2008-04-06 21:26:11.000000000 +0200
@@ -308,7 +308,7 @@
float degrees = Ogre::Math::ATan2(zVector.x, zVector.z).valueDegrees();
if (degrees < 0) degrees += 360;

- int n = IMPOSTOR_YAW_ANGLES * (degrees / 360.0f) + 0.5f;
+ int n = static_cast <int> (IMPOSTOR_YAW_ANGLES * (degrees / 360.0f) + 0.5f);
Ogre::uint16 texCoordIndx = (IMPOSTOR_YAW_ANGLES - n) % IMPOSTOR_YAW_ANGLES;

bbset->createBillboard(position + (rotation * entityBBCenter) * scale,
diff -aur PagedGeometry/include/PagedGeometry.h _PagedGeometry/include/PagedGeometry.h
--- PagedGeometry/include/PagedGeometry.h 2007-12-13 16:24:12.000000000 +0100
+++ _PagedGeometry/include/PagedGeometry.h 2008-04-06 22:19:04.000000000 +0200
@@ -1329,7 +1329,7 @@
{
// In case of infinite bounds bounding rect needs to be calculated in a different manner, since
// it represents local bounds, which are shifted along with the player's movements around the world.
- geomGridX = (2 * farTransDist / mainGeom->getPageSize()) + 4;
+ geomGridX = static_cast <int> ((2 * farTransDist / mainGeom->getPageSize()) + 4);
gridBounds.top = 0;
gridBounds.left = 0;
gridBounds.right = geomGridX * mainGeom->getPageSize();
@@ -1345,7 +1345,7 @@
{
//Bounded mode
gridBounds = bounds;
- geomGridX = (gridBounds.width() / mainGeom->getPageSize());
+ geomGridX = static_cast <int> ((gridBounds.width() / mainGeom->getPageSize()));
}
geomGridZ = geomGridX; //Note: geomGridX == geomGridZ; Need to merge.

@@ -1355,8 +1355,8 @@


//Create GeometryPage's
- int offsetx = Ogre::Math::Floor(gridBounds.left / mainGeom->getPageSize());
- int offsetz = Ogre::Math::Floor(gridBounds.top / mainGeom->getPageSize());
+ int offsetx = static_cast <int> (Ogre::Math::Floor(gridBounds.left / mainGeom->getPageSize()));
+ int offsetz = static_cast <int> (Ogre::Math::Floor(gridBounds.top / mainGeom->getPageSize()));
for (int x = 0; x < geomGridX; ++x)
{
for (int z = 0; z < geomGridZ; ++z)
diff -aur PagedGeometry/include/PropertyMaps.h _PagedGeometry/include/PropertyMaps.h
--- PagedGeometry/include/PropertyMaps.h 2007-10-14 18:42:50.000000000 +0200
+++ _PagedGeometry/include/PropertyMaps.h 2008-04-06 21:20:10.000000000 +0200
@@ -241,4 +241,5 @@



-#endif
+#endif
+
diff -aur PagedGeometry/include/TreeLoader2D.h _PagedGeometry/include/TreeLoader2D.h
--- PagedGeometry/include/TreeLoader2D.h 2008-01-14 10:58:42.000000000 +0100
+++ _PagedGeometry/include/TreeLoader2D.h 2008-04-06 22:04:04.000000000 +0200
@@ -366,4 +366,5 @@



-#endif
+#endif
+
diff -aur PagedGeometry/include/TreeLoader3D.h _PagedGeometry/include/TreeLoader3D.h
--- PagedGeometry/include/TreeLoader3D.h 2007-12-03 16:27:38.000000000 +0100
+++ _PagedGeometry/include/TreeLoader3D.h 2008-04-06 22:09:27.000000000 +0200
@@ -306,4 +306,5 @@



-#endif
+#endif
+
diff -aur PagedGeometry/source/BatchedGeometry.cpp _PagedGeometry/source/BatchedGeometry.cpp
--- PagedGeometry/source/BatchedGeometry.cpp 2008-01-16 18:29:08.000000000 +0100
+++ _PagedGeometry/source/BatchedGeometry.cpp 2008-04-06 21:38:05.000000000 +0200
@@ -57,7 +57,7 @@
void BatchedGeometry::addEntity(Entity *ent, const Vector3 &position, const Quaternion &orientation, const Vector3 &scale, const Ogre::ColourValue &color)
{
//For each subentity
- for (uint i = 0; i < ent->getNumSubEntities(); ++i){
+ for (Ogre::uint i = 0; i < ent->getNumSubEntities(); ++i){
//Get the subentity
SubEntity *subEntity = ent->getSubEntity(i);
SubMesh *subMesh = subEntity->getSubMesh();
@@ -461,10 +461,10 @@

case VES_DIFFUSE:
tmpColor = *((uint32*)sourcePtr++);
- tmpR = ((tmpColor) & 0xFF) * queuedMesh.color.r * ambient.r;
- tmpG = ((tmpColor >> 8) & 0xFF) * queuedMesh.color.g * ambient.g;
- tmpB = ((tmpColor >> 16) & 0xFF) * queuedMesh.color.b * ambient.b;
- tmpA = (tmpColor >> 24) & 0xFF;
+ tmpR = static_cast <Ogre::uint8> (((tmpColor) & 0xFF) * queuedMesh.color.r * ambient.r);
+ tmpG = static_cast <Ogre::uint8> (((tmpColor >> 8) & 0xFF) * queuedMesh.color.g * ambient.g);
+ tmpB = static_cast <Ogre::uint8> (((tmpColor >> 16) & 0xFF) * queuedMesh.color.b * ambient.b);
+ tmpA = static_cast <Ogre::uint8> ((tmpColor >> 24) & 0xFF);

tmpColor = tmpR | (tmpG << 8) | (tmpB << 16) | (tmpA << 24);
*((uint32*)destPtr++) = tmpColor;
@@ -505,9 +505,9 @@
uint32 *endPtr = startPtr + sourceVertexData->vertexCount;

//Generate color
- uint8 tmpR = ambient.r * queuedMesh.color.r * 255;
- uint8 tmpG = ambient.g * queuedMesh.color.g * 255;
- uint8 tmpB = ambient.b * queuedMesh.color.b * 255;
+ uint8 tmpR = static_cast <Ogre::uint8> (ambient.r * queuedMesh.color.r * 255);
+ uint8 tmpG = static_cast <Ogre::uint8> (ambient.g * queuedMesh.color.g * 255);
+ uint8 tmpB = static_cast <Ogre::uint8> (ambient.b * queuedMesh.color.b * 255);
uint32 tmpColor = tmpR | (tmpG << 8) | (tmpB << 16) | (0xFF << 24);

//Copy colors
@@ -651,4 +651,5 @@
return parent->queryLights();
}

-#endif
+#endif
+
diff -aur PagedGeometry/source/GrassLoader.cpp _PagedGeometry/source/GrassLoader.cpp
--- PagedGeometry/source/GrassLoader.cpp 2008-01-14 10:37:42.000000000 +0100
+++ _PagedGeometry/source/GrassLoader.cpp 2008-04-06 21:25:01.000000000 +0200
@@ -124,7 +124,7 @@

//Calculate how much grass needs to be added
float volume = page.bounds.width() * page.bounds.height();
- unsigned int grassCount = layer->density * densityFactor * volume;
+ unsigned int grassCount = static_cast <unsigned int> (layer->density * densityFactor * volume);

//The vertex buffer can't be allocated until the exact number of polygons is known,
//so the locations of all grasses in this page must be precalculated.
diff -aur PagedGeometry/source/ImpostorPage.cpp _PagedGeometry/source/ImpostorPage.cpp
--- PagedGeometry/source/ImpostorPage.cpp 2008-02-06 19:46:34.000000000 +0100
+++ _PagedGeometry/source/ImpostorPage.cpp 2008-04-06 21:26:57.000000000 +0200
@@ -285,7 +285,7 @@
{
StringUtil::StrStreamType entityKey;
entityKey << entity->getMesh()->getName();
- for (uint i = 0; i < entity->getNumSubEntities(); ++i){
+ for (Ogre::uint i = 0; i < entity->getNumSubEntities(); ++i){
entityKey << "-" << entity->getSubEntity(i)->getMaterialName();
}

diff -aur PagedGeometry/source/PagedGeometry.cpp _PagedGeometry/source/PagedGeometry.cpp
--- PagedGeometry/source/PagedGeometry.cpp 2007-12-06 08:20:18.000000000 +0100
+++ _PagedGeometry/source/PagedGeometry.cpp 2008-04-06 21:42:51.000000000 +0200
@@ -312,10 +312,10 @@

//First calculate the general area where the pages will be processed
// 0,0 is the left top corner of the bounding box
- int x1 = Math::Floor(((camPos.x - cacheDist) - gridBounds.left) / mainGeom->getPageSize());
- int x2 = Math::Floor(((camPos.x + cacheDist) - gridBounds.left) / mainGeom->getPageSize());
- int z1 = Math::Floor(((camPos.z - cacheDist) - gridBounds.top) / mainGeom->getPageSize());
- int z2 = Math::Floor(((camPos.z + cacheDist) - gridBounds.top) / mainGeom->getPageSize());
+ int x1 = static_cast <int> (Math::Floor(((camPos.x - cacheDist) - gridBounds.left) / mainGeom->getPageSize()));
+ int x2 = static_cast <int> (Math::Floor(((camPos.x + cacheDist) - gridBounds.left) / mainGeom->getPageSize()));
+ int z1 = static_cast <int> (Math::Floor(((camPos.z - cacheDist) - gridBounds.top) / mainGeom->getPageSize()));
+ int z2 = static_cast <int> (Math::Floor(((camPos.z + cacheDist) - gridBounds.top) / mainGeom->getPageSize()));
if(scrollBuffer)
{
//Check if the page grid needs to be scrolled
@@ -409,7 +409,7 @@
if (speed == 0)
cacheInterval = maxCacheInterval;
else {
- cacheInterval = (mainGeom->getPageSize() * 0.8f) / (speed * pendingList.size());
+ cacheInterval = static_cast <long unsigned int> ((mainGeom->getPageSize() * 0.8f) / (speed * pendingList.size()));
if (cacheInterval > maxCacheInterval)
cacheInterval = maxCacheInterval;
}
@@ -562,8 +562,8 @@
void GeometryPageManager::reloadGeometryPage(const Vector3 &point)
{
//Determine which grid block contains the given points
- const int x = Math::Floor(geomGridX * (point.x - gridBounds.left) / gridBounds.width());
- const int z = Math::Floor(geomGridZ * (point.z - gridBounds.top) / gridBounds.height());
+ const int x = static_cast <int> (Math::Floor(geomGridX * (point.x - gridBounds.left) / gridBounds.width()));
+ const int z = static_cast <int> (Math::Floor(geomGridZ * (point.z - gridBounds.top) / gridBounds.height()));

//Unload the grid block if it's in the grid area, and is loaded
if (x >= 0 && z >= 0 && x < geomGridX && z < geomGridZ){
@@ -806,4 +806,5 @@
{
_trueBounds = AxisAlignedBox(0, 0, 0, 0, 0, 0);
_trueBoundsUndefined = true;
-}
+}
+
diff -aur PagedGeometry/source/PropertyMaps.cpp _PagedGeometry/source/PropertyMaps.cpp
--- PagedGeometry/source/PropertyMaps.cpp 2007-10-15 10:10:50.000000000 +0200
+++ _PagedGeometry/source/PropertyMaps.cpp 2008-04-06 22:02:59.000000000 +0200
@@ -60,7 +60,7 @@
DensityMap::~DensityMap()
{
assert(pixels);
- delete[] pixels->data;
+ delete[] static_cast<uint8*> (pixels->data);
delete pixels;

//Remove self from selfList
@@ -114,7 +114,7 @@
}

//Finally, delete the temporary PF_R8G8B8A8 pixel buffer
- delete[] tmpPixels.data;
+ delete[] static_cast<uint8*> (tmpPixels.data);
}
}

@@ -130,8 +130,8 @@
float boundsWidth = mapBounds.width();
float boundsHeight = mapBounds.height();

- unsigned int xindex = mapWidth * (x - mapBounds.left) / boundsWidth;
- unsigned int zindex = mapHeight * (z - mapBounds.top) / boundsHeight;
+ unsigned int xindex = static_cast <unsigned int> (mapWidth * (x - mapBounds.left) / boundsWidth);
+ unsigned int zindex = static_cast <unsigned int> (mapHeight * (z - mapBounds.top) / boundsHeight);
if (xindex < 0 || zindex < 0 || xindex >= mapWidth || zindex >= mapHeight)
return 0.0f;

@@ -155,8 +155,8 @@
float xIndexFloat = (mapWidth * (x - mapBounds.left) / boundsWidth) - 0.5f;
float zIndexFloat = (mapHeight * (z - mapBounds.top) / boundsHeight) - 0.5f;

- unsigned int xIndex = xIndexFloat;
- unsigned int zIndex = zIndexFloat;
+ unsigned int xIndex = static_cast <unsigned int> (xIndexFloat);
+ unsigned int zIndex = static_cast <unsigned int> (zIndexFloat);
if (xIndex < 0 || zIndex < 0 || xIndex >= mapWidth-1 || zIndex >= mapHeight-1)
return 0.0f;

@@ -222,7 +222,7 @@
ColorMap::~ColorMap()
{
assert(pixels);
- delete[] pixels->data;
+ delete[] static_cast<uint8*> (pixels->data);
delete pixels;

//Remove self from selfList
@@ -296,7 +296,7 @@
}

//Finally, delete the temporary PF_R8G8B8A8 pixel buffer
- delete[] tmpPixels.data;
+ delete[] static_cast <uint8*> (tmpPixels.data);
}
}

@@ -305,13 +305,13 @@
{
assert(pixels);

- unsigned int mapWidth = (unsigned int)pixels->getWidth();
- unsigned int mapHeight = (unsigned int)pixels->getHeight();
+ unsigned int mapWidth = static_cast <unsigned int> (pixels->getWidth());
+ unsigned int mapHeight = static_cast <unsigned int> ((unsigned int)pixels->getHeight());
float boundsWidth = mapBounds.width();
float boundsHeight = mapBounds.height();

- unsigned int xindex = mapWidth * (x - mapBounds.left) / boundsWidth;
- unsigned int zindex = mapHeight * (z - mapBounds.top) / boundsHeight;
+ unsigned int xindex = static_cast <unsigned int> (mapWidth * (x - mapBounds.left) / boundsWidth);
+ unsigned int zindex = static_cast <unsigned int> (mapHeight * (z - mapBounds.top) / boundsHeight);
if (xindex < 0 || zindex < 0 || xindex >= mapWidth || zindex >= mapHeight)
return 0xFFFFFFFF;

@@ -334,10 +334,10 @@
d2 = (color2 >> 24 & 0xFF);

uint8 a, b, c, d;
- a = ratioInv * a1 + ratio * a2;
- b = ratioInv * b1 + ratio * b2;
- c = ratioInv * c1 + ratio * c2;
- d = ratioInv * d1 + ratio * d2;
+ a = static_cast <uint8> (ratioInv * a1 + ratio * a2);
+ b = static_cast <uint8> (ratioInv * b1 + ratio * b2);
+ c = static_cast <uint8> (ratioInv * c1 + ratio * c2);
+ d = static_cast <uint8> (ratioInv * d1 + ratio * d2);

uint32 clr = a | (b << 8) | (c << 16) | (d << 24);
return clr;
@@ -347,18 +347,18 @@
{
assert(pixels);

- unsigned int mapWidth = (unsigned int)pixels->getWidth();
- unsigned int mapHeight = (unsigned int)pixels->getHeight();
+ unsigned int mapWidth = static_cast <unsigned int> (pixels->getWidth());
+ unsigned int mapHeight = static_cast <unsigned int> (pixels->getHeight());
float boundsWidth = mapBounds.width();
float boundsHeight = mapBounds.height();

float xIndexFloat = (mapWidth * (x - mapBounds.left) / boundsWidth) - 0.5f;
float zIndexFloat = (mapHeight * (z - mapBounds.top) / boundsHeight) - 0.5f;

- unsigned int xIndex = xIndexFloat;
- unsigned int zIndex = zIndexFloat;
+ unsigned int xIndex = static_cast <unsigned int> (xIndexFloat);
+ unsigned int zIndex = static_cast <unsigned int> (zIndexFloat);
if (xIndex < 0 || zIndex < 0 || xIndex >= mapWidth-1 || zIndex >= mapHeight-1)
- return 0.0f;
+ return 0;

float xRatio = xIndexFloat - xIndex;
float xRatioInv = 1 - xRatio;
diff -aur PagedGeometry/source/TreeLoader2D.cpp _PagedGeometry/source/TreeLoader2D.cpp
--- PagedGeometry/source/TreeLoader2D.cpp 2008-02-06 13:38:34.000000000 +0100
+++ _PagedGeometry/source/TreeLoader2D.cpp 2008-04-06 22:09:07.000000000 +0200
@@ -40,8 +40,8 @@
gridBounds.bottom = pageSize * Math::Ceil((gridBounds.bottom - geom->getBounds().top) / pageSize) + geom->getBounds().top;

//Calculate page grid size
- pageGridX = Math::Ceil(gridBounds.width() / pageSize) + 1;
- pageGridZ = Math::Ceil(gridBounds.height() / pageSize) + 1;
+ pageGridX = static_cast <int> (Math::Ceil(gridBounds.width() / pageSize) + 1);
+ pageGridZ = static_cast <int> (Math::Ceil(gridBounds.height() / pageSize) + 1);

//Reset color map
colorMap = NULL;
@@ -115,16 +115,16 @@
Real zrel = z - gridBounds.top;

//Get the appropriate grid element based on the new tree's position
- int pageX = Math::Floor(xrel / pageSize);
- int pageZ = Math::Floor(zrel / pageSize);
+ int pageX = static_cast <int> (Math::Floor(xrel / pageSize));
+ int pageZ = static_cast <int> (Math::Floor(zrel / pageSize));
std::vector<TreeDef> &treeList = _getGridPage(pageGrid, pageX, pageZ);

//Create the new tree
TreeDef tree;
- tree.xPos = 65535 * (xrel - (pageX * pageSize)) / pageSize;
- tree.zPos = 65535 * (zrel - (pageZ * pageSize)) / pageSize;
- tree.rotation = 255 * (yaw.valueDegrees() / 360.0f);
- tree.scale = 255 * ((scale - minimumScale) / maximumScale);
+ tree.xPos = static_cast <Ogre::uint16> (65535 * (xrel - (pageX * pageSize)) / pageSize);
+ tree.zPos = static_cast <Ogre::uint16> (65535 * (zrel - (pageZ * pageSize)) / pageSize);
+ tree.rotation = static_cast <Ogre::uint8> (255 * (yaw.valueDegrees() / 360.0f));
+ tree.scale = static_cast <Ogre::uint8> (255 * ((scale - minimumScale) / maximumScale));

//Add it to the tree list
treeList.push_back(tree);
@@ -157,10 +157,10 @@
Real z = pos.z;

//Determine the grid blocks which might contain the requested trees
- int minPageX = Math::Floor(((x-radius) - gridBounds.left) / pageSize);
- int minPageZ = Math::Floor(((z-radius) - gridBounds.top) / pageSize);
- int maxPageX = Math::Floor(((x+radius) - gridBounds.left) / pageSize);
- int maxPageZ = Math::Floor(((z+radius) - gridBounds.top) / pageSize);
+ int minPageX = static_cast <int> (Math::Floor(((x-radius) - gridBounds.left) / pageSize));
+ int minPageZ = static_cast <int> (Math::Floor(((z-radius) - gridBounds.top) / pageSize));
+ int maxPageX = static_cast <int> (Math::Floor(((x+radius) - gridBounds.left) / pageSize));
+ int maxPageZ = static_cast <int> (Math::Floor(((z+radius) - gridBounds.top) / pageSize));
Real radiusSq = radius * radius;

if (minPageX < 0) minPageX = 0; else if (minPageX >= pageGridX) minPageX = pageGridX-1;
@@ -248,8 +248,8 @@
void TreeLoader2D::loadPage(PageInfo &page)
{
//Calculate x/z indexes for the grid array
- page.xIndex -= Math::Floor(gridBounds.left / pageSize);
- page.zIndex -= Math::Floor(gridBounds.top / pageSize);
+ page.xIndex -= static_cast <int> (Math::Floor(gridBounds.left / pageSize));
+ page.zIndex -= static_cast <int> (Math::Floor(gridBounds.top / pageSize));

//Check if the requested page is in bounds
if (page.xIndex < 0 || page.zIndex < 0 || page.xIndex >= pageGridX || page.zIndex >= pageGridZ)
@@ -396,4 +396,4 @@

//Get entity
currentTreeDat.entity = currentGrid->first;
-}
+}
diff -aur PagedGeometry/source/TreeLoader3D.cpp _PagedGeometry/source/TreeLoader3D.cpp
--- PagedGeometry/source/TreeLoader3D.cpp 2008-02-06 13:38:34.000000000 +0100
+++ _PagedGeometry/source/TreeLoader3D.cpp 2008-04-06 22:14:52.000000000 +0200
@@ -34,8 +34,8 @@
gridBounds.bottom = pageSize * Math::Ceil((gridBounds.bottom - geom->getBounds().top) / pageSize) + geom->getBounds().top;

//Calculate page grid size
- pageGridX = Math::Ceil(gridBounds.width() / pageSize) + 1;
- pageGridZ = Math::Ceil(gridBounds.height() / pageSize) + 1;
+ pageGridX = static_cast <int> (Math::Ceil(gridBounds.width() / pageSize) + 1);
+ pageGridZ = static_cast <int> (Math::Ceil(gridBounds.height() / pageSize) + 1);

//Reset color map
colorMap = NULL;
@@ -106,17 +106,17 @@
Real zrel = pos.z - gridBounds.top;

//Get the appropriate grid element based on the new tree's position
- int pageX = Math::Floor(xrel / pageSize);
- int pageZ = Math::Floor(zrel / pageSize);
+ int pageX = static_cast <int> (Math::Floor(xrel / pageSize));
+ int pageZ = static_cast <int> (Math::Floor(zrel / pageSize));
std::vector<TreeDef> &treeList = _getGridPage(pageGrid, pageX, pageZ);

//Create the new tree
TreeDef tree;
tree.yPos = pos.y;
- tree.xPos = 65535 * (xrel - (pageX * pageSize)) / pageSize;
- tree.zPos = 65535 * (zrel - (pageZ * pageSize)) / pageSize;
- tree.rotation = 255 * (yaw.valueDegrees() / 360.0f);
- tree.scale = 255 * ((scale - minimumScale) / maximumScale);
+ tree.xPos = static_cast <Ogre::uint16> (65535 * (xrel - (pageX * pageSize)) / pageSize);
+ tree.zPos = static_cast <Ogre::uint16> (65535 * (zrel - (pageZ * pageSize)) / pageSize);
+ tree.rotation = static_cast <Ogre::uint8> (255 * (yaw.valueDegrees() / 360.0f));
+ tree.scale = static_cast <Ogre::uint8> (255 * ((scale - minimumScale) / maximumScale));

//Add it to the tree list
treeList.push_back(tree);
@@ -146,10 +146,10 @@
pos.z = actualBounds.bottom;

//Determine the grid blocks which might contain the requested trees
- int minPageX = Math::Floor(((pos.x-radius) - gridBounds.left) / pageSize);
- int minPageZ = Math::Floor(((pos.z-radius) - gridBounds.top) / pageSize);
- int maxPageX = Math::Floor(((pos.x+radius) - gridBounds.left) / pageSize);
- int maxPageZ = Math::Floor(((pos.z+radius) - gridBounds.top) / pageSize);
+ int minPageX = static_cast <int> (Math::Floor(((pos.x-radius) - gridBounds.left) / pageSize));
+ int minPageZ = static_cast <int> (Math::Floor(((pos.z-radius) - gridBounds.top) / pageSize));
+ int maxPageX = static_cast <int> (Math::Floor(((pos.x+radius) - gridBounds.left) / pageSize));
+ int maxPageZ = static_cast <int> (Math::Floor(((pos.z+radius) - gridBounds.top) / pageSize));
Real radiusSq = radius * radius;

if (minPageX < 0) minPageX = 0; else if (minPageX >= pageGridX) minPageX = pageGridX-1;
@@ -237,8 +237,8 @@
void TreeLoader3D::loadPage(PageInfo &page)
{
//Calculate x/z indexes for the grid array
- page.xIndex -= Math::Floor(gridBounds.left / pageSize);
- page.zIndex -= Math::Floor(gridBounds.top / pageSize);
+ page.xIndex -= static_cast <int> (Math::Floor(gridBounds.left / pageSize));
+ page.zIndex -= static_cast <int> (Math::Floor(gridBounds.top / pageSize));

//Check if the requested page is in bounds
if (page.xIndex < 0 || page.zIndex < 0 || page.xIndex >= pageGridX || page.zIndex >= pageGridZ)
@@ -375,4 +375,5 @@

//Get entity
currentTreeDat.entity = currentGrid->first;
-}
+}
+

Remark: i didn't test back in windows for the moment.

Nodrev

06-04-2008 22:28:16

The only problem remaining is that cmake didn't create a "make install" script, and the output generation directory for the library is "PagedGeometry/source":
sudo cp source/libPagedGeometry.so /usr/local/lib/
sudo ldconfig