It is currently Sat Aug 22, 2020 4:27 am


All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: PolyVox::raycastWithDirection troubles
PostPosted: Thu Mar 06, 2014 5:27 pm 

Joined: Wed Jan 11, 2012 7:33 pm
Posts: 109
Hi guys, I'm using the latest version from the repo and noticed there is no Raycast template anymore. So I'm trying raycast with direction instead but its not working -

Code:
 PolyVox::RaycastResult raycastResult;
   
   PolyVox::raycastWithDirection<PolyVox::LargeVolume<PolyVox::Density8>, PolyVox::RaycastResult> raycast(&volume, start, direction, raycastResult);


It says raycast is undefined...help please


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox::raycastWithDirection troubles
PostPosted: Fri Mar 07, 2014 2:38 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
We're in the process of 'unclassing' parts of PolyVox and replacing them with simple function calls instead. So you don't need to create an instance of 'raycastWithDirection', you simply call it as a function. From the unit test in TestRaycast.cpp:

Code:
RaycastTestFunctor raycastTestFunctor;
RaycastResult result = raycastWithDirection(&volData, start, randomUnitVectors[ct % 1024] * 1000.0f, raycastTestFunctor);


Note that RaycastTestFunctor is an example of a callback which you can provide yourself, which is executed for each voxel on the ray and which detemines whether traversal should continue.

However, if you are using it for picking then you might find the new 'pickVoxel' function easier as you don't need to worry about providing a callback. Instead you give it an example of an empty voxel. See TestPicking.cpp to see it being used.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox::raycastWithDirection troubles
PostPosted: Sat Mar 08, 2014 2:45 am 

Joined: Wed Jan 11, 2012 7:33 pm
Posts: 109
Oh ok, where can I find the TestPicking.cpp file? Is it in the repo? Also, I don't see the pickVoxel function anywhere in the library.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox::raycastWithDirection troubles
PostPosted: Sat Mar 08, 2014 7:38 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
If you are on the 'develop' branch of the repo then you should find 'PolyVox/library/PolyVoxCore/include/PolyVoxCore/Picking.h' and 'PolyVox/tests/TestPicking.cpp'. The BitBucket links are below:

https://bitbucket.org/volumesoffun/poly ... at=develop
https://bitbucket.org/volumesoffun/poly ... at=develop


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox::raycastWithDirection troubles
PostPosted: Mon Mar 10, 2014 3:45 pm 

Joined: Wed Jan 11, 2012 7:33 pm
Posts: 109
Ok thanks, I'll reply back if I have trouble with picking. Thank you


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


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