Search across packages, versions, files, declarations, and comments. Use multiple terms to narrow results (AND), and add @vertex, @fragment, or @compute to filter by shader stage.

Constants

PI

#
const PI: f32 = 3.141592653589793

PI_2

#
const PI_2: f32 = 6.283185307179586

HALF_PI

#
const HALF_PI: f32 = 1.57079632679

FRAC_PI_3

#
const FRAC_PI_3: f32 = 1.0471975512

E

#
const E: f32 = 2.718281828459045

Functions

affine2_to_square

#
fn affine2_to_square (
affine: mat3x2<f32>
) -> mat3x3<f32>

affine3_to_square

#
fn affine3_to_square (
affine: mat3x4<f32>
) -> mat4x4<f32>

mat2x4_f32_to_mat3x3_unpack

#
fn mat2x4_f32_to_mat3x3_unpack (
a: mat2x4<f32>
, 
b: f32
) -> mat3x3<f32>

affine3_to_mat3x3

#

Extracts the square portion of an affine matrix: i.e. discards the translation.

fn affine3_to_mat3x3 (
affine: mat4x3<f32>
) -> mat3x3<f32>

inverse_mat3x3

#

Returns the inverse of a 3x3 matrix.

fn inverse_mat3x3 (
matrix: mat3x3<f32>
) -> mat3x3<f32>

inverse_affine3

#

mat4x4_to_mat3x3

#

Extracts the upper 3x3 portion of a 4x4 matrix.

fn mat4x4_to_mat3x3 (
m: mat4x4<f32>
) -> mat3x3<f32>

copysign

#

Copy the sign bit from B onto A. copysign allows proper handling of negative zero to match the rust implementation of orthonormalize

fn copysign (
a: f32
, 
b: f32
) -> f32

orthonormalize

#

https://jcgt.org/published/0006/01/01/paper.pdf this method of constructing a basis from a vec3 is also used by glam::Vec3::any_orthonormal_pair the construction of the orthonormal basis up and right vectors here needs to precisely match the rust implementation in bevy_light/spot_light.rs:spot_light_world_from_view

fn orthonormalize (
z_basis: vec3<f32>
) -> mat3x3<f32>

quat_rotate

#

Rotates a direction by a rotation quaternion q.

fn quat_rotate (
q: vec4<f32>
, 
dir: vec3<f32>
) -> vec3<f32>

sphere_intersects_plane_half_space

#

This is used for frustum culling.

fn sphere_intersects_plane_half_space (
plane: vec4<f32>
, 
sphere_center: vec4<f32>
, 
sphere_radius: f32
) -> bool

ray_sphere_intersect

#

Returns vec2(t0, t1). If there is no intersection, returns vec2(-1.0).

fn ray_sphere_intersect (
r: f32
, 
mu: f32
, 
sphere_radius: f32
) -> vec2<f32>

powsafe

#

pow() but safe for NaNs/negatives

fn powsafe (
color: vec3<f32>
, 
power: f32
) -> vec3<f32>

project_onto

#

fast_acos

#

Slightly less accurate than fast_acos_4, but much simpler.

fn fast_acos (
in_x: f32
) -> f32

fast_acos_4

#

4th order polynomial approximation 4 VGRP, 16 ALU Full Rate 7 * 10^-5 radians precision Reference : Handbook of Mathematical Functions (chapter : Elementary Transcendental Functions), M. Abramowitz and I.A. Stegun, Ed.

fn fast_acos_4 (
x: f32
) -> f32

fast_atan2

#
fn fast_atan2 (
y: f32
, 
x: f32
) -> f32
Contents