MS3D rendering problem

Started by
0 comments, last by aker_jus 21 years, 2 months ago
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. http://www.y3knetwork.com/rendertech/problem.jpg 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.triangleIndices[j]].vertexIndices[k]].vertex[0],
								pVertices[pTriangles[pGroups.triangleIndices[j]].vertexIndices[k]].vertex[1],
								-pVertices[pTriangles[pGroups.triangleIndices[j]].vertexIndices[k]].vertex[2]),
						Vec3(pTriangles[pGroups.triangleIndices[j]].vertexNormals[k][0],
								pTriangles[pGroups.triangleIndices[j]].vertexNormals[k][1],
								pTriangles[pGroups.triangleIndices[j]].vertexNormals[k][2]),
							pTriangles[pGroups.triangleIndices[j]].s[k],
							pTriangles[pGroups.triangleIndices[j]].t[k],
							
							bNewGroup);
										
				bNewGroup = false;
			}
		}
		bNewGroup = true;
		EndVertices();
	}
 </pre> 
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:
<pre>
pBufferMemory[j*3 + k].Create(pVertices[pTriangles[pMSFileGroups.triangleIndices[j]].vertexIndices[k]].vertex[0],
											pVertices[pTriangles[pMSFileGroups.triangleIndices[j]].vertexIndices[k]].vertex[1],
											-pVertices[pTriangles[pMSFileGroups.triangleIndices[j]].vertexIndices[k]].vertex[2],
											pTriangles[pMSFileGroups.triangleIndices[j]].vertexNormals[k][0],
											pTriangles[pMSFileGroups.triangleIndices[j]].vertexNormals[k][1],
											pTriangles[pMSFileGroups.triangleIndices[j]].vertexNormals[k][2],
											pTriangles[pMSFileGroups.triangleIndices[j]].s[k],
											pTriangles[pMSFileGroups.triangleIndices[j]].t[k]);
 </pre> 
He doesnt increcement his array index by &#111;ne, 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!  </i>   
GraphicsWare|RenderTechhttp://www.graphicsware.com3D Graphics & Solutions
Advertisement
*bump*....
GraphicsWare|RenderTechhttp://www.graphicsware.com3D Graphics & Solutions

This topic is closed to new replies.

Advertisement