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

PolyVox language bindings
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=2&t=118
Page 3 of 6

Author:  ape [ Sun Jan 16, 2011 4:18 pm ]
Post subject:  Re: PolyVox language bindings

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

Author:  David Williams [ Sun Jan 16, 2011 4:39 pm ]
Post subject:  Re: PolyVox language bindings

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?

Author:  David Williams [ Sun Jan 16, 2011 4:52 pm ]
Post subject:  Re: PolyVox language bindings

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?

Author:  ape [ Sun Jan 16, 2011 4:53 pm ]
Post subject:  Re: PolyVox language bindings

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.

Author:  David Williams [ Sun Jan 16, 2011 5:42 pm ]
Post subject:  Re: PolyVox language bindings

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?

Author:  ape [ Sun Jan 16, 2011 7:00 pm ]
Post subject:  Re: PolyVox language bindings

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

Author:  David Williams [ Sun Jan 16, 2011 7:39 pm ]
Post subject:  Re: PolyVox language bindings

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.

Author:  ape [ Sun Jan 16, 2011 7:43 pm ]
Post subject:  Re: PolyVox language bindings

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.

Author:  David Williams [ Sun Jan 16, 2011 8:24 pm ]
Post subject:  Re: PolyVox language bindings

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...

Author:  ape [ Sun Jan 16, 2011 8:35 pm ]
Post subject:  Re: PolyVox language bindings

Cool, looking forward to being able to use the commented out stuff :)

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