Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultMesh"/> class.
 /// </summary>
 public DefaultMesh()
 {
     AddAttribute(PositionName, MeshAttribute.Create <Vector3>());
     Position = GetAttribute(PositionName).GetList <Vector3>();
     AddAttribute(NormalName, MeshAttribute.Create <Vector3>());
     Normal = GetAttribute(NormalName).GetList <Vector3>();
     AddAttribute(TexCoordName, MeshAttribute.Create <Vector2>());
     TexCoord = GetAttribute(TexCoordName).GetList <Vector2>();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds the attribute.
 /// </summary>
 /// <param name="name">The attribute name.</param>
 /// <param name="attribute"></param>
 /// <returns></returns>
 /// <exception cref="ArgumentException"></exception>
 protected void AddAttribute(string name, MeshAttribute attribute)
 {
     if (Contains(name))
     {
         throw new ArgumentException($"Attribute '{name}' already exists");
     }
     if (attribute is null)
     {
         throw new ArgumentNullException(nameof(attribute));
     }
     attributes.Add(name, attribute);
 }