It is currently Wed Nov 20, 2019 4:09 am


All times are UTC




Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: Compiler warnings and errors - Post your fixes here
PostPosted: Sun Oct 09, 2011 5:49 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
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!


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Compiler warnings and errors - Post your fixes here
PostPosted: Mon Oct 10, 2011 1:47 pm 

Joined: Sat Dec 18, 2010 2:58 am
Posts: 41
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 303 times


Last edited by Freakazo on Wed Oct 12, 2011 12:04 pm, edited 2 times in total.
Top
Offline Profile  
Reply with quote  
 Post subject: Re: Compiler warnings and errors - Post your fixes here
PostPosted: Tue Oct 11, 2011 9:54 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Great, thanks. I'll try to look at this more carefully and get it applied in the next couple of days.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Compiler warnings and errors - Post your fixes here
PostPosted: Wed Oct 12, 2011 9:39 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Compiler warnings and errors - Post your fixes here
PostPosted: Thu Jul 05, 2012 4:35 pm 

Joined: Thu Jul 05, 2012 4:05 pm
Posts: 1
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@")


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Compiler warnings and errors - Post your fixes here
PostPosted: Sat Jul 07, 2012 7:12 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Thanks for the fix, I've now applied this to Git head (here).


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Compiler warnings and errors - Post your fixes here
PostPosted: Sat Dec 01, 2012 12:42 pm 

Joined: Sun Jan 08, 2012 10:00 am
Posts: 31
Location: Germany
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 ...


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Compiler warnings and errors - Post your fixes here
PostPosted: Sun Dec 02, 2012 6:55 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
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?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Compiler warnings and errors - Post your fixes here
PostPosted: Sun Dec 02, 2012 9:31 am 

Joined: Sun Jan 08, 2012 10:00 am
Posts: 31
Location: Germany
yes thats right and yes it works.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Compiler warnings and errors - Post your fixes here
PostPosted: Sun Dec 02, 2012 1:18 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
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.


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net