Exemple #1
0
 public void BindAttributes(IChannelAttributeSource channelAttributes)
 {
     foreach (ModelAttribute modelAttribute in attributes)
     {
         ProgramAttribute attribute = channelAttributes.TryGetChannelAttribute(modelAttribute);
         if (attribute != null)
         {
             attribute.Bind(modelAttribute.Buffer, modelAttribute.OffsetInBytes, modelAttribute.Format, modelAttribute.Stride);
         }
     }
 }
        /// <summary>
        /// Bind the vertex declaration to the program.
        /// </summary>
        /// <param name="program"></param>
        /// <param name="mesh"></param>
        /// <param name="stride"></param>
        public void Bind(ModelProgram program, ModelMesh mesh, int stride)
        {
            GraphicsBuffer buffer = Model.Buffer;

            foreach (ModelVertexAttribute attribute in Attributes)
            {
                int offset = attribute.Offset + mesh.BufferDataOffset;
                ProgramAttribute programAttribute = attribute.MatchAttribute(program);

                if (programAttribute != null)
                {
                    programAttribute.Bind(buffer, offset, attribute.GraphicsFormat, stride);
                }
            }
        }