/// <summary> /// /// </summary> /// <param name="op"></param> public void GetRenderOperation(RenderOperation op) { // use LOD subMesh.GetRenderOperation(op, parent.MeshLodIndex); // Deal with any vertex data overrides // if (!hardwareSkinningEnabled) op.vertexData = GetVertexDataForBinding(); }
protected XmlElement WriteSubmesh(SubMesh subMesh) { XmlElement node = document.CreateElement("submesh"); XmlAttribute attr; attr = document.CreateAttribute("material"); attr.Value = subMesh.MaterialName; node.Attributes.Append(attr); attr = document.CreateAttribute("usesharedvertices"); attr.Value = (subMesh.useSharedVertices) ? "true" : "false"; node.Attributes.Append(attr); VertexData vertexData = (subMesh.useSharedVertices) ? mesh.SharedVertexData : subMesh.vertexData; IndexType indexType = IndexType.Size16; if (vertexData.vertexCount > short.MaxValue) indexType = IndexType.Size32; attr = document.CreateAttribute("use32bitindexes"); attr.Value = (indexType == IndexType.Size32) ? "true" : "false"; node.Attributes.Append(attr); bool isTriList = true; // TODO: Support things other than triangle lists attr = document.CreateAttribute("operationtype"); RenderOperation op = new RenderOperation(); subMesh.GetRenderOperation(op); switch (op.operationType) { case OperationType.TriangleList: attr.Value = "triangle_list"; break; case OperationType.TriangleStrip: attr.Value = "triangle_strip"; isTriList = false; break; case OperationType.TriangleFan: attr.Value = "triangle_fan"; isTriList = false; break; default: throw new AxiomException("Export of non triangle lists is not supported"); } node.Attributes.Append(attr); XmlElement childNode; childNode = WriteFaces(subMesh, indexType, isTriList); node.AppendChild(childNode); if (!subMesh.useSharedVertices) { childNode = WriteGeometry(subMesh); node.AppendChild(childNode); } if (subMesh.BoneAssignmentList.Count > 0) { childNode = WriteBoneAssignments(subMesh); node.AppendChild(childNode); } return node; }