4 using System.Collections.Generic;
6 namespace SiliconStudio.Shaders.Ast
13 #region Constructors and Destructors
29 : this(name != null ? new
Identifier(name) : null)
31 Name = name != null ?
new Identifier(name) : null;
32 Attributes =
new List<AttributeBase>();
33 Qualifiers = Qualifier.None;
46 Attributes =
new List<AttributeBase>();
47 Qualifiers = Qualifier.None;
53 #region Public Properties
61 public List<AttributeBase> Attributes {
get; set; }
93 public bool IsBuiltIn {
get; set; }
103 return TypeInference.TargetType ??
this;
108 #region Public Methods
119 return new MatrixType(newBaseType, ((MatrixType)type).RowCount, ((MatrixType)type).ColumnCount);
122 return new VectorType(newBaseType, ((VectorType)type).Dimension);
129 if (type is
MatrixType)
return ((MatrixType)type).Type;
130 if (type is
VectorType)
return ((VectorType)type).Type;
143 if (dimension != 1)
return 1;
144 return ((VectorType)typeDeclaration).Dimension;
149 var matrixType = (MatrixType)typeDeclaration;
150 return dimension == 0 ? matrixType.RowCount : matrixType.ColumnCount;
167 if (ReferenceEquals(null, other))
172 if (ReferenceEquals(
this, other))
177 return Equals(other.
Name, Name);
191 if (ReferenceEquals(null, obj))
196 if (ReferenceEquals(
this, obj))
201 if (!typeof(
TypeBase).IsAssignableFrom(obj.GetType()))
217 return Name.GetHashCode();
228 return Name.ToString();
245 return Equals(left, right);
258 return !Equals(left, right);
Base class for all vector types
TypeBase()
Initializes a new instance of the TypeBase class.
override bool Equals(object obj)
Determines whether the specified System.Object is equal to this instance.
TypeBase(Identifier name)
Initializes a new instance of the TypeBase class.
virtual TypeBase ResolveType()
Resolves the type.
static bool HasDimensions(TypeBase typeDeclaration)
Base interface for all node providing qualifiers.
TypeBase(string name)
Initializes a new instance of the TypeBase class.
static TypeBase CreateWithBaseType(TypeBase type, ScalarType newBaseType)
Creates a type based on a new base type. If type is a matrix or vector, then the base type is changed...
bool Equals(TypeBase other)
Equalses the specified other.
override int GetHashCode()
Returns a hash code for this instance.
static TypeBase GetBaseType(TypeBase type)
A tag interface for an object referencing a type.
static int GetDimensionSize(TypeBase typeDeclaration, int dimension)
override string ToString()
Returns a System.String that represents this instance.
Identifier Name
Gets or sets the type name.