private bool GeometryContainsChannel(GeometryContentCollection geometry, string channel) { foreach (var item in geometry) { if (item.Vertices.Channels.Contains(channel)) { return(true); } } return(false); }
public void GenerateVerticesRecursive(NodeContent input) { MeshContent mesh = input as MeshContent; if (mesh != null) { GeometryContentCollection gc = mesh.Geometry; foreach (GeometryContent g in gc) { VertexContent vc = g.Vertices; IndirectPositionCollection ipc = vc.Positions; IndexCollection ic = g.Indices; float[] vertexData = new float[ipc.Count * 3]; for (int i = 0; i < ipc.Count; i++) { Vector3 v0 = ipc[i]; vertexData[(i * 3) + 0] = v0.X; vertexData[(i * 3) + 1] = v0.Y; vertexData[(i * 3) + 2] = v0.Z; } int[] indexData = new int[ic.Count]; for (int j = 0; j < ic.Count; j++) { indexData[j] = ic[j] + indexOffset; } tag.appendVertexData(vertexData); tag.appendIndexData(indexData); indexOffset += ipc.Count; } } foreach (NodeContent child in input.Children) { GenerateVerticesRecursive(child); } }
/// <summary> /// Initializes a new instance of MeshContent. /// </summary> public MeshContent() { geometry = new GeometryContentCollection(this); positions = new PositionCollection(); }