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

Problem using LargeVolume (error: C2064)
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=506
Page 1 of 1

Author:  mindcry [ Mon Apr 29, 2013 9:01 pm ]
Post subject:  Problem using LargeVolume (error: C2064)

Hi,

i get a compiler error when calling:
Code:
volData = new PolyVox::LargeVolume<PolyVox::Material16>(PolyVox::Region(sx, sy, sz, ex, ey, ez));

The error i get is:
Quote:
Error 2 error C2064: term does not evaluate to a function taking 2 arguments C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xrefwrap 431 1 PolyVoxMapper

I tried to modify the code listed here http://www.volumesoffun.com/phpBB3/viewtopic.php?f=2&t=210&p=1716, but i could not find where Loader is declared. Maybe someone can give me a helping hand. It's been ages since last time i touched any C++-templates.
Thank you in advance.

Update: When compiling PolyVox i get the similar error messages for the examples TestAStarPathfinder, OpenGLExample and testvolume. The other examples compile fine. I didn't noticed this before, as i did not needed the examples.

Btw. I'm using Visual Studio 2012. Maybe something is broken with 0x support.

Regards

Kevin

Author:  David Williams [ Tue Apr 30, 2013 9:10 am ]
Post subject:  Re: Problem using LargeVolume (error: C2064)

Hmmm... this is strange. Are you using the version from 'develop' or 'master'? I recommend the develop version if you are working with LargeVolume as I've done some work on it recently, but I suspect you are on that version anyway. The relevant constructor for LargeVolume currently looks like this:

Code:
/// Constructor for creating a fixed size volume.
LargeVolume
(
   const Region& regValid,
   Compressor* pCompressor = 0,
   polyvox_function<void(const ConstVolumeProxy<VoxelType>&, const Region&)> dataRequiredHandler = 0,
   polyvox_function<void(const ConstVolumeProxy<VoxelType>&, const Region&)> dataOverflowHandler = 0,
   bool bPagingEnabled = false,
   uint16_t uBlockSideLength = 32
);


So as far as I can see you only need to provide a Region. In testvolume we fill in the first two parameters but you shouldn't need to.

mindcry wrote:
I tried to modify the code listed here viewtopic.php?f=2&t=210&p=1716, but i could not find where Loader is declared.


I think that was just an example of what you would do if you had a class called Loader (which would be a user provided class).

mindcry wrote:
Update: When compiling PolyVox i get the same error messages for the examples TestAStarPathfinder, OpenGLExample and testvolume. The other examples compile fine. I didn't noticed this before, as i did not needed the examples.

Btw. I'm using Visual Studio 2012. Maybe something is broken with 0x support.


Well this is strange, it builds fine for me (and I have no idea what PolyVoxMapper is!). I can install VS2012 on my work machine and I'm planning to do so anyway at some point. I'll try and do it in the next couple of weeks to see if I can reproduce the issue. Until then I assume the SimpleVolume is working for you?

Author:  mindcry [ Tue Apr 30, 2013 10:02 am ]
Post subject:  Re: Problem using LargeVolume (error: C2064)

Thanks for the quick reply. I tested it with the master and develop branch. In both cases i get the error.

PolyVoxMapper is my project i created to play around with the PolyVox library.
In case that helps, here is the complete build output:
Quote:
1>------ Build started: Project: PolyVoxMapper, Configuration: Release Win32 ------
1> PolyVoxMapper.cpp
1>X:\projects\apps\Worlds\3rdParty\polyvox\library\PolyVoxCore\include\PolyVoxCore/CubicSurfaceExtractor.inl(210): warning C4244: 'argument' : conversion from 'uint32_t' to 'float', possible loss of data
1> X:\projects\apps\Worlds\3rdParty\polyvox\library\PolyVoxCore\include\PolyVoxCore/CubicSurfaceExtractor.inl(202) : while compiling class template member function 'int32_t PolyVox::CubicSurfaceExtractor<VolumeType>::addVertex(uint32_t,uint32_t,uint32_t,uint32_t,PolyVox::Array<noOfDims,ElementType> &)'
1> with
1> [
1> VolumeType=PolyVox::SimpleVolume<PolyVox::Material16>,
1> noOfDims=3,
1> ElementType=PolyVox::CubicSurfaceExtractor<PolyVox::SimpleVolume<PolyVox::Material16>>::IndexAndMaterial
1> ]
1> X:\projects\apps\Worlds\3rdParty\polyvox\library\PolyVoxCore\include\PolyVoxCore/CubicSurfaceExtractor.inl(97) : see reference to function template instantiation 'int32_t PolyVox::CubicSurfaceExtractor<VolumeType>::addVertex(uint32_t,uint32_t,uint32_t,uint32_t,PolyVox::Array<noOfDims,ElementType> &)' being compiled
1> with
1> [
1> VolumeType=PolyVox::SimpleVolume<PolyVox::Material16>,
1> noOfDims=3,
1> ElementType=PolyVox::CubicSurfaceExtractor<PolyVox::SimpleVolume<PolyVox::Material16>>::IndexAndMaterial
1> ]
1> X:\projects\apps\Worlds\3rdParty\polyvox\library\PolyVoxCore\include\PolyVoxCore/CubicSurfaceExtractor.inl(38) : while compiling class template member function 'PolyVox::CubicSurfaceExtractor<VolumeType>::CubicSurfaceExtractor(VolumeType *,PolyVox::Region,PolyVox::SurfaceMesh<VertexType> *,PolyVox::WrapMode,PolyVox::Material<Type>,bool,IsQuadNeeded)'
1> with
1> [
1> VolumeType=PolyVox::SimpleVolume<PolyVox::Material16>,
1> VertexType=PolyVox::PositionMaterial,
1> Type=uint16_t,
1> IsQuadNeeded=PolyVox::DefaultIsQuadNeeded<PolyVox::Material<uint16_t>>
1> ]
1> PolyVoxMapper.cpp(45) : see reference to function template instantiation 'PolyVox::CubicSurfaceExtractor<VolumeType>::CubicSurfaceExtractor(VolumeType *,PolyVox::Region,PolyVox::SurfaceMesh<VertexType> *,PolyVox::WrapMode,PolyVox::Material<Type>,bool,IsQuadNeeded)' being compiled
1> with
1> [
1> VolumeType=PolyVox::SimpleVolume<PolyVox::Material16>,
1> VertexType=PolyVox::PositionMaterial,
1> Type=uint16_t,
1> IsQuadNeeded=PolyVox::DefaultIsQuadNeeded<PolyVox::Material<uint16_t>>
1> ]
1> PolyVoxMapper.cpp(45) : see reference to class template instantiation 'PolyVox::CubicSurfaceExtractor<VolumeType>' being compiled
1> with
1> [
1> VolumeType=PolyVox::SimpleVolume<PolyVox::Material16>
1> ]
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xrefwrap(431): error C2064: term does not evaluate to a function taking 2 arguments
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\functional(239) : see reference to function template instantiation '_Ret std::_Callable_obj<_Ty>::_ApplyX<_Rx,const PolyVox::ConstVolumeProxy<VoxelType>&,const PolyVox::Region&>(_V0_t,_V1_t)' being compiled
1> with
1> [
1> _Ret=void,
1> _Ty=int,
1> _Rx=void,
1> VoxelType=PolyVox::Material<uint16_t>,
1> _V0_t=const PolyVox::ConstVolumeProxy<PolyVox::Material<uint16_t>> &,
1> _V1_t=const PolyVox::Region &
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\functional(239) : see reference to function template instantiation '_Ret std::_Callable_obj<_Ty>::_ApplyX<_Rx,const PolyVox::ConstVolumeProxy<VoxelType>&,const PolyVox::Region&>(_V0_t,_V1_t)' being compiled
1> with
1> [
1> _Ret=void,
1> _Ty=int,
1> _Rx=void,
1> VoxelType=PolyVox::Material<uint16_t>,
1> _V0_t=const PolyVox::ConstVolumeProxy<PolyVox::Material<uint16_t>> &,
1> _V1_t=const PolyVox::Region &
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\functional(239) : while compiling class template member function 'void std::_Func_impl<_Callable,_Alloc,_Rx,_V0_t,_V1_t>::_Do_call(_V0_t,_V1_t)'
1> with
1> [
1> _Callable=_MyWrapper,
1> _Alloc=std::allocator<std::_Func_class<void,const PolyVox::ConstVolumeProxy<PolyVox::Material<uint16_t>> ,const PolyVox::Region &>>,
1> _Rx=void,
1> _V0_t=const PolyVox::ConstVolumeProxy<PolyVox::Material<uint16_t>> ,
1> _V1_t=const PolyVox::Region &
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\functional(516) : see reference to class template instantiation 'std::_Func_impl<_Callable,_Alloc,_Rx,_V0_t,_V1_t>' being compiled
1> with
1> [
1> _Callable=_MyWrapper,
1> _Alloc=std::allocator<std::_Func_class<void,const PolyVox::ConstVolumeProxy<PolyVox::Material<uint16_t>> ,const PolyVox::Region &>>,
1> _Rx=void,
1> _V0_t=const PolyVox::ConstVolumeProxy<PolyVox::Material<uint16_t>> ,
1> _V1_t=const PolyVox::Region &
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\functional(516) : see reference to function template instantiation 'void std::_Func_class<_Ret,_V0_t,_V1_t>::_Do_alloc<_Myimpl,_Ty,_Alloc>(_Fty &&,_Alloc)' being compiled
1> with
1> [
1> _Ret=void,
1> _V0_t=const PolyVox::ConstVolumeProxy<PolyVox::Material<uint16_t>> ,
1> _V1_t=const PolyVox::Region &,
1> _Ty=int,
1> _Alloc=std::allocator<std::_Func_class<void,const PolyVox::ConstVolumeProxy<PolyVox::Material<uint16_t>> ,const PolyVox::Region &>>,
1> _Fty=int
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\functional(516) : see reference to function template instantiation 'void std::_Func_class<_Ret,_V0_t,_V1_t>::_Do_alloc<_Myimpl,_Ty,_Alloc>(_Fty &&,_Alloc)' being compiled
1> with
1> [
1> _Ret=void,
1> _V0_t=const PolyVox::ConstVolumeProxy<PolyVox::Material<uint16_t>> ,
1> _V1_t=const PolyVox::Region &,
1> _Ty=int,
1> _Alloc=std::allocator<std::_Func_class<void,const PolyVox::ConstVolumeProxy<PolyVox::Material<uint16_t>> ,const PolyVox::Region &>>,
1> _Fty=int
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\functional(516) : see reference to function template instantiation 'void std::_Func_class<_Ret,_V0_t,_V1_t>::_Reset_alloc<_Ty,std::allocator<std::_Func_class<_Ret,_V0_t,_V1_t>>>(_Fty &&,_Alloc)' being compiled
1> with
1> [
1> _Ret=void,
1> _V0_t=const PolyVox::ConstVolumeProxy<PolyVox::Material<uint16_t>> ,
1> _V1_t=const PolyVox::Region &,
1> _Ty=int,
1> _Fty=int,
1> _Alloc=std::allocator<std::_Func_class<void,const PolyVox::ConstVolumeProxy<PolyVox::Material<uint16_t>> ,const PolyVox::Region &>>
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\functional(516) : see reference to function template instantiation 'void std::_Func_class<_Ret,_V0_t,_V1_t>::_Reset_alloc<_Ty,std::allocator<std::_Func_class<_Ret,_V0_t,_V1_t>>>(_Fty &&,_Alloc)' being compiled
1> with
1> [
1> _Ret=void,
1> _V0_t=const PolyVox::ConstVolumeProxy<PolyVox::Material<uint16_t>> ,
1> _V1_t=const PolyVox::Region &,
1> _Ty=int,
1> _Fty=int,
1> _Alloc=std::allocator<std::_Func_class<void,const PolyVox::ConstVolumeProxy<PolyVox::Material<uint16_t>> ,const PolyVox::Region &>>
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\functional(675) : see reference to function template instantiation 'void std::_Func_class<_Ret,_V0_t,_V1_t>::_Reset<_Ty>(_Fty &&)' being compiled
1> with
1> [
1> _Ret=void,
1> _V0_t=const PolyVox::ConstVolumeProxy<PolyVox::Material<uint16_t>> ,
1> _V1_t=const PolyVox::Region &,
1> _Ty=int,
1> _Fty=int
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\functional(675) : see reference to function template instantiation 'void std::_Func_class<_Ret,_V0_t,_V1_t>::_Reset<_Ty>(_Fty &&)' being compiled
1> with
1> [
1> _Ret=void,
1> _V0_t=const PolyVox::ConstVolumeProxy<PolyVox::Material<uint16_t>> ,
1> _V1_t=const PolyVox::Region &,
1> _Ty=int,
1> _Fty=int
1> ]
1> X:\projects\apps\Worlds\3rdParty\polyvox\library\PolyVoxCore\include\PolyVoxCore/LargeVolume.h(258) : see reference to function template instantiation 'std::function<_Fty>::function<int>(_Fx &&)' being compiled
1> with
1> [
1> _Fty=void (const PolyVox::ConstVolumeProxy<PolyVox::Material<uint16_t>> &,const PolyVox::Region &),
1> _Fx=int
1> ]
1> PolyVoxMapper.cpp(62) : see reference to function template instantiation 'std::function<_Fty>::function<int>(_Fx &&)' being compiled
1> with
1> [
1> _Fty=void (const PolyVox::ConstVolumeProxy<PolyVox::Material<uint16_t>> &,const PolyVox::Region &),
1> _Fx=int
1> ]
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

Author:  mindcry [ Tue Apr 30, 2013 7:18 pm ]
Post subject:  Re: Problem using LargeVolume (error: C2064)

Hi,

me again. 8-) I tested the project with Visual Studio 2010 and
it compiles without any problems. But i couldn't test the examples,
as i haven't installed Qt on this machine. Seems like the issues are
coming from Visual Studio 2012. I did a quick search on the internet
and found a few posts about similar problems, but they did not
contain a solution for this issue.

Regards

Kevin

Author:  David Williams [ Tue Apr 30, 2013 9:02 pm ]
Post subject:  Re: Problem using LargeVolume (error: C2064)

Ok, as I say I can install VS2012 at work so I'll try to do that soon. We should make sure this is fixed for the next release. I've logged an issue here: https://bitbucket.org/volumesoffun/poly ... -on-vs2012

Author:  David Williams [ Fri May 03, 2013 1:31 pm ]
Post subject:  Re: Problem using LargeVolume (error: C2064)

Yep, I can confirm this is broken on VS2012. It looks like it's related to the usage of std::function in the constructor but to be honest I'm not so familiar with std::function and those template messages are hard to decipher.

LargeVolume is having an overhaul for the next release anyway. We recently added a 'Compressor' class which the user can implement to provide their own compression algorithm, and I think we may well introduce a 'Pager' class as well (along with a default implementation). At this point we probably won't need the std::functions in LargeVolume anymore, and it should be a bit easier to use.

Author:  codingthewheel [ Sat Jun 21, 2014 11:26 pm ]
Post subject:  Re: Problem using LargeVolume (error: C2064)

FWIW the 2nd and 3rd params of the fixed-size LargeVolume ctor are defaulted to "0". Under C++11 they want to be nullptrs:
Code:
/// [LargeVolume.h]
LargeVolume
(
   const Region& regValid,
   polyvox_function<void(const ConstVolumeProxy<VoxelType>&, const Region&)> dataRequiredHandler = 0,
   polyvox_function<void(const ConstVolumeProxy<VoxelType>&, const Region&)> dataOverflowHandler = 0,

A non-invasive workaround (without changing the PolyVox headers) is to set up a couple dummy locals when you create your LargeVolume:
Code:
polyvox_function<void (const ConstVolumeProxy<YOURVOXTYPE>&, const Region&)> f1 = nullptr;
polyvox_function<void (const ConstVolumeProxy<YOURVOXTYPE>&, const Region&)> f2 = nullptr;
Region reg(...);
LargeVolume<YOURVOXTYPE> vol( reg, f1, f2 );

Author:  David Williams [ Sun Jun 22, 2014 6:44 am ]
Post subject:  Re: Problem using LargeVolume (error: C2064)

codingthewheel wrote:
FWIW the 2nd and 3rd params of the fixed-size LargeVolume ctor are defaulted to "0". Under C++11 they want to be nullptrs...

Thanks, but it's also worth noting that this is different in the develop branch anyway, as those functions have been replaced by the Pager class.

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