Volumes Of Fun
http://www.volumesoffun.com/phpBB3/

Compiler warnings and errors - Post your fixes here
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=15&t=242
Page 1 of 3

Author:  David Williams [ Mon Jul 04, 2011 9:34 pm ]
Post subject:  Compiler warnings and errors - Post your fixes here

This thread is for posting fixes for compile warnings and errors which you encounter when building PolyVox. Please note this is not a support thread - you should not post here if you are unable to build, only if you have overcome some build problems and wish to share your changes with others.

If you are unable to build then you should instead start a new topic in PolyVox Discussion

Author:  beyzend [ Mon Sep 12, 2011 12:23 am ]
Post subject:  Re: Compiler warnings and errors - Post your fixes here

Compiler Error C2872

ambiguous symbol in SurfaceMesh.inl

I have a cpp file which uses the
"using namespace Ogre" directive and it also includes "SurfaceMesh.h"

"SurfaceMesh.inl" has "using namespace std;" by convention we usually shouldn't have the using directive in a header file. But I went ahead and got rid of the using directive in "SurfaceMesh.inl" and adding "using std::vector" in the function "SurfaceMesh<VertexType>::removeUnusedVertices".

Of courser I could have fixed by removing using namespace Ogre from my cpp file.

Author:  David Williams [ Sun Sep 18, 2011 11:36 am ]
Post subject:  Re: Compiler warnings and errors - Post your fixes here

Thanks, but actually I fixed this in Git a couple of weeks ago. I was cleaning up the #include hierarchy because there were a lot of redundant includes, and I fixed this at the same time. But thanks anyway :-)

Author:  Gnurfos [ Sun Sep 25, 2011 10:39 am ]
Post subject:  Re: Compiler warnings and errors - Post your fixes here

Hi,

Here's one that fixes some warnings occurring, not when building PolyVox itself, but in clients application.

Cheers

Edit: Attachement don't seem to work for me, so here is the content. Obtained with "git diff". Let me know if some other format, or even a "merge request" is preferred.

Code:
diff --git a/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl b/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl
index 24b8178..c206c85 100644
--- a/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl
+++ b/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl
@@ -27,8 +27,8 @@ namespace PolyVox
    SurfaceExtractor<VolumeType, VoxelType>::SurfaceExtractor(VolumeType<VoxelType>* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result)
       :m_volData(volData)
       ,m_sampVolume(volData)
-      ,m_regSizeInVoxels(region)
       ,m_meshCurrent(result)
+      ,m_regSizeInVoxels(region)
    {
       //m_regSizeInVoxels.cropTo(m_volData->getEnclosingRegion());
       m_regSizeInCells = m_regSizeInVoxels;
@@ -524,7 +524,6 @@ namespace PolyVox
             //Current position
             const uint32_t uXRegSpace = m_sampVolume.getPosX() - m_regSizeInVoxels.getLowerCorner().getX();
             const uint32_t uYRegSpace = m_sampVolume.getPosY() - m_regSizeInVoxels.getLowerCorner().getY();
-            const uint32_t uZRegSpace = m_sampVolume.getPosZ() - m_regSizeInVoxels.getLowerCorner().getZ();
 
             //Determine the index into the edge table which tells us which vertices are inside of the surface
             uint8_t iCubeIndex = pPreviousBitmask[uXRegSpace][uYRegSpace];
@@ -618,4 +617,4 @@ namespace PolyVox
          }//For each cell
       }
    }
-}
\ No newline at end of file
+}

Author:  David Williams [ Sun Sep 25, 2011 12:01 pm ]
Post subject:  Re: Compiler warnings and errors - Post your fixes here

Thanks, 'git apply' claimed the patch was corrupt but that's probably due to the forum breaking the formatting. It was easy enough just to apply the changes by eye.

Author:  milliams [ Sun Sep 25, 2011 12:21 pm ]
Post subject:  Re: Compiler warnings and errors - Post your fixes here

Attachments should work here.They will need a .diff or .patch file extension though to pass the forum's filtering.

diff files are notoriously picky about formatting and whitespace so I'm not surprised that copy-pasting didn't work.

Patches made with 'git diff' can be applied with 'git apply' and if you make a patch with 'git format-patch' then we can apply it with 'git am' which will preserve your commit message and the fact that the patch was authoured by you.

Author:  David Williams [ Sun Sep 25, 2011 1:10 pm ]
Post subject:  Re: Compiler warnings and errors - Post your fixes here

milliams wrote:
...and if you make a patch with 'git format-patch' then we can apply it with 'git am' which will preserve your commit message and the fact that the patch was authoured by you.

Ah, that's worth knowing for the future.

Author:  Freakazo [ Fri Oct 07, 2011 4:26 am ]
Post subject:  Re: Compiler warnings and errors - Post your fixes here

When using PolyVox::Density<float> you get a compiler error

Quote:
Error 9 error C2297: '|' : illegal, right operand has type 'float' []PolyVoxCore\include\PolyVoxCore\SurfaceExtractor.inl 445 1


Changing line 63 in Density.h to not use the templated type, but instead to always use int for the material solves the problem.

Code:
int getMaterial() const throw() { return 1; }

Author:  David Williams [ Fri Oct 07, 2011 9:21 pm ]
Post subject:  Re: Compiler warnings and errors - Post your fixes here

Agreed, I've made some changes similar to what you have suggested so hopefully it now works for you.

And I'm pleased to hear the SurfaceExtractor works on a float volume - I knew it should in theory but I had never tested it and thought there might be some unexpected issues. So that's good news.

Author:  Freakazo [ Sun Oct 09, 2011 12:59 pm ]
Post subject:  Re: Compiler warnings and errors - Post your fixes here

Ah forgot some other changes I made to make the Density class work with floats

Around line 68 in Density.h for the function getMaxDensity and getThreshold
I changed to

Code:
      static DensityType getMaxDensity() throw() { return std::numeric_limits<DensityType>::max();}
      static DensityType getMinDensity() throw() { return 0; }
      static DensityType getThreshold() throw() {return  (std::numeric_limits<DensityType>::max()/2);}


I have no idea what that voodoo bitwise operators do, but I'm guessing it doesn't work with non int types, so I used std::numeric_limits<> instead. I did a quick test and it seems to be working with both ints and floats.

Page 1 of 3 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/