Hellfire
Targeting Target locking Crosshairs Improved HUD schematic feedback Equipment Heat Damage Equipment Disabling
This commit is contained in:
parent
871c978301
commit
fddd485262
100 changed files with 10091 additions and 7885 deletions
34
Assets/Scripts/ServerShared/Noise1D.cs
Normal file
34
Assets/Scripts/ServerShared/Noise1D.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
public static class Noise1D
|
||||
{
|
||||
private const float HASHSCALE = 0.1031f;
|
||||
|
||||
static float hash(float p)
|
||||
{
|
||||
float3 p3 = frac(float3(p) * HASHSCALE);
|
||||
p3 += dot(p3, p3.yzx + 19.19f);
|
||||
return frac((p3.x + p3.y) * p3.z);
|
||||
}
|
||||
|
||||
static float fade(float t) { return t * t * t * (t * (6f* t - 15f) + 10f); }
|
||||
|
||||
static float grad(float hash, float p)
|
||||
{
|
||||
int i = (int)(1e4 * hash);
|
||||
return (i & 1) == 0 ? p : -p;
|
||||
}
|
||||
|
||||
public static float noise(float p)
|
||||
{
|
||||
float pi = floor(p), pf = p - pi, w = fade(pf);
|
||||
return lerp(grad(hash(pi), pf), grad(hash(pi + 1.0f), pf - 1.0f), w) * 2.0f;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue