private SModelMesh convertToMyMesh(GraphicsDevice device, SRenderInfoMesh renderMess) { SModelMesh result = new SModelMesh(); result.vertexBuffer = new VertexBuffer(device, _vertexSizeInBytes, BufferUsage.WriteOnly); result.vertexBuffer.SetData(renderMess.vertex_info); result.texture = _coreModel.getTexture(renderMess.texture_name); result.numPrimitives = renderMess.vertex_info.Length / 3; return result; }
private void initializeVertices(MD3Object m) { if (m.part == TMD3Part.HEAD) head_vertices = new List<SRenderInfoMesh>(); else if (m.part == TMD3Part.UPPER) upper_vertices = new List<SRenderInfoMesh>(); else lower_vertices = new List<SRenderInfoMesh>(); int count = m.meshes.Count; for (int i = 0; i < count; ++i) { int vcount = m.meshes[i].indices.Count; SRenderInfoMesh render_info = new SRenderInfoMesh(); render_info.texture_name = m.meshes[i].meshinfo.strName; render_info.vertex_info = new VertexPositionNormalTexture[vcount]; for (int a = 0; a < vcount; ++a) { int id = m.meshes[i].indices[a]; render_info.vertex_info[a].TextureCoordinate.X = m.meshes[i].text_coord[id].X; render_info.vertex_info[a].TextureCoordinate.Y = m.meshes[i].text_coord[id].Y; } if (m.part == TMD3Part.HEAD) head_vertices.Add(render_info); else if (m.part == TMD3Part.UPPER) upper_vertices.Add(render_info); else lower_vertices.Add(render_info); } }