public Urho.VertexBuffer.PositionNormalColor[] GetVertextData() { var data = new Urho.VertexBuffer.PositionNormalColor[Vertices.Count]; for (int i = 0; i < Vertices.Count; i++) { var v = Vertices[i]; var n = Normals[i]; Urho.Color clr = Urho.Color.Green; if (Vertices.Count == Colors.Count) { var c = Colors[i]; clr = Urho.Color.FromByteFormat((byte)(c.R * 255), (byte)(c.G * 255), (byte)(c.B * 255), 255); } var d = new Urho.VertexBuffer.PositionNormalColor(); d.Position = new Urho.Vector3(v.X, v.Y, v.Z); d.Normal = new Urho.Vector3(n.X, n.Y, n.Z); d.Color = clr.ToUInt(); data[i] = d; } return(data); }
private static Urho.VertexBuffer.PositionNormalColor[] GetVertextData(List <Vector3> vertices, List <Vector3> normals, List <Color> colors) { var data = new Urho.VertexBuffer.PositionNormalColor[vertices.Count]; for (int i = 0; i < vertices.Count; i++) { var v = vertices[i]; var n = normals[i]; Urho.Color clr = Urho.Color.Green; if (vertices.Count == colors.Count) { clr = colors[i]; } var d = new Urho.VertexBuffer.PositionNormalColor(); d.Position = v; d.Normal = n; d.Color = clr.ToUInt(); data[i] = d; } return(data); }