Esempio n. 1
0
 private void ResizeArrays(int elemCount)
 {
     if (_indices.Length != elemCount)
     {
         Array.Resize(ref _vertices, VertexLayout.Stride(_mesh) * elemCount);
         Array.Resize(ref _indices, elemCount);
     }
 }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
 private void InitializeVAO(VertexLayout.Type layoutType)
 {
     VAO = GL.GenVertexArray();
     GL.BindVertexArray(VAO);
     VertexLayout.SetLayout(VAO, layoutType);
 }