• Advertisement

Archived

This topic is now archived and is closed to further replies.

MS3D rendering problem

This topic is 5496 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

Today I started a static MS3D loader/renderer for my engine, but I ran into a problem. here is the screenshot of the problem, the model is *supposed* to be a sphere. [url]http://www.y3knetwork.com/rendertech/problem.jpg[/url] I based my code on the NeXe ms3d loader, but removed the extra things for ProcessVertices and SpawnVertexBuffer, as I use my own AddVertex method for adding vertices to a VB. The model loads fine, here is my "filling" code.
	bool		bNewGroup=false;

	for (i=0; i.numtriangles; j++)
		{
			for (int k=0; k<3; k++)
			{
				AddVertex (Vec3(pVertices[pTriangles[pGroups[i].triangleIndices[j]].vertexIndices[k]].vertex[0],
								pVertices[pTriangles[pGroups[i].triangleIndices[j]].vertexIndices[k]].vertex[1],
								-pVertices[pTriangles[pGroups[i].triangleIndices[j]].vertexIndices[k]].vertex[2]),
						Vec3(pTriangles[pGroups[i].triangleIndices[j]].vertexNormals[k][0],
								pTriangles[pGroups[i].triangleIndices[j]].vertexNormals[k][1],
								pTriangles[pGroups[i].triangleIndices[j]].vertexNormals[k][2]),
							pTriangles[pGroups[i].triangleIndices[j]].s[k],
							pTriangles[pGroups[i].triangleIndices[j]].t[k],
							
							bNewGroup);
										
				bNewGroup = false;
			}
		}
		bNewGroup = true;
		EndVertices();
	}
 
I believe the problem is the difference between Nexe''s code and mine in this spot. Creating the vertex. I have not changed the loop, it is the same, but the vertex filling is changed. Here is Nexes:
pBufferMemory[j*3 + k].Create(pVertices[pTriangles[pMSFileGroups[i].triangleIndices[j]].vertexIndices[k]].vertex[0],
											pVertices[pTriangles[pMSFileGroups[i].triangleIndices[j]].vertexIndices[k]].vertex[1],
											-pVertices[pTriangles[pMSFileGroups[i].triangleIndices[j]].vertexIndices[k]].vertex[2],
											pTriangles[pMSFileGroups[i].triangleIndices[j]].vertexNormals[k][0],
											pTriangles[pMSFileGroups[i].triangleIndices[j]].vertexNormals[k][1],
											pTriangles[pMSFileGroups[i].triangleIndices[j]].vertexNormals[k][2],
											pTriangles[pMSFileGroups[i].triangleIndices[j]].s[k],
											pTriangles[pMSFileGroups[i].triangleIndices[j]].t[k]);
 
He doesnt increcement his array index by one, but by j*3 + k.. Why is this, can someone explain it? I am not using IndexedPrimitives and triangle lists are used. Thanks a lot!

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement