Ejemplo n.º 1
0
        /// <summary>
        ///		Returns proper enum for a base type multiplied by a value.  This is helpful
        ///		when working with tex coords especially since you might not know the number
        ///		of texture dimensions at runtime, and when creating the VertexBuffer you will
        ///		have to get a VertexElementType based on that amount to creating the VertexElement.
        /// </summary>
        /// <param name="type">Data type.</param>
        /// <param name="count">Multiplier.</param>
        /// <returns>
        ///     A <see cref="VertexElementType"/> that represents the requested type and count.
        /// </returns>
        /// <example>
        ///     MultiplyTypeCount(VertexElementType.Float1, 3) returns VertexElementType.Float3.
        /// </example>
        public static VertexElementType MultiplyTypeCount(VertexElementType type, int count)
        {
            switch (type)
            {
            case VertexElementType.Float1:
                switch (count)
                {
                case 1:
                    return(VertexElementType.Float1);

                case 2:
                    return(VertexElementType.Float2);

                case 3:
                    return(VertexElementType.Float3);

                case 4:
                    return(VertexElementType.Float4);
                }
                break;

            case VertexElementType.Short1:
                switch (count)
                {
                case 1:
                    return(VertexElementType.Short1);

                case 2:
                    return(VertexElementType.Short2);

                case 3:
                    return(VertexElementType.Short3);

                case 4:
                    return(VertexElementType.Short4);
                }
                break;
            }

            throw new Exception("Cannot multiply base vertex element type: " + type.ToString());
        }
Ejemplo n.º 2
0
 public ElementTypeNotSupported(VertexElementType elementType)
     : base(elementType.ToString())
 {
 }
Ejemplo n.º 3
0
		/// <summary>
		///		Returns proper enum for a base type multiplied by a value.  This is helpful
		///		when working with tex coords especially since you might not know the number
		///		of texture dimensions at runtime, and when creating the VertexBuffer you will
		///		have to get a VertexElementType based on that amount to creating the VertexElement.
		/// </summary>
		/// <param name="type">Data type.</param>
		/// <param name="count">Multiplier.</param>
		/// <returns>
		///     A <see cref="VertexElementType"/> that represents the requested type and count.
		/// </returns>
		/// <example>
		///     MultiplyTypeCount(VertexElementType.Float1, 3) returns VertexElementType.Float3.
		/// </example>
		public static VertexElementType MultiplyTypeCount( VertexElementType type, int count )
		{
			switch ( type )
			{
				case VertexElementType.Float1:
					switch ( count )
					{
						case 1:
							return VertexElementType.Float1;
						case 2:
							return VertexElementType.Float2;
						case 3:
							return VertexElementType.Float3;
						case 4:
							return VertexElementType.Float4;
					}
					break;

				case VertexElementType.Short1:
					switch ( count )
					{
						case 1:
							return VertexElementType.Short1;
						case 2:
							return VertexElementType.Short2;
						case 3:
							return VertexElementType.Short3;
						case 4:
							return VertexElementType.Short4;
					}
					break;
			}

			throw new Exception( "Cannot multiply base vertex element type: " + type.ToString() );
		}
			public ElementUsageNotSupported(VertexElementType elementType)
				: base(elementType.ToString()) {}