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


All times are UTC




Post new topic Reply to topic  [ 44 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
 Post subject: polyvox integration to irrlicht
PostPosted: Sun Mar 27, 2011 2:57 am 

Joined: Sat Mar 26, 2011 6:41 pm
Posts: 8
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?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: polyvox integration to irrlicht
PostPosted: Sun Mar 27, 2011 5:04 am 

Joined: Sun Jan 23, 2011 6:06 am
Posts: 92
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
   }
}


Top
Offline Profile  
Reply with quote  
 Post subject: Re: polyvox integration to irrlicht
PostPosted: Sun Mar 27, 2011 9:40 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: polyvox integration to irrlicht
PostPosted: Sun Mar 27, 2011 9:02 pm 

Joined: Sat Mar 26, 2011 6:41 pm
Posts: 8
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


Last edited by granyte on Sun Mar 27, 2011 10:38 pm, edited 1 time in total.

Top
Offline Profile  
Reply with quote  
 Post subject: Re: polyvox integration to irrlicht
PostPosted: Sun Mar 27, 2011 9:56 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
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


Top
Offline Profile  
Reply with quote  
 Post subject: Re: polyvox integration to irrlicht
PostPosted: Sun Mar 27, 2011 10:28 pm 

Joined: Sat Mar 26, 2011 6:41 pm
Posts: 8
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)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: polyvox integration to irrlicht
PostPosted: Mon Mar 28, 2011 2:26 pm 

Joined: Sun Jan 23, 2011 6:06 am
Posts: 92
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: polyvox integration to irrlicht
PostPosted: Mon Mar 28, 2011 5:53 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
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 :)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: polyvox integration to irrlicht
PostPosted: Mon Mar 28, 2011 6:22 pm 

Joined: Sat Mar 26, 2011 6:41 pm
Posts: 8
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


Top
Offline Profile  
Reply with quote  
 Post subject: Re: polyvox integration to irrlicht
PostPosted: Mon Mar 28, 2011 6:42 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
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.


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 44 posts ]  Go to page 1, 2, 3, 4, 5  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