ExpressionType class final
The type of a value in the expression language: its name, how many numbers it has (components) and the dimension they measure.
An open class with constants: float, vec2, vec3, vec4, boolean and texture are the engine's, and a host may make its own with the constructor (a handle it samples, as the material language's texture is).
Equal by all four fields, so a float in meters is not a float in
seconds, and a dimensionless vec3 is vec3.
Constructors
- ExpressionType(String name, int components, {Dimension dimension = Dimension.none, bool isBoolean = false})
-
A type written
name, ofcomponentsnumbers measuringdimension;isBooleanfor a truth value.const
Properties
- components → int
-
How many numbers a value of it has; zero for texture.
final
- dimension → Dimension
-
What its numbers measure; Dimension.none for a pure number.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- isBoolean → bool
-
Whether it is a truth value rather than a number.
final
- isNumeric → bool
-
Whether arithmetic takes it: a number or a vector, of any dimension.
no setter
- name → String
-
How it is written:
float,vec3,bool.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
The name, with the dimension in brackets when it has one:
vec3,float [m·s⁻¹].override -
withDimension(
Dimension other) → ExpressionType -
This type measuring
otherinstead.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
measuring(
Unit unit, {int components = 1}) → ExpressionType -
The type of
componentsnumbers that measure whatunitmeasures.
Constants
- boolean → const ExpressionType
-
A truth value: what a comparison answers and a condition asks. Held as
one number, one for true and nought for false, and not a number to
arithmetic:
(a < b) + 1.0is refused. - float → const ExpressionType
- One number.
-
numeric
→ const Map<
int, ExpressionType> -
The dimensionless numeric types, by how many components they have —
numeric[3]is vec3. Index zero is absent on purpose: there is no zero-component number, and texture taking that slot would make an arithmetic mistake resolve to a texture instead of failing. - texture → const ExpressionType
- A texture slot. Not a value: it can be sampled and nothing else, which is why its components is zero rather than some number of channels.
- vec2 → const ExpressionType
- Two numbers.
- vec3 → const ExpressionType
- Three numbers.
- vec4 → const ExpressionType
- Four numbers.