It is currently Sat Aug 22, 2020 1:05 pm


All times are UTC




Post new topic Reply to topic  [ 54 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: Re: PolyVox language bindings
PostPosted: Sun Jan 16, 2011 4:18 pm 

Joined: Sat Jan 15, 2011 3:49 pm
Posts: 38
Ah, okay. Sounds like some unit testing is in order :P
Commenting out smoothPositions fixed that error, not sure about the others though.

edit: got it to compile by commenting out generateAveragedFaceNormals, sumNearbyNormals, and extractSubset as well. Probably better to actually fix those, though.
Here are the updated bindings so far
http://dl.dropbox.com/u/6281166/PolyVox_bindings.zip


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox language bindings
PostPosted: Sun Jan 16, 2011 4:39 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
I think the thing now is to try compiling the various .i files one at a time to see which ones have problems. I think the SurfaceExtractor will be harder then the CubicSurfaceExtractor so try commenting that one out in PolyVoxCore.i. Comment out any you can't get to work, and then maybe you can create a patch from your PolyVox folder and send it to me. I'll see if I can do something with them.

As for the ones which do compile, have you managed to get your C# project to load them?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox language bindings
PostPosted: Sun Jan 16, 2011 4:52 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
ape wrote:
edit: got it to compile by commenting out generateAveragedFaceNormals, sumNearbyNormals, and extractSubset as well. Probably better to actually fix those, though.
Here are the updated bindings so far
http://dl.dropbox.com/u/6281166/PolyVox_bindings.zip


Right, sorry, we're posting at the same time. Those should probably be fixed but it might not be trivial, probably a small refactor required. In the mean time is it possible to tell SWIG to ignore particular member functions, something similar to what you did with the overloaded operators?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox language bindings
PostPosted: Sun Jan 16, 2011 4:53 pm 

Joined: Sat Jan 15, 2011 3:49 pm
Posts: 38
I think it is possible to ignore certain stuff with %ignore. Not sure on the syntax, yet. I'm testing in c# now. So far my mesh has 0 indices, I probably need to set some of the cells to solid before it will work properly.

Do you frequent any irc channels where we could take this? Probably would be less tedious than refreshing the thread.

edit: Got it working
Code:
VolumeDensity8 volume = new VolumeDensity8(32, 32, 32);
Region region = new Region(new Vector3DInt16(0, 0, 0, 0), new Vector3DInt16(32, 32, 32, 32));

//Our new density value
byte uDensity = Density8.getMaxDensity();

//Get the old voxel
Density8 voxel = volume.getVoxelAt(16, 16, 16);

//Modify the density
voxel.setDensity(uDensity);

//Wrte the voxel value into the volume
volume.setVoxelAt(16, 16, 16, voxel);

SurfaceMeshPositionMaterialNormal surface = new SurfaceMeshPositionMaterialNormal();
SurfaceExtractorDensity8 surfaceExtractor = new SurfaceExtractorDensity8(volume, region, surface);
surfaceExtractor.execute(); // extract surface
uint indices = surface.getNoOfIndices();
Console.WriteLine("Surface indices: " + indices);


indices == 24 :D Now to get it rendering I need to somehow get it to marshal from a *std::vector<vertextype> to List<vertextype>. Currently its giving me "SWIGTYPE_p_std__vectorT_PolyVox__PositionMaterialNormal_t" for surface.getVertices().
http://yuval.bar-or.org/blog/2009/11/im ... -stdmap-2/ looks helpful on the subject

edit: Got it giving me an IEnumerable of PositionMaterialNormal now, using
Quote:
%template(PositionMaterialVector) std::vector<PolyVox::PositionMaterial>;

Going to try getting the vertices into a format I can batch render, now.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox language bindings
PostPosted: Sun Jan 16, 2011 5:42 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
ape wrote:
Do you frequent any irc channels where we could take this? Probably would be less tedious than refreshing the thread.


Unfortuatly not... besides I actualy like to keep these conversations public for anyone else who wants to follow. Plus it keeps the forums active and shows some life in the community ;-)

ape wrote:
Now to get it rendering I need to somehow get it to marshal from a *std::vector<vertextype> to List<vertextype>. Currently its giving me "SWIGTYPE_p_std__vectorT_PolyVox__PositionMaterialNormal_t" for surface.getVertices().
http://yuval.bar-or.org/blog/2009/11/im ... -stdmap-2/ looks helpful on the subject


Can't help directly, but a work around may be to add a SurfaceMesh::getVertexAt(index i) function. Of course, it's better if it can work properly. Or maybe not, perhaps there should be a VertexBuffer and IndexBuffer class in PolyVox?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox language bindings
PostPosted: Sun Jan 16, 2011 7:00 pm 

Joined: Sat Jan 15, 2011 3:49 pm
Posts: 38
I finally got everything converted to xna's vertex and index format but it still doesn't seem to be rendering. Probably something stupid on my part like not setting the view/camera matrixes correctly. I put my code up on github if anyone else feels like playing around with voxels in C#.

http://github.com/apeape/GameClient

I also updated the bindings files at
http://dl.dropbox.com/u/6281166/PolyVox_bindings.zip


Last edited by ape on Sun Jan 16, 2011 7:42 pm, edited 1 time in total.

Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox language bindings
PostPosted: Sun Jan 16, 2011 7:39 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Excellent! I'll be happy to add your changes back into the PolyVox SVN whenever you feel it's ready. It'll be interesting to see whether the guys using Python are also able to get it to work for them.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox language bindings
PostPosted: Sun Jan 16, 2011 7:43 pm 

Joined: Sat Jan 15, 2011 3:49 pm
Posts: 38
Not really sure how to fix the problems it was having in those commented out functions. The only other changes I made to the polyvox source were putting the #ifdef SWIG to change the return value for the classes that were returning that API type.
Also apparently swig doesn't have an interface for using std::set in C# so one of the functions in surfacemesh that uses that probably won't be easily usable.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox language bindings
PostPosted: Sun Jan 16, 2011 8:24 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
The stuff in the zip file I have added to SVN though I changed it very slightly. I adjusted the names of the batch files, changed 'Assignment' to 'assignment' and 'lessThanOrEqual' is now 'lessThanOrEqualTo', stuff like that. Let me know if that doesn't make sense.

I'm looking at the other issues now...


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox language bindings
PostPosted: Sun Jan 16, 2011 8:35 pm 

Joined: Sat Jan 15, 2011 3:49 pm
Posts: 38
Cool, looking forward to being able to use the commented out stuff :)


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

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