public virtual void BuildFace(byte brick, Vector3 corner, Vector3 up, Vector3 right, bool reversed) { int index = Vertices.Count; Vertices.Add(corner); Vertices.Add(corner + up); Vertices.Add(corner + up + right); Vertices.Add(corner + right); SetTextureAtlasUv(); if (reversed) { Indices.Add(index + 0); Indices.Add(index + 1); Indices.Add(index + 2); Indices.Add(index + 2); Indices.Add(index + 3); Indices.Add(index + 0); } else { Indices.Add(index + 1); Indices.Add(index + 0); Indices.Add(index + 2); Indices.Add(index + 3); Indices.Add(index + 2); Indices.Add(index + 0); } }
private int GetVertex(string[] faceVertex) { int vertexIndex = int.Parse(faceVertex[0]); if (vertexIndex < 0) { Indices.Add(Indices[Indices.Count + vertexIndex]); } Vector3 position = _vertices[vertexIndex - 1]; int existingIndex; if (_vertexMap.TryGetValue(position, out existingIndex)) { Indices.Add(existingIndex); return(existingIndex); } int newIndex = Vertices.Count; Vertices.Add(position); _vertexMap.Add(position, newIndex); Indices.Add(newIndex); return(newIndex); }
public Face(int index1, int index2, int index3) : this() { Indices.Add(index1); Indices.Add(index2); Indices.Add(index3); }
private void SetSouth() { Vector2 posTexture = Block.GetTextureCord(BlockSide.South); Vertices[8].Position = new Vector3(-0.5f, 0.5f, 0.5f); Vertices[8].TextureCoordinate.X = posTexture.X * div; Vertices[8].TextureCoordinate.Y = (posTexture.Y + 1) * div; Vertices[9].Position = new Vector3(0.5f, 0.5f, 0.5f); Vertices[9].TextureCoordinate.X = (posTexture.X + 1) * div; Vertices[9].TextureCoordinate.Y = (posTexture.Y + 1) * div; Vertices[10].Position = new Vector3(0.5f, -0.5f, 0.5f); Vertices[10].TextureCoordinate.X = (posTexture.X + 1) * div; Vertices[10].TextureCoordinate.Y = posTexture.Y * div; Vertices[11].Position = new Vector3(-0.5f, -0.5f, 0.5f); Vertices[11].TextureCoordinate.X = (posTexture.X + 1) * div; Vertices[11].TextureCoordinate.Y = (posTexture.Y + 1) * div; Indices.Add((short)(count + 0)); Indices.Add((short)(count + 1)); Indices.Add((short)(count + 2)); Indices.Add((short)(count + 0)); Indices.Add((short)(count + 2)); Indices.Add((short)(count + 3)); count = (short)(count + 4); }
private void SetUpBotton() { Vector2 posTexture = Block.GetTextureCord(BlockSide.Botton); Vertices[4].Position = new Vector3(-0.5f, -0.5f, 0.5f); Vertices[4].TextureCoordinate.X = posTexture.X * div; Vertices[4].TextureCoordinate.Y = (posTexture.Y + 1) * div; Vertices[5].Position = new Vector3(0.5f, -0.5f, 0.5f); Vertices[5].TextureCoordinate.X = (posTexture.X + 1) * div; Vertices[5].TextureCoordinate.Y = (posTexture.Y + 1) * div; Vertices[6].Position = new Vector3(0.5f, -0.5f, -0.5f); Vertices[6].TextureCoordinate.X = (posTexture.X + 1) * div; Vertices[6].TextureCoordinate.Y = posTexture.Y * div; Vertices[7].Position = new Vector3(-0.5f, -0.5f, -0.5f); Vertices[7].TextureCoordinate.X = (posTexture.X + 1) * div; Vertices[7].TextureCoordinate.Y = (posTexture.Y + 1) * div; Indices.Add((short)(count + 0)); Indices.Add((short)(count + 1)); Indices.Add((short)(count + 2)); Indices.Add((short)(count + 0)); Indices.Add((short)(count + 2)); Indices.Add((short)(count + 3)); count = (short)(count + 4); }
private void SetEast() { Vector2 posTexture = Block.GetTextureCord(BlockSide.East); Vertices[20].Position = new Vector3(-0.5f, 0.5f, -0.5f); Vertices[20].TextureCoordinate.X = posTexture.X * div; Vertices[20].TextureCoordinate.Y = (posTexture.Y + 1) * div; Vertices[21].Position = new Vector3(-0.5f, 0.5f, 0.5f); Vertices[21].TextureCoordinate.X = (posTexture.X + 1) * div; Vertices[21].TextureCoordinate.Y = (posTexture.Y + 1) * div; Vertices[22].Position = new Vector3(-0.5f, -0.5f, 0.5f); Vertices[22].TextureCoordinate.X = (posTexture.X + 1) * div; Vertices[22].TextureCoordinate.Y = posTexture.Y * div; Vertices[23].Position = new Vector3(-0.5f, -0.5f, -0.5f); Vertices[23].TextureCoordinate.X = (posTexture.X + 1) * div; Vertices[23].TextureCoordinate.Y = (posTexture.Y + 1) * div; Indices.Add((short)(count + 0)); Indices.Add((short)(count + 1)); Indices.Add((short)(count + 2)); Indices.Add((short)(count + 0)); Indices.Add((short)(count + 2)); Indices.Add((short)(count + 3)); count = (short)(count + 4); }
// for trajectories, time series public ViewBuilder createIndicesConnectedLineTopology(float[] linkingField) { //the first member of the Tuple is the index in the index buffer, // the second member is the index in the Vertex Buffer. List<Tuple<int, int>> indexToVertexIndex = new List<Tuple<int, int>>(); int count = 0; int previousIndexCount = 0; for (int i = 0; i < linkingField.Length - 1; i++) { Vector3 n = uvs[i]; n.x = (float)i; uvs[i] = n; if (linkingField[i] == linkingField[i + 1]) { Indices.Add(i); Indices.Add(i + 1); indexToVertexIndex.Add(new Tuple<int, int>(i, i)); indexToVertexIndex.Add(new Tuple<int, int>(i + 1, i + 1)); count++; } else { LineLength.Add(count); count = 0; } } int deltaSizeLast = Indices.Count - previousIndexCount; if (deltaSizeLast > 0) chunkSizeList.Add(deltaSizeLast); return this; }
/// <summary> /// Добавление индексов треугольников. /// </summary> /// <param name="index0"> /// Смещение индекса. /// </param> /// <param name="rows"> /// The number of rows. /// </param> /// <param name="columns"> /// Количество строк. /// </param> /// <param name="isSpherical"> /// если флаг в значение true, то создатуся треугольники сверху и снизу (сферическая сетка). /// </param> public void AddIndices(int index0, int rows, int columns, bool isSpherical = false) { var face = new Face(); for (int i = 0; i < rows - 1; i++) { for (int j = 0; j < columns - 1; j++) { int ij = (i * columns) + j; if (!isSpherical || i > 0) { Indices.Add(index0 + ij); Indices.Add(index0 + ij + 1 + columns); Indices.Add(index0 + ij + 1); face.Indices.Add(index0 + ij); face.Indices.Add(index0 + ij + 1); face.Indices.Add(index0 + ij + 1 + columns); } if (!isSpherical || i < rows - 2) { Indices.Add(index0 + ij + 1 + columns); Indices.Add(index0 + ij); Indices.Add(index0 + ij + columns); face.Indices.Add(index0 + ij + columns); face.Indices.Add(index0 + ij + 1 + columns); face.Indices.Add(index0 + ij); } } } Faces.Add(face); }
private int GetVertex(string[] faceVertex) { int vertexIndex = int.Parse(faceVertex[0]); if (vertexIndex < 0) { Indices.Add(Indices[Indices.Count + vertexIndex]); } Vector3 position = _vertices[vertexIndex - 1]; // Search for a duplicate for (int i = 0; i < Vertices.Count; i++) { if (Vertices[i].Equals(position)) { Indices.Add(i); return(i); } } int newIndex = Vertices.Count; Vertices.Add(position); Indices.Add(newIndex); return(newIndex); }
public void ClosePolyline() { if (!IsPolylineClosed()) { Points.Add(new wPoint(Points[0].X, Points[0].Y, Points[0].Z)); Indices.Add(Indices.Count); } }
public void Process() { Indexing = BeginMode.Triangles; foreach (GeometricObject geometricObj in _identity) { SetPolygonMode(geometricObj.Mode); } if (_polygonMode == GeometricObject.PolygonMode.Quadratic) { Indexing = BeginMode.Quads; } Vector polygonNormal = null; foreach (GeometricObject geometricObj in _identity) { foreach (Polygon polygon in geometricObj.Polygons) { if (_normalPackage == null) { polygonNormal = polygon.GetNormalVec(); } foreach (Coordinate coord in polygon.EdgeCoords) { int vertexIndex = _vertices.FindIndex(vertex => vertex.Coord.Equals(coord)); if (vertexIndex != -1 && _normalPackage == null) { _vertices[vertexIndex].IntegrateNormalVec(polygonNormal); } else { Vertex insert; Color4 color = ColorPackage.DefaultColor; Vector normal = polygonNormal; if (_colorPackage != null) { color = _colorPackage.ColorMap[coord]; } if (_normalPackage != null) { normal = _normalPackage.NormalMap[coord]; } insert = new Vertex(coord, color, normal, Vertex.DefaultJointIndex, Vertex.DefaultJointCoeff); _vertices.Add(insert); vertexIndex = _vertices.Count - 1; } Indices.Add((uint)vertexIndex); } } } foreach (Vertex vertex in _vertices) { Vertices.Add(vertex.GetVertexData()); } BufferData(); _vertices.Clear(); _polygonMode = GeometricObject.PolygonMode.Invalid; }
protected void AddIndex(int index) { if (index > int.MaxValue) { throw new ArgumentOutOfRangeException("index"); } Indices.Add(index); }
public void AddQuadIndices() { Indices.Add((short)(Vertices.Count - 4)); Indices.Add((short)(Vertices.Count - 2)); Indices.Add((short)(Vertices.Count - 3)); Indices.Add((short)(Vertices.Count - 4)); Indices.Add((short)(Vertices.Count - 1)); Indices.Add((short)(Vertices.Count - 2)); }
/// <summary> /// Adds a new index to the primitive model. This should only be called during the initialization process, before /// InitializePrimitive. /// </summary> protected void AddIndex(int index) { if (index > ushort.MaxValue) { throw new ArgumentOutOfRangeException(nameof(index)); } Indices.Add((ushort)index); }
/// <summary> /// Creates the indices for a scatter plot. /// </summary> /// <returns>The indices for a scatter plot.</returns> /// <param name="numberOfPoints">Number of points.</param> private void createIndicesScatterPlot(int numberOfPoints) { Indices.Clear(); Indices.Capacity = numberOfPoints; for (int i = 0; i < numberOfPoints; i++) { Indices.Add(i); } }
/// <summary> /// Добавление грани куба. /// </summary> /// <param name="center"> /// Центр Куба. /// </param> /// <param name="normal"> /// Вектор нормали для грани. /// </param> /// <param name="up"> /// Вектор вверх для грани. /// </param> /// <param name="dist"> /// Расстояние от центра куба до грани. /// </param> /// <param name="width"> /// Ширина грани. /// </param> /// <param name="height"> /// Высота грани. /// </param> void AddCubeFace(Vector3 center, Vector3 normal, Vector3 up, float dist, float width, float height) { var right = Vector3.Cross(normal, up); var n = normal * dist / 2; up *= height / 2; right *= width / 2; var p1 = center + n - up - right; var p2 = center + n - up + right; var p3 = center + n + up + right; var p4 = center + n + up - right; int i0 = Positions.Count; Positions.Add(p1); Positions.Add(p2); Positions.Add(p3); Positions.Add(p4); if (Normals != null) { Normals.Add(normal); Normals.Add(normal); Normals.Add(normal); Normals.Add(normal); } Indices.Add(i0 + 2); Indices.Add(i0 + 1); Indices.Add(i0 + 0); Indices.Add(i0 + 0); Indices.Add(i0 + 3); Indices.Add(i0 + 2); // добавление граней var face = new Face(); face.Indices.Add(i0 + 2); face.Indices.Add(i0 + 1); face.Indices.Add(i0 + 0); face.Indices.Add(i0 + 0); face.Indices.Add(i0 + 3); face.Indices.Add(i0 + 2); Faces.Add(face); // добавление ребер к граням var edge = new Edge(); AddLine(edge, i0 + 0, i0 + 1); AddLine(edge, i0 + 1, i0 + 2); AddLine(edge, i0 + 2, i0 + 3); AddLine(edge, i0 + 3, i0 + 0); //AddLine(edge, i0 + 2, i0 + 1); face.Edges.Add(edge); }
public void Generate() { Float3 center = new(); Float3 vertex = new(); Float3 normal = new(); // generate vertices, normals and uvs for (int j = 0; j <= radialSegments; j++) { for (int i = 0; i <= tubularSegments; i++) { double u = (double)i / tubularSegments * arc; double v = (double)j / radialSegments * Math.PI * 2; // vertex vertex.X = (float)((radius + tube * Math.Cos(v)) * Math.Cos(u)); vertex.Y = (float)((radius + tube * Math.Cos(v)) * Math.Sin(u)); vertex.Z = (float)(tube * Math.Sin(v)); Positions.Add(vertex); // normal center.X = (float)(radius * Math.Cos(u)); center.Y = (float)(radius * Math.Sin(u)); normal = vertex - center; Normals.Add(normal.Normalize); // uv TextureCoordinates.Add(new((float)i / tubularSegments, (float)j / radialSegments, 0.0f)); } } for (int j = 1; j <= radialSegments; j++) { for (int i = 1; i <= tubularSegments; i++) { // indices int a = (tubularSegments + 1) * j + i - 1; int b = (tubularSegments + 1) * (j - 1) + i - 1; int c = (tubularSegments + 1) * (j - 1) + i; int d = (tubularSegments + 1) * j + i; // faces Indices.Add(d); Indices.Add(b); Indices.Add(a); Indices.Add(d); Indices.Add(c); Indices.Add(b); } } }
/// <summary> /// 当前实体数据变成两倍,使单面实体变成双面实体。 /// </summary> public void MakeDoubleSided() { ((List <XYZ>)Points).Capacity = Points.Count * 2; ((List <XYZ>)Normals).Capacity = this.Normals.Count * 2; ((List <UV>)Uvs).Capacity = this.Uvs.Count * 2; ((List <int>)Indices).Capacity = this.Indices.Count * 2; int count = Points.Count; for (int i = 0; i < count; i++) { Points.Add(Points[i]); } int count2 = Normals.Count; for (int j = 0; j < count2; j++) { Normals.Add(Normals[j]); } int count3 = Uvs.Count; for (int k = 0; k < count3; k++) { Uvs.Add(Uvs[k]); } for (int l = 0; l < count2; l++) { Normals[l].Negate(); } int count4 = Indices.Count; for (int m = 0; m < count4; m++) { Indices.Add(Indices[m]); } int value = 0; for (int n = 0; n < count4; n++) { int num = n % 3; if (num != 1) { if (num == 2) { Indices[n] = value; } } else { value = Indices[n]; Indices[n] = Indices[n + 1]; } } }
public wPolyline(List <wPoint> PointSet, bool IsCurveClosed) { Points = PointSet; Indices = Enumerable.Range(0, Points.Count).ToList(); IsClosed = IsCurveClosed; if (IsClosed) { Indices.Add(0); } IsSingle = false; }
public multilingual_unicode_string_list(CacheBase Cache, int Address) { EndianReader Reader = Cache.Reader; Reader.SeekTo(Address); Reader.SeekTo(Address + 32); for (int i = 0; i < 12; i++) { Indices.Add(Reader.ReadUInt16()); Lengths.Add(Reader.ReadUInt16()); } }
public override void Update() { //Clear Positions.Clear(); Indices.Clear(); Normals.Clear(); if (points.Count % 2 != 0) { throw new InvalidOperationException("The number of points should be even."); } var p10 = p1 - p0; var axisY = Vector3.Cross(axisX, p10); axisY.Normalize(); axisX.Normalize(); int index0 = Positions.Count; for (int i = 0; i < points.Count; i++) { var p = points[i]; var d = (axisX * p.X) + (axisY * p.Y); Positions.Add(p0 + d); Positions.Add(p1 + d); if (Normals != null) { d.Normalize(); Normals.Add(d); Normals.Add(d); } } int n = points.Count - 1; for (int i = 0; i < n; i++) { int i0 = index0 + (i * 2); int i1 = i0 + 1; int i2 = i0 + 3; int i3 = i0 + 2; Indices.Add(i0); Indices.Add(i1); Indices.Add(i2); Indices.Add(i2); Indices.Add(i3); Indices.Add(i0); } }
private void ClosePolygon() { int count = Points.Count; if (count < MIN_POINTS) { return; } Points.RemoveAt(count - 1); Indices.Add(count - 2); Indices.Add(0); }
public void AddPolygon(Polygon polygon, List <VertexPositionNormalTexture> vertices, uint surfaceID, List <VertexPositionNormalTextures> outVertices, Dictionary <VertexPositionNormalTextures, short> vertexTable, int textureIdx) { foreach (var idx in polygon.Indices) { var v = new VertexPositionNormalTextures(vertices[idx].Position, vertices[idx].Normal, vertices[idx].TextureCoordinate, textureIdx); if (!vertexTable.TryGetValue(v, out var existingIdx)) { existingIdx = (short)outVertices.Count; vertexTable.Add(v, existingIdx); outVertices.Add(v); } Indices.Add(existingIdx); } }
public void Add(ITriangleMesh mesh, bool weldVerticesBruteForce) { var triangleMesh = mesh as TriangleMesh; if (triangleMesh != null && !weldVerticesBruteForce) { // Special: mesh is TriangleMesh and no welding. if (triangleMesh.Vertices == null) { return; } if (triangleMesh.Indices == null) { return; } if (Vertices == null) { Vertices = new List <Vector3>(triangleMesh.Vertices.Count); } int numberOfNewIndices = triangleMesh.Indices.Count; if (Indices == null) { Indices = new List <int>(numberOfNewIndices); } // Add new vertices. int oldNumberOfVertices = Vertices.Count; Vertices.AddRange(triangleMesh.Vertices); // Add new indices. Add offset to all indices. for (int i = 0; i < numberOfNewIndices; i++) { Indices.Add(triangleMesh.Indices[i] + oldNumberOfVertices); } return; } int numberOfTriangles = mesh.NumberOfTriangles; for (int i = 0; i < numberOfTriangles; i++) { Add(mesh.GetTriangle(i), weldVerticesBruteForce); } }
public ViewBuilder createIndicesLinkedTopology(float[] linkingField, float[] orderField) { //the first member of the Tuple is the index in the index buffer, // the second member is the index in the Vertex Buffer. // Create new list of pairs where Item1 is the linking field, Item2 is the order field List<Tuple<float, float>> pairs = new List<Tuple<float, float>>(); for (int i = 0; i < linkingField.Length; i++) { pairs.Add(new Tuple<float, float>(linkingField[i], orderField[i])); } var sort = pairs.Select((value, index) => new {value, index}).OrderBy(x => x.value.Item1).ThenBy(x => x.value.Item2).ToList(); //float[] sortedLinkingField = sort.Select(x => x.value.Item1).ToArray(); //int[] sortedIndices = sort.Select(x => x.index).ToArray(); List<Tuple<int, int>> indexToVertexIndex = new List<Tuple<int, int>>(); int count = 0; int previousIndexCount = 0; for (int i = 0; i < sort.Count - 1; i++) { Vector3 n = uvs[i]; n.x = (float)i; uvs[i] = n; if (sort[i].value.Item1 == sort[i + 1].value.Item1) { Indices.Add(sort[i].index); Indices.Add(sort[i + 1].index); indexToVertexIndex.Add(new Tuple<int, int>(sort[i].index, sort[i].index)); indexToVertexIndex.Add(new Tuple<int, int>(sort[i + 1].index + 1, sort[i + 1].index + 1)); count++; } else { LineLength.Add(count); count = 0; } } int deltaSizeLast = Indices.Count - previousIndexCount; if (deltaSizeLast > 0) chunkSizeList.Add(deltaSizeLast); return this; }
public void Load() { Foam = TextureFactory.Create(Utils.Utils.GetImageResource <ITerrain>("Landscape.Terrains.foam.jpg"), TextureWrapMode.Repeat); LoadWaveNumbersModerate(); DataTexture.LoadData(SizedInternalFormat.Rgba16f, WaveNumbers); Texture3 = Foam; Texture4 = DataTexture; Texture5 = TextureFactory.Create(Utils.Utils.GetImageResource <ITerrain>("Landscape.Terrains.IKT4l.jpg"), TextureWrapMode.Repeat); for (int i = 0; i < Width; i += 1) { for (int j = 0; j < Height; j += 1) { Vertices[i + j * Width] = new Vbo { Position = new Vector3((float)i, (float)1, (float)j), TexCoord = new Vector2((float)i / Width, (float)j / Height), Normal = new Vector3(0, 1, 0), }; } } for (int i = 0; i < Width - 1; i++) { for (int j = 0; j < Height - 1; j++) { Indices.Add(j * Width + i); Indices.Add(j * Width + i + 1); Indices.Add((j + 1) * Width + i); Indices.Add((j + 1) * Width + i + 1); Indices.Add((j + 1) * Width + i); Indices.Add(j * Width + i + 1); } } indice = Indices.ToArray(); Refraction = FramBufferOBjectFactory.Create(Width, Height); Refraction.Load(); Reflection = FramBufferOBjectFactory.Create(Width, Height); Reflection.Load(); InitWaterShader(); }
/// <summary> /// Adds the index. /// </summary> /// <param name="mnemonic">The mnemonic.</param> /// <param name="unit">The unit.</param> /// <param name="dataType">The data type.</param> /// <param name="increasing">if set to <c>true</c> if data is incresting, false otherwise.</param> /// <param name="isTimeIndex">if set to <c>true</c> if index is time, false otherwise.</param> /// <param name="nullValue">The null value.</param> public void AddIndex(string mnemonic, string unit, string dataType, bool increasing, bool isTimeIndex, string nullValue = null) { if (Indices.Any(x => x.Mnemonic.EqualsIgnoreCase(mnemonic))) { return; } Indices.Add(new ChannelIndexInfo() { Mnemonic = mnemonic, Increasing = increasing, IsTimeIndex = isTimeIndex, Unit = unit, DataType = dataType, NullValue = nullValue }); }
private void GenerateIndices() { Indices.Clear(); for (int i = 0; i < (Width - 1); i++) { for (int j = 0; j < (Height - 1); j++) { Indices.Add(i * Width + j); Indices.Add(i * Width + j + 1); Indices.Add((i + 1) * Width + j); Indices.Add((i + 1) * Width + j + 1); Indices.Add((i + 1) * Width + j); Indices.Add(i * Width + j + 1); } } }
void ProcessLine(string line) { if (line.Length == 0) { return; } string[] parts = line.Split(_lineSplitChars, StringSplitOptions.RemoveEmptyEntries); string command = parts[0]; switch (command) { case "v": _vertices.Add(ToVector3(parts[1], parts[2], parts[3])); break; case "vn": Normals.Add(ToVector3(parts[1], parts[2], parts[3])); break; case "vt": //Texels.Add(ToVector2(parts[1], parts[2])); break; case "f": int numVertices = parts.Length - 1; if (numVertices < 3 || numVertices > 4) { break; } int[] face = new int[numVertices]; face[0] = GetVertex(parts[1].Split(_faceSplitSchars, StringSplitOptions.RemoveEmptyEntries)); face[1] = GetVertex(parts[2].Split(_faceSplitSchars, StringSplitOptions.RemoveEmptyEntries)); face[2] = GetVertex(parts[3].Split(_faceSplitSchars, StringSplitOptions.RemoveEmptyEntries)); if (numVertices == 4) { Indices.Add(face[0]); Indices.Add(face[2]); face[3] = GetVertex(parts[4].Split(_faceSplitSchars, StringSplitOptions.RemoveEmptyEntries)); } break; } }
private void GenerateIndexes(int x, int y, int z) { if (Cells[x, y, z] == null) { return; } int[] edge_indexes = { 0, 3, 8 }; for (int i = 0; i < 3; i++) { Edge e = Cells[x, y, z].Edges[edge_indexes[i]]; bool flipped = e.ValueA < 0; if (e.Vertices.Count > 3) { if (!UseFlatShading) { Indices.Add(e.Vertices[2].Index); Indices.Add(e.Vertices[0].Index); Indices.Add(e.Vertices[1].Index); Indices.Add(e.Vertices[1].Index); Indices.Add(e.Vertices[3].Index); Indices.Add(e.Vertices[2].Index); } else { AddFlatTriangle(flipped, e.Vertices[0].Index, e.Vertices[1].Index, e.Vertices[2].Index, e.Vertices[3].Index); } } else if (e.Vertices.Count == 3) { if (!UseFlatShading) { Indices.Add(e.Vertices[0].Index); Indices.Add(e.Vertices[1].Index); Indices.Add(e.Vertices[2].Index); } else { AddFlatTriangle(flipped, e.Vertices[0].Index, e.Vertices[1].Index, e.Vertices[2].Index); } } } }