Jump to content
  • Advertisement
Sign in to follow this  

Trouble creating a mesh

This topic is 2937 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using irrlicht and polyvox in order to generate a minecraft-esque world. I don't have much experience with 3d graphics and the mesh is being generated improperly. Am I setting up my indices and vertices correctly? Thankyou for your time.

SMesh* TerrainManager::generateCubicMesh(SimpleVolume<MaterialDensityPair44>& volData)
//extract the surface mesh from the voxels
SMesh* sMesh = new SMesh();
SurfaceMesh<PositionMaterialNormal> vMesh;
CubicSurfaceExtractorWithNormals<SimpleVolume, MaterialDensityPair44 > surfaceExtractor(&volData, volData.getEnclosingRegion(), &vMesh);
//get the indices and vertices
const std::vector<uint32_t>& vecIndices = vMesh.getIndices();
const std::vector<PositionMaterialNormal>& vecVertices = vMesh.getVertices();
//copy indices to an array
u16 *arrIndices = new u16[vMesh.getNoOfIndices()];
for(int i =0; i < vMesh.getNoOfIndices();i++)
arrIndices =(u32)vecIndices;
//copy vertices to an array
f32 *arrVertices = new f32[vecVertices.size()*3];
int j = 0;
for(int i =0; i < vecVertices.size();i++)

arrVertices[j] = (f32)vecVertices.getPosition().getX();j++;
arrVertices[j] = (f32)vecVertices.getPosition().getY();j++;
arrVertices[j] = (f32)vecVertices.getPosition().getZ();j++;

//generate mesh buffer and add it to the mesh
SMeshBuffer *buf = new SMeshBuffer();
return sMesh;

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!