GpuVec4¶
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.
GpuVec4¶
A vector of four floats, laid out like a GPU float4, for RGBA colors, clip-space positions and homogeneous coordinates. Use it on the CPU and in shaders alike. Arithmetic works component by component, and a float operand applies to every component.
x¶
The first component, or red.
y¶
The second component, or green.
z¶
The third component, or blue.
w¶
The fourth component, or alpha.
constructor¶
Creates the vector (x, y, z, w).
constructor¶
Creates a vector with every component equal to value.
xy¶
The first two components.
xyz¶
The first three components.
dot¶
The dot product.
length¶
The vector's Euclidean length.
normalize¶
The vector scaled to length 1. A zero vector gives non-finite components.