Volumes Of Fun http://www.volumesoffun.com/phpBB3/ |
|
polyvox integration to irrlicht http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=185 |
Page 1 of 5 |
Author: | granyte [ Sun Mar 27, 2011 2:57 am ] |
Post subject: | polyvox integration to irrlicht |
hey everyy one i'm trying to integrate polyvox with irrlicht and thus possibly later in my game engine also and it seem that polyvex provide a convinient and esy way to acces the vertices and indices of a generated mesh how ever i have no idea how the data is formated withing the returned vector and thus i'm having a hard time integrating it into irrlicht whos vertices are defined as follow Vertices[0] = video::S3DVertex(x,y,z, nx,ny,nz,video::SColor(255,0,255,255), 0, 1); how shouldi go to get the data to go from one to the other? |
Author: | DefiniteIntegral [ Sun Mar 27, 2011 5:04 am ] |
Post subject: | Re: polyvox integration to irrlicht |
Something like this I would think.... Code: void convertMesh(PolyVox::SurfaceMesh<PolyVox::PositionMaterialNormal>* mesh)
{ const std::vector<uint32_t>& indices = mesh->getIndices(); const std::vector<PolyVox::PositionMaterialNormal>& vertices = mesh->getVertices(); for(uint32_t v = 0 ; v < mesh->getNoOfVertices() ; v++) { const PolyVox::Vector3DFloat& position = vertices[v].getPosition(); const PolyVox::Vector3DFloat& normal = vertices[v].getNormal(); float posX = position.getX(); // .. and so on } for(uint32_t i = 0 ; i < mesh->getNoOfIndices(); i++) { // ! copy indices or whatever } } |
Author: | David Williams [ Sun Mar 27, 2011 9:40 am ] |
Post subject: | Re: polyvox integration to irrlicht |
Which surface extractor do you want to use? The easiest one to start with is probably the CubicSurfaceExtratorWithNormals. In this case the vertex data is in the format defined by the PositionMaterialNormal class, which you can see here: VertexTypes.h. PolyVox will provide the position and the normal which you can use with Irrlicht's S3DVertex class. For the colour and texture coordinates you will just have to fill in dummy values. We can look at how to use materials once you have the basic mesh displaying. |
Author: | granyte [ Sun Mar 27, 2011 9:02 pm ] |
Post subject: | Re: polyvox integration to irrlicht |
idealy i'd prefer to use a smooth mesh extractor but anyway rightnow when i try to setup a mesh extractor i get error argument list for class template "PolyVox::SurfaceMesh" is missing anything i'm doing wrong or includes i could have missed? EDIT BTW thanks for the conversion code it makes sens |
Author: | David Williams [ Sun Mar 27, 2011 9:56 pm ] |
Post subject: | Re: polyvox integration to irrlicht |
The smooth SurfaceExtractor and the CubicSurfaceExtractorWithNormals are basically interchangeable so no problems there. But really we need to see code to identify the problem. Have you taken a look at the BasicExample, and does that work for you? And be sure to read this tutorial if your not yet familier with the basics: http://www.thermite3d.org/resources/documentation/polyvox/documentation/tutorial1.html |
Author: | granyte [ Sun Mar 27, 2011 10:28 pm ] |
Post subject: | Re: polyvox integration to irrlicht |
that's the code of this tutorial i'm trying to use and as i said the tutorial say only mention required headers i'm suposed to guess them? also just copy pasting the code result in an error when trying to create surfacemesh object mesh (yes i have surfacemesh.h included i guessed that one) |
Author: | DefiniteIntegral [ Mon Mar 28, 2011 2:26 pm ] |
Post subject: | Re: polyvox integration to irrlicht |
The headers aren't hard to figure out. Generally each class has it's own header. Have a look at the API documentation: http://www.thermite3d.org/resources/doc ... tated.html Also take a look at the Basic and OpenGL example code with PolyVox. Those definitely do compile. |
Author: | David Williams [ Mon Mar 28, 2011 5:53 pm ] |
Post subject: | Re: polyvox integration to irrlicht |
I've just checked and I can see the tutorial is out of date and does not compile. The actual compiling code is in the BasicExample (see here) which comes as part of PolyVox. You should use the tutorial for the information but the BasicExample for the actual code. The BasicExample includes the following headers: Code: #include "MaterialDensityPair.h" #include "CubicSurfaceExtractorWithNormals.h" #include "SurfaceMesh.h" #include "Volume.h" Sorry the documentation is out of date but this library is not finished yet... hopefully we'll update it soon ![]() |
Author: | granyte [ Mon Mar 28, 2011 6:22 pm ] |
Post subject: | Re: polyvox integration to irrlicht |
thank's for pointing me in the right direction again however this code now break the conversion code saying that mesh must have a pointer type |
Author: | David Williams [ Mon Mar 28, 2011 6:42 pm ] |
Post subject: | Re: polyvox integration to irrlicht |
You're referring to DefiniteIntegral's convertMesh() function above? It takes a pointer to a mesh, so you probably need to do something like: Code: convertMesh(&mesh); (note the '&' before 'mesh'). If that doesn't answer your question you'll need to show your actual code. |
Page 1 of 5 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |