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

LargeVolume on VS2012
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=540
Page 1 of 2

Author:  tacospice [ Thu Sep 19, 2013 2:22 am ]
Post subject:  LargeVolume on VS2012

Is there currently any way to use the LargeVolume on Visual Studio 2012?
I've seen other posts about it here, but no solution yet.

I tried a few of the versions (0.2.1, hotfix, and developer I believe) and they all seem to have their own issues.

Author:  kklouzal [ Thu Sep 19, 2013 3:56 am ]
Post subject:  Re: LargeVolume on VS2012

I was directed to use the developer version but it too had it's own errors, I'll try to use LargeVolume again and post the results.

Author:  David Williams [ Fri Sep 20, 2013 8:58 am ]
Post subject:  Re: LargeVolume on VS2012

I just tested the develop version of PolyVox on VS2012. I couldn't build the bindings (I don't have SWIG, etc installed) and there was one error related to the AStarPathfinder when building the tests, but apart from that it seems to work on. The examples build and run correctly and I believe the LargeVolume works.

Can you disable the bindings and tests (via CMake) and then post any compile errors you are getting? Even if the bindings/tests are left enabled you will get errors from them, but the examples should still build OK.

Author:  kklouzal [ Fri Sep 20, 2013 11:01 am ]
Post subject:  Re: LargeVolume on VS2012

I was able to get it to compile in my project :)

Notable changes:
Runtime Library Multi-threaded (/MT) <--have to have that to be compatible with my network library
ENABLE_BINDINGS (disabled)
ENABLE_EXAMPLES (disabled)
ENABLE_TESTS (disabled)
LIBRARY_TYPE (dynamic) <---might switch this to static and compile it via .dll (static lets you make it into a .dll right? :P )
SPHINXBUILD_EXECUTABLE (not found)
SWIG_EXECUTABLE (not found)

Full optimizations, favor fast code over small code, floating point to fast instead of precise.

Upon running the program I get an access violation pointing to this line of LargeVolume.inl
Code:
m_pPager->pageIn(reg, pBlock);

Author:  David Williams [ Sat Sep 21, 2013 6:42 am ]
Post subject:  Re: LargeVolume on VS2012

Great, I'm glad you got it to compile.

The crash is probably because m_pPager is null? When you construct a LargeVolume you need to give it an instance to a 'Pager' class which will be used to move data into memory in the first place and then page it out when there is too much. What this Pager does with the data is up to you, but the sample 'FilePager' implementation just saves it to disk. Alternatively, the example 'PerlinNoisePager' generates the inital data from Perlin noise and then just discards it on overflow. Have a look at these files to get an idea of the logic.

You can create a LargeVolume something like this:

Code:
MinizBlockCompressor<int32_t>* pBlockCompressor = new MinizBlockCompressor<int32_t>;
FilePager<int32_t>* pFilePager = new FilePager<int32_t>("./");
LargeVolume<int32_t>* pLargeVolume = new LargeVolume<int32_t>(region, pBlockCompressor, pFilePager, 32);


Of course, PolyVox should not try to use the pager if it is null (or it should force it not to be null) but there may be a few more issues like this which still need to be fixed in the LargeVolume.

Author:  kklouzal [ Sat Sep 21, 2013 11:50 am ]
Post subject:  Re: LargeVolume on VS2012

I can't seem to figure out why this code is returning errors:
Code:
PolyVox::MinizBlockCompressor<int32_t>* pBlockCompressor = new PolyVox::MinizBlockCompressor<int32_t>;
PolyVox::FilePager<int32_t>* pFilePager = new PolyVox::FilePager<int32_t>("./");
PolyVox::Region this_region = PolyVox::Region(PolyVox::Vector3DInt32(0,0,0), PolyVox::Vector3DInt32(1024,32,1024));
PolyVox::LargeVolume<int32_t>* pLargeVolume = new PolyVox::LargeVolume<int32_t>(this_region,pBlockCompressor, pFilePager, 64);


Errors:
Code:
 6 IntelliSense: no instance of constructor "PolyVox::LargeVolume<VoxelType>::LargeVolume [with VoxelType=int32_t]" matches the argument list
            argument types are: (PolyVox::Region, PolyVox::MinizBlockCompressor<int32_t> *, PolyVox::FilePager<int32_t> *, int)   \DX-Server\ChunkManager.h   5

 5 IntelliSense: incomplete type is not allowed   \DX-Server\ChunkManager.h   5


Code:
error C2664:
'PolyVox::LargeVolume<VoxelType>::LargeVolume(const PolyVox::Region &,PolyVox::BlockCompressor<VoxelType> *,PolyVox::Pager<VoxelType> *,uint16_t)' : cannot convert parameter 3 from 'PolyVox::FilePager<VoxelType> *' to 'PolyVox::Pager<VoxelType> *'   \dx-server\ChunkManager.h   5

error C2514:
'PolyVox::FilePager<VoxelType>' : class has no constructors   \dx-server\ChunkManager.h   3

Author:  David Williams [ Sat Sep 21, 2013 12:19 pm ]
Post subject:  Re: LargeVolume on VS2012

I think you haven't included the required headers (probably FilePager.h?). In this case it's will see the forward declaration of FilePager in PolyVoxForwardDeclarations.h but won't have the class definition.

This has caught me out before... I'm not sure these forward declarations are such a smart idea but they are supposed to reduce compilation time. Maybe they don't make sense in projects which are mostly headers (like PolyVox)? I have to think about this.

Author:  kklouzal [ Sat Sep 21, 2013 12:50 pm ]
Post subject:  Re: LargeVolume on VS2012

After including the proper file:
Code:
error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.   C:\Users\DX-Server\PolyVox\include\PolyVoxCore\FilePager.h   89

Refering to this line of that file:
Code:
         FILE* pFile = fopen(filename.c_str(), "rb");





After changing two lines in FilePager.h it compiled and my program ran.
Lines 88 & 135
Code:
         FILE* pFile;
         fopen_s(&pFile,filename.c_str(), "rb");

Author:  David Williams [ Sat Sep 21, 2013 3:28 pm ]
Post subject:  Re: LargeVolume on VS2012

Yeah, that's a Visual Studio thing... they don't like you using standard functions and prefer you to use their own versions. You can just ignore that volume really... maybe we should supress it through CMake.

Also, I logged an issue for the use of forward declarations as we should really think if they make sense: https://bitbucket.org/volumesoffun/polyvox/issue/45/use-of-forward-declarations-is-confusing

Glad you got it working anyway :-)

Author:  kklouzal [ Tue Sep 24, 2013 9:46 am ]
Post subject:  Re: LargeVolume on VS2012

I also just received this error
Code:
error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.   \PolyVox\include\PolyVoxCore\FilePager.h   89


Referring to this line:
Code:
FILE* pFile = fopen(filename.c_str(), "rb");


Which I replaced with:
Code:
      FILE* pFile;
         fopen_s(&pFile, filename.c_str(), "rb");


The same thing must be done a few lines further down
:)

But receiving error in program console: "Unable to open file to write out block data."
:/

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