mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Format files to remove trailing spaces (#3384)
This commit is contained in:
@@ -22,7 +22,7 @@ mat3 cotangentFrame(vec3 N, vec3 p, vec2 uv)
|
||||
vec3 dp1perp = cross(N, dp1);
|
||||
vec3 T = dp2perp * duv1.x + dp1perp * duv2.x;
|
||||
vec3 B = dp2perp * duv1.y + dp1perp * duv2.y;
|
||||
|
||||
|
||||
// construct a scale-invariant frame
|
||||
float invMax = inversesqrt(max(dot(T,T), dot(B,B)));
|
||||
return mat3(T*invMax, B*invMax, N);
|
||||
@@ -34,13 +34,13 @@ void main()
|
||||
|
||||
// get vertex normal
|
||||
vec3 normal = normalize(v_normal);
|
||||
|
||||
|
||||
// get normal map normal, unpack, and calculate z
|
||||
vec3 normalMap;
|
||||
normalMap.xy = texture2D(s_normal, v_texcoord0).xy;
|
||||
normalMap.xy = normalMap.xy * 2.0 - 1.0;
|
||||
normalMap.z = sqrt(1.0 - dot(normalMap.xy, normalMap.xy));
|
||||
|
||||
|
||||
// swap x and y, because the brick texture looks flipped, don't copy this...
|
||||
normalMap.xy = normalMap.yx;
|
||||
|
||||
@@ -48,7 +48,7 @@ void main()
|
||||
vec3 pos = v_texcoord1.xyz; // contains world space pos
|
||||
mat3 TBN = cotangentFrame(normal, pos, v_texcoord0);
|
||||
vec3 bumpedNormal = normalize(instMul(TBN, normalMap));
|
||||
|
||||
|
||||
// need some proxy for roughness value w/o roughness texture
|
||||
// assume horizontal (blue) normal map is smooth, and then
|
||||
// modulate with albedo for some higher frequency detail
|
||||
|
||||
@@ -46,7 +46,7 @@ vec2 float32x3_to_oct(vec3 v) {
|
||||
|
||||
// Project the sphere onto the octahedron, and then onto the xy plane
|
||||
vec2 p = v.xy * (1.0 / (abs(v.x) + abs(v.y) + abs(v.z)));
|
||||
|
||||
|
||||
// Reflect the folds of the lower hemisphere over the diagonals
|
||||
return (v.z <= 0.0) ? ((1.0 - abs(p.yx)) * signNotZero(p)) : p;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user