commit428243f4a6Author: AsanoRema <asanorema2036@gmail.com> Date: Sat Aug 29 13:43:13 2026 +0300 Squashed commit of the following: commit68e78fa464Author: AsanoRema <asanorema2036@gmail.com> Date: Sat Aug 29 13:41:49 2026 +0300 Updated .gitignore commit9f87122a34Author: AsanoRema <asanorema2036@gmail.com> Date: Sat Aug 29 13:34:57 2026 +0300 Added Dohya commitf6a7547e84Author: AsanoRema <asanorema2036@gmail.com> Date: Fri Aug 21 17:59:13 2026 +0300 Fixed commitb98901c366Author: AsanoRema <asanorema2036@gmail.com> Date: Tue Aug 18 17:37:22 2026 +0300 Added new particle Package commitbb2f4a3b16Author: AsanoRema <asanorema2036@gmail.com> Date: Tue Aug 18 17:17:48 2026 +0300 Map mehanic ready to multiplayer commitc01ff800f6Author: AsanoRema <asanorema2036@gmail.com> Date: Tue Aug 18 16:16:19 2026 +0300 Squashed commit of the following: commit173bbb165cAuthor: henjkey <henjkey@gmail.com> Date: Fri Aug 14 18:51:23 2026 +0500 Mappp commitd559ab338aAuthor: henjkey <henjkey@gmail.com> Date: Thu Aug 13 18:42:41 2026 +0500 Map Controller Coordinates Target System Crosshair System Radar System
39 lines
1.7 KiB
HLSL
39 lines
1.7 KiB
HLSL
// The following comment prevents Unity from auto upgrading the shader. Please keep it to keep backward compatibility.
|
|
// UNITY_SHADER_NO_UPGRADE
|
|
|
|
#ifndef _VLB_SHADER_MATHS_INCLUDED_
|
|
#define _VLB_SHADER_MATHS_INCLUDED_
|
|
|
|
inline float dot2(float2 v) { return dot(v,v); }
|
|
inline float lerpClamped(float a, float b, float t) { return lerp(a, b, saturate(t)); }
|
|
inline float invLerp(float a, float b, float t) { return (t - a) / (b - a); }
|
|
inline float invLerpClamped(float a, float b, float t) { return saturate(invLerp(a, b, t)); }
|
|
inline float fromABtoCD_Clamped(float valueAB, float A, float B, float C, float D) { return lerpClamped(C, D, invLerpClamped(A, B, valueAB)); }
|
|
|
|
// Returns 1.0 if a >= b, 0.0 otherwise
|
|
inline float isEqualOrGreater(float a, float b) { return step(b, a); }
|
|
|
|
// Get signed distance of pos from the plane (normal ; d).
|
|
// Normal should be normalized.
|
|
// If we want to disable this feature, we could set normal and d to 0 (no discard in this case).
|
|
inline float DistanceToPlane(float3 pos, float3 normal, float d) { return dot(normal, pos) + d; }
|
|
|
|
// https://www.iquilezles.org/www/articles/functions/functions.htm
|
|
// A nice choice to remap the 0..1 interval into 0..1, such that the corners are mapped to 0 and the center to 1.
|
|
// In other words, parabola(0) = parabola(1) = 0, and parabola(1/2) = 1.
|
|
inline float parabola( float x, float k )
|
|
{
|
|
return pow( 4.0*x*(1.0-x), k );
|
|
}
|
|
|
|
// https://en.wikipedia.org/wiki/Smoothstep
|
|
inline float smootherstep(float edge0, float edge1, float x)
|
|
{
|
|
// Scale, and clamp x to 0..1 range
|
|
x = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
|
|
// Evaluate polynomial
|
|
return x*x*x*(x*(x * 6 - 15) + 10);
|
|
}
|
|
|
|
#endif
|