RetroArch
ribbon_simple_sm4.hlsl.h
Go to the documentation of this file.
1 
2 #define SRC(...) #__VA_ARGS__
3 SRC(
4 
5  struct UBO
6  {
7  float4x4 modelViewProj;
8  float2 Outputsize;
9  float time;
10  };
11  uniform UBO global;
12 
13  float iqhash(float n)
14  {
15  return frac(sin(n) * 43758.5453);
16  }
17 
18  float noise(float3 x)
19  {
20  float3 p = floor(x);
21  float3 f = frac(x);
22  f = f * f * (3.0 - 2.0 * f);
23  float n = p.x + p.y * 57.0 + 113.0 * p.z;
24  return lerp(lerp(lerp(iqhash(n), iqhash(n + 1.0), f.x),
25  lerp(iqhash(n + 57.0), iqhash(n + 58.0), f.x), f.y),
26  lerp(lerp(iqhash(n + 113.0), iqhash(n + 114.0), f.x),
27  lerp(iqhash(n + 170.0), iqhash(n + 171.0), f.x), f.y), f.z);
28  }
29 
30  float xmb_noise2(float3 x)
31  {
32  return cos(x.z * 4.0) * cos(x.z + global.time / 10.0 + x.x);
33  }
34 
35  float4 VSMain(float2 position : POSITION) : SV_POSITION
36  {
37  float3 v = float3(position.x, 0.0, position.y);
38  float3 v2 = v;
39  v2.x = v2.x + global.time / 2.0;
40  v2.z = v.z * 3.0;
41  v.y = cos((v.x + v.z / 3.0 + global.time) * 2.0) / 10.0 + noise(v2.xyz) / 4.0;
42  v.y = -v.y;
43 
44  return float4(v.xy, 0.0, 1.0);
45  }
46 
47  float4 PSMain() : SV_TARGET
48  {
49  return float4(0.05, 0.05, 0.05, 1.0);
50  };
51 )
GLfloat f
Definition: glext.h:8207
#define floor(x)
Definition: math.h:25
GLfloat GLfloat GLfloat v2
Definition: glext.h:6703
time_t time(time_t *timer)
GLint GLint GLint GLint GLint x
Definition: glext.h:6295
GLfloat GLfloat p
Definition: glext.h:9809
#define SRC(...)
Definition: ribbon_simple_sm4.hlsl.h:2
#define sin(x)
Definition: math.h:23
const GLdouble * v
Definition: glext.h:6391
#define cos(x)
Definition: math.h:21
Definition: retroarch.h:240
GLdouble n
Definition: glext.h:8396