my 3d model loader is driving me mad!

I am trying to load this model as a jME custom mesh.


model: "simple"
pointsPerArc:2
texture: "demo"
	bottomLeft: 0.0,0.0
	topRight: 0.5,0.5
texture: "demo2"
	bottomLeft: 0.5,0.5
	topRight: 1.0,1.0
texture: "demo3"
	bottomLeft: 0.5,0.0
	topRight: 1.0,0.5
texture: "demo4"
	bottomLeft: 0.0,0.5
	topRight: 0.5,1.0
mesh: "mesh1"
	properties:
		useTexture: "demo"
	circle:
		offset: 0.0, -2.0, 0.0
		vector: 0.0, 1.0, 0.0
		radius: 2.8
	circle:
		offset: 0.0, 2.0, 0.0
		vector: 0.0, 1.0, 0.0
		radius: 0.10
mesh: "mesh2"
	properties:
		useTexture: "demo2"
	circle:
		offset: 0.0, 4.0, 0.0
		vector: 0.0, 1.0, 0.0
		radius: 2.8
	circle:
		offset: 0.0, 8.0, 0.0
		vector: 0.0, 1.0, 0.0
		radius: 0.10
mesh: "mesh3"
	properties:
		useTexture: "demo3"
	circle:
		offset: 0.0, 12.0, 0.0
		vector: 0.0, 1.0, 0.0
		radius: 2.8
	circle:
		offset: 0.0, 16.0, 0.0
		vector: 0.0, 1.0, 0.0
		radius: 0.10

It should be three separate “triangles” pointing up. Instead the triangles are joined together as a strip and the index doesn’t seem to reference all the verteces.

My apologies for the code, it is still in the hacky will-it-work stage. No it doesn’t.

http://pastebin.java-gaming.org/85c373d701f1c

EDIT: I updated the pastebin with the fix.

I’ve calmed down a little and pretty printed the vertexes:. It makes a bit more sense than looking at the rendered geometry. It’s built up as a series of lines of three verteces each. I’ve split it out into what should be the three separate triangles, but clearly the second triangle is referencing back into the first triangle.


0, 1, 3, 
1, 2, 4, 
4, 3, 1, 
5, 4, 2, 

@@3, 4, 6, 
@@4, 5, 7, 
7, 6, 4, 
8, 7, 5, 

6, 7, 9, 
7, 8, 10, 
10, 9, 7, 
11, 10, 8, 

EDIT: Figured it out… I need to increment the number of verteces in the last cross section of each submesh.

Now I can draw triangles. And cubes… Wow, I could build a voxel-based sandbox cube world with a survival mode :slight_smile:

So original idea! :o