Skip to content

Latest commit

 

History

History
71 lines (42 loc) · 3.53 KB

File metadata and controls

71 lines (42 loc) · 3.53 KB
layout stdlib-reference

faceforward

Description

Flip vector to face forward, if needed.

Signature

vector<T, N> faceforward<T, N:int>(
    vector<T, N> n,
    vector<T, N> i,
    vector<T, N> ng)
    where T : __BuiltinFloatingPointType;

Generic Parameters

T: __BuiltinFloatingPointType {#typeparam-T}

N : int {#decl-N}

Parameters

n : vector<T, N> {#decl-n}

The vector to orient.

i : vector<T, N> {#decl-i}

The incident vector.

ng : vector<T, N> {#decl-ng}

The geometric normal vector.

Return value

n if the dot product of ng and i is less than 0, otherwise -n.

Availability and Requirements

Defined for the following targets:

hlsl

Available in all stages.

glsl

Available in all stages.

cpp

Available in all stages.

cuda

Available in all stages.

metal

Available in all stages.

wgsl

Available in all stages.

spirv

Available in all stages.