faceforward¶
Description¶
Flip vector to face forward, if needed.
Signature¶
vector<T, N> faceforward<T, int N>( vector<T, N> n, vector<T, N> i, vector<T, N> ng) where T : __BuiltinFloatingPointType;
Generic Parameters¶
T: __BuiltinFloatingPointType¶
N : int¶
Parameters¶
n : vector<T, N>¶
The vector to orient.
i : vector<T, N>¶
The incident vector.
ng : vector<T, N>¶
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.
llvm¶
Available in all stages.