Base type for all types.
Inheritance: Xenko.Core.Shaders.Ast.Node, IAttributes, ITypeInferencer, IQualifiers
Example #1
0
 public static bool HasDimensions(TypeBase typeDeclaration)
 {
     return (typeDeclaration is ScalarType) || (typeDeclaration is VectorType) || (typeDeclaration is MatrixType);
 }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ArrayType"/> class.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="dimensions">The dimensions.</param>
 public ArrayType(TypeBase type, params Expression[] dimensions) : base("$array")
 {
     Type       = type;
     Dimensions = new List <Expression>();
     Dimensions.AddRange(dimensions);
 }
Example #3
0
 public static TypeBase GetBaseType(TypeBase type)
 {
     if (type is MatrixType) return ((MatrixType)type).Type;
     if (type is VectorType) return ((VectorType)type).Type;
     return type;
 }
Example #4
0
 /// <summary>
 /// Determines whether the specified type is an integer.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <returns>
 ///   <c>true</c> if the specified type is an integer; otherwise, <c>false</c>.
 /// </returns>
 public static bool IsInteger(TypeBase type)
 {
     return(type == Int || type == UInt);
 }
Example #5
0
 /// <summary>
 /// Determines whether the specified type is a float/half/double.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <returns>
 ///   <c>true</c> if the specified type is float/half/double; otherwise, <c>false</c>.
 /// </returns>
 public static bool IsFloat(TypeBase type)
 {
     return(type == Float || type == Double || type == Half);
 }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Parameter"/> class.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="name">The name.</param>
 /// <param name="initialValue">The initial value.</param>
 public Parameter(TypeBase type, string name = null, Expression initialValue = null)
     : base(type, name, initialValue)
 {
 }
Example #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TypeName"/> class.
 /// </summary>
 /// <param name="typeBase">The type base.</param>
 public TypeName(TypeBase typeBase)
     : base(typeBase.Name)
 {
     TypeInference.TargetType = typeBase;
 }
Example #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MethodDefinition"/> class.
 /// </summary>
 /// <param name="returntype">The returntype.</param>
 /// <param name="name">The name.</param>
 public MethodDefinition(TypeBase returntype, string name) : this()
 {
     ReturnType  = returntype;
     Name        = new Identifier(name);
     declaration = this;
 }