|
@@ -162,13 +162,13 @@ is another vector type (or scalar). This is easier shown than explained:
|
|
vec4 a = vec4(0.0, 1.0, 2.0, 3.0);
|
|
vec4 a = vec4(0.0, 1.0, 2.0, 3.0);
|
|
vec3 b = a.rgb; // Creates a vec3 with vec4 components.
|
|
vec3 b = a.rgb; // Creates a vec3 with vec4 components.
|
|
vec3 b = a.ggg; // Also valid; creates a vec3 and fills it with a single vec4 component.
|
|
vec3 b = a.ggg; // Also valid; creates a vec3 and fills it with a single vec4 component.
|
|
- vec3 b = a.bgr; // Order does not matter.
|
|
|
|
|
|
+ vec3 b = a.bgr; // "b" will be vec3(2.0, 1.0, 0.0).
|
|
vec3 b = a.xyz; // Also rgba, xyzw are equivalent.
|
|
vec3 b = a.xyz; // Also rgba, xyzw are equivalent.
|
|
vec3 b = a.stp; // And stpq (for texture coordinates).
|
|
vec3 b = a.stp; // And stpq (for texture coordinates).
|
|
float c = b.w; // Invalid, because "w" is not present in vec3 b.
|
|
float c = b.w; // Invalid, because "w" is not present in vec3 b.
|
|
vec3 c = b.xrt; // Invalid, mixing different styles is forbidden.
|
|
vec3 c = b.xrt; // Invalid, mixing different styles is forbidden.
|
|
b.rrr = a.rgb; // Invalid, assignment with duplication.
|
|
b.rrr = a.rgb; // Invalid, assignment with duplication.
|
|
- b.bgr = a.rgb; // Valid assignment.
|
|
|
|
|
|
+ b.bgr = a.rgb; // Valid assignment. "b"'s "blue" component will be "a"'s "red" and vice versa.
|
|
|
|
|
|
Precision
|
|
Precision
|
|
~~~~~~~~~
|
|
~~~~~~~~~
|