Skip to content
Shmellyorc edited this page Aug 31, 2026 · 2 revisions

Vect4 is a 4D vector structure with floating-point components for homogeneous coordinates, quaternions, and other four-component spatial calculations.


Fields

Field Type Description
X float The X-component of the vector
Y float The Y-component of the vector
Z float The Z-component of the vector
W float The W-component of the vector

Constructors

// Create from X, Y, Z, and W components
var v1 = new Vect4(10f, 20f, 5f, 1f);

Properties

Property Description
X The X-component of the vector
Y The Y-component of the vector
Z The Z-component of the vector
W The W-component of the vector

Common Use Cases

Use Case Description
Homogeneous coordinates 3D transformations with W component
Quaternions Rotation storage (X, Y, Z, W)
Color with alpha RGBA color values
Shader uniforms 4D vector uniforms for shaders

Shader Usage

Vect4 is commonly used for shader uniforms that require 4D vectors.

// Set a vec4 uniform in a shader
shader.SetUniform("uColor", new Vect4(1f, 0.5f, 0f, 1f));
shader.SetUniform("uQuaternion", new Vect4(0f, 0f, 0f, 1f));
shader.SetUniform("uPosition", new Vect4(10f, 20f, 5f, 1f));

Summary

Vect4 is a simple immutable struct for 4D spatial calculations, commonly used for homogeneous coordinates, quaternions, colors with alpha, and shader uniforms.

Feature Support
X, Y, Z, W components
Homogeneous coordinates
Quaternion storage
Color with alpha
Shader uniform support

Back to Math Library

Clone this wiki locally