Equis1 Posted April 15, 2005 Posted April 15, 2005 Hello, I am loading mesh information from a file format other than .X. I have created the vertex and index buffers successfully but I would also like to create subsets for texturing. I have tried a couple routes, originally getting the GraphicsStream by locking the Attribute Buffer and writing to it, which always crashed at run time. Obviously I wasn't writing to the stream properly. The second method - int faceStart = 0; int vertexStart = 0; AttributeRange[] test = new AttributeRange[importer.mesh.PolygonList.Count]; GraphicsStream attributeStream = mesh.LockAttributeBuffer(LockFlags.None); for (int i = 0; i < importer.mesh.PolygonList.Count; i++) { IMDPolygon currentPoly = ((IMDPolygon)importer.mesh.PolygonList); //Loop through all IMDMeshes //Note that these should probably be divided into a Dx Subset test.AttributeId = i; test.FaceCount = currentPoly.TriangleList.Count; test.FaceStart = faceStart; test.VertexCount = currentPoly.VertexList.Count; test.VertexStart = vertexStart; faceStart += currentPoly.TriangleList.Count; vertexStart += currentPoly.VertexList.Count; } mesh.UnlockAttributeBuffer(); mesh.SetAttributeTable(test); The examples I see in C++ (few and far between) simply lock the AttributeStream which returns a DWORD pointer which they then set for each indice. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.