Пример #1
0
 private void SetVertexAttributes(Shader shader)
 {
     foreach (var pair in attributesByBuffer)
     {
         pair.Key.Bind();
         foreach (var attribute in pair.Value)
         {
             // Invalid names are silently ignored.
             VertexAttributeUtils.SetVertexAttribute(shader, attribute.VertexAttribute, attribute.OffsetInBytes, attribute.StrideInBytes);
         }
     }
 }
Пример #2
0
        private void SetVertexAttributes(Shader shader, List <VertexAttribute> attributes)
        {
            // Calculating the offset requires the list order to match the struct member order.
            int offset = 0;

            foreach (var attribute in attributes)
            {
                if (!VertexAttributeUtils.SetVertexAttribute(shader, attribute, offset, vertexSizeInBytes))
                {
                    OnInvalidAttribSet?.Invoke(this, new AttribSetEventArgs(attribute.Name, attribute.Type, attribute.ValueCount));
                }
                offset += attribute.SizeInBytes;
            }
        }