GpuVec2¶
Import: import system.gpu;
This reference lists the public declarations for this part of the library. See Reading API signatures for parameter and result notation. Shader-only declarations can be used only inside shader entry points and helpers reached from them; using them elsewhere is a compile error.
GpuVec2¶
A vector of two floats, laid out like a GPU float2. Use it on the CPU and in shaders alike: in buffers, as shader inputs and outputs, and for texture coordinates. Arithmetic works component by component, and a float operand applies to every component.
x¶
The first component.
y¶
The second component.
constructor¶
Creates the vector (x, y).
constructor¶
Creates a vector with both components equal to value.
dot¶
The dot product: x * other.x + y * other.y.
length¶
The vector's Euclidean length.
normalize¶
The vector scaled to length 1. A zero vector gives non-finite components.