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 2 of 3

Author:  David Williams [ Sun Oct 09, 2011 5:49 pm ]
Post subject:  Re: Compiler warnings and errors - Post your fixes here

Thanks, I was doing something really stupid there. The bitwise operations were just to compute the maximum size of the type (e.g. for 8 bits shift 0x01 << 8 gives 256, and subtract one for the maximum value of 255.

Obviously numeric_limits is the correct way to do it. I must have written that when half asleep ;)

[Edit:] Ah, I know why I did it. It was copied from the MaterialDensityPair, where this bitwise shifting does make sense because only some of the bits of the type are used for density (the rest are for the material). I feel better now!

Author:  Freakazo [ Mon Oct 10, 2011 1:47 pm ]
Post subject:  Re: Compiler warnings and errors - Post your fixes here

Here is another fix for when using float volumes. this time the bug is when extracting the surface of a float type volume the normals all end up 0,0,0.

After some playing around here is a simple fix. At line 62 of SurfaceExtractor.h

Code:
      Vector3DFloat computeCentralDifferenceGradient(const typename VolumeType<VoxelType>::Sampler& volIter)
      {
         float voxel1nx = static_cast<float>(volIter.peekVoxel1nx0py0pz().getDensity());
         float voxel1px = static_cast<float>(volIter.peekVoxel1px0py0pz().getDensity());

         float voxel1ny = static_cast<float>(volIter.peekVoxel0px1ny0pz().getDensity());
         float voxel1py = static_cast<float>(volIter.peekVoxel0px1py0pz().getDensity());

         float voxel1nz = static_cast<float>(volIter.peekVoxel0px0py1nz().getDensity());
         float voxel1pz = static_cast<float>(volIter.peekVoxel0px0py1pz().getDensity());

         return Vector3DFloat
         (
            voxel1nx - voxel1px,
            voxel1ny - voxel1py,
            voxel1nz - voxel1pz
         );
      }


All I did was move the static_casts to where the values are allocated to the variables, and turned the variables into type float.

Also these last couple of fixes I posted up are my very first 'contribution' to OSS :3

[edit] This patch also solves normal calculations with densities with negative density:

Incorrect normals:
http://66.240.163.101/withUint.jpg
Correct normals:
http://66.240.163.101/withint.jpg

Attachments:
File comment: Patch
0001-Fixed-generation-of-normals-with-float-volumes.patch [2.1 KiB]
Downloaded 446 times

Author:  David Williams [ Tue Oct 11, 2011 9:54 pm ]
Post subject:  Re: Compiler warnings and errors - Post your fixes here

Great, thanks. I'll try to look at this more carefully and get it applied in the next couple of days.

Author:  David Williams [ Wed Oct 12, 2011 9:39 pm ]
Post subject:  Re: Compiler warnings and errors - Post your fixes here

Ok, I applied the patch. Actually, rather than using floats or ints, I think ideally it should use the same type which voxel uses to actually store the density value. I.e. it should change between int or float depending on what kind of data you have in your volume.

In the future I'll probably make it possible to access this information, so I added a comment to that effect.

Author:  WatchCat [ Thu Jul 05, 2012 4:35 pm ]
Post subject:  Re: Compiler warnings and errors - Post your fixes here

Found some bug in PolyVoxConfig.cmake.in
as result of it generated PolyVoxConfig.cmake leave PolyVox_LIBRARY_DIRS empty
here patch
Code:
diff --git a/library/PolyVoxConfig.cmake.in b/library/PolyVoxConfig.cmake.in
index bef9927..2eae4a3 100644
--- a/library/PolyVoxConfig.cmake.in
+++ b/library/PolyVoxConfig.cmake.in
@@ -23,7 +23,7 @@ endif()
 
 set(PolyVoxCore_LIBRARY_DIRS "${PREFIX}/@PolyVoxCore_LIBRARY_INSTALL_DIRS@")
 set(PolyVoxUtil_LIBRARY_DIRS "${PREFIX}/@PolyVoxUtil_LIBRARY_INSTALL_DIRS@")
-set(PolyVox_LIBRARY_DIRS "${PolyVoxCore_LIBRARY_DIR}" "${PolyVoxUtil_LIBRARY_DIR}")
+set(PolyVox_LIBRARY_DIRS "${PolyVoxCore_LIBRARY_DIRS}" "${PolyVoxUtil_LIBRARY_DIRS}")
 
 set(PolyVoxCore_INCLUDE_DIRS "${PREFIX}/@PolyVoxCore_INCLUDE_INSTALL_DIRS@")
 set(PolyVoxUtil_INCLUDE_DIRS "${PREFIX}/@PolyVoxUtil_INCLUDE_INSTALL_DIRS@")

Author:  David Williams [ Sat Jul 07, 2012 7:12 am ]
Post subject:  Re: Compiler warnings and errors - Post your fixes here

Thanks for the fix, I've now applied this to Git head (here).

Author:  zprg [ Sat Dec 01, 2012 12:42 pm ]
Post subject:  Re: Compiler warnings and errors - Post your fixes here

hello,
the old polyvox compiles, but with the new 0.2 i get the error that an include isnt there
DefaultIsQuadNeeded.h(27) ... "cstdint": No such file or directory

i read its posslible to change it to this ?
Code:
#include <boost/cstdint.hpp>
   using boost::int8_t;
   using boost::int16_t;
   using boost::int32_t;
   using boost::uint8_t;
   using boost::uint16_t;
   using boost::uint32_t;

edit: oops sorry i havent seen that this thread is for fixes, but for me it works -so maybe we can call it a fix ...

Author:  David Williams [ Sun Dec 02, 2012 6:55 am ]
Post subject:  Re: Compiler warnings and errors - Post your fixes here

Ah, yes, this is a mistake. You must be working on VS2008? We didn't test that compiler before release. Instead of:

Code:
#include <cstdint>


It should be:

Code:
#include "PolyVoxCore/Impl/TypeDef.h"


Can you try that change and verify that it works?

Author:  zprg [ Sun Dec 02, 2012 9:31 am ]
Post subject:  Re: Compiler warnings and errors - Post your fixes here

yes thats right and yes it works.

Author:  David Williams [ Sun Dec 02, 2012 1:18 pm ]
Post subject:  Re: Compiler warnings and errors - Post your fixes here

Great, thanks, this has been fixed: https://www.gitorious.org/polyvox/polyv ... 17dc59520f

We might consider a maintenance release at some point as this is quite a problem for some users.

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