private void ResizeArrays(int elemCount) { if (_indices.Length != elemCount) { Array.Resize(ref _vertices, VertexLayout.Stride(_mesh) * elemCount); Array.Resize(ref _indices, elemCount); } }
public static void SetVertex(float[] vertexArray, Vector3 position, int vertexIndex) { var stride = VertexLayout.Stride(VertexLayout.Type.Position); vertexArray[stride * vertexIndex + 0] = position.X; vertexArray[stride * vertexIndex + 1] = position.Y; vertexArray[stride * vertexIndex + 2] = position.Z; }
public static void SetVertex(float[] vertexArray, Vector3 position, Vector3 normal, int vertexIndex) { var stride = VertexLayout.Stride(VertexLayout.Type.PositionNormal); vertexArray[stride * vertexIndex + 0] = position.X; vertexArray[stride * vertexIndex + 1] = position.Y; vertexArray[stride * vertexIndex + 2] = position.Z; vertexArray[stride * vertexIndex + 3] = normal.X; vertexArray[stride * vertexIndex + 4] = normal.Y; vertexArray[stride * vertexIndex + 5] = normal.Z; }
private void InitializeVAO(VertexLayout.Type layoutType) { VAO = GL.GenVertexArray(); GL.BindVertexArray(VAO); VertexLayout.SetLayout(VAO, layoutType); }