• Advertisement
Sign in to follow this  

Verts and indices correct?

This topic is 1931 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 writing a marching cubes extractor for my game and I'm running into an error where there are vertices and indiec, but no polygons are being drawn.
Could anyone take a quick look at how i'm adding my vertices and indices? This is using JME3.

here is where I create my triangles

[source lang="java"] /* Create the triangle */
ArrayList<Triangle> t = new ArrayList<Triangle>();
for (i = 0; MCData.triTable[cubeindex] != -1; i += 3)
{
Triangle tri = new Triangle(vertlist[MCData.triTable[cubeindex]],
vertlist[MCData.triTable[cubeindex][i+1]],
vertlist[MCData.triTable[cubeindex][i+2]]);
t.add(tri);
}[/source]

Here is where I add my trianges to the mesh
[source lang="java"] //Node n = new Node("Node " + loc[0] + i + "," + loc[1] + j + "," + loc[2] + k);
for (int triCt = 0; triCt < output.size(); triCt++)
{
mesh.getIndices().add(MCData.indexes[0] + mesh.getVertices().size());
mesh.getIndices().add(MCData.indexes[1] + mesh.getVertices().size());
mesh.getIndices().add(MCData.indexes[2] + mesh.getVertices().size());

mesh.getVertices().add(output.get(triCt).get1());
mesh.getVertices().add(output.get(triCt).get2());
mesh.getVertices().add(output.get(triCt).get3());

mesh.addNormals(MCData.normals);
mesh.addTexCoords(MCData.texCoords);
}[/source]
Do the VErts and indices appear to be added correctly? thanks. Edited by GameGeazer

Share this post


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

  • Advertisement