mirror of
https://github.com/libretro/RetroArch
synced 2025-02-19 12:41:00 +00:00
(D3D11) add the remaining menu shaders.
This commit is contained in:
parent
a2cddb27e5
commit
c0117f077b
@ -293,10 +293,6 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i
|
||||
}
|
||||
|
||||
{
|
||||
static const char shader[] =
|
||||
#include "d3d_shaders/opaque_sm5.hlsl.h"
|
||||
;
|
||||
|
||||
D3D11_INPUT_ELEMENT_DESC desc[] = {
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_vertex_t, position),
|
||||
D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
@ -305,6 +301,11 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i
|
||||
{ "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, offsetof(d3d11_vertex_t, color),
|
||||
D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
|
||||
static const char shader[] =
|
||||
#include "d3d_shaders/opaque_sm5.hlsl.h"
|
||||
;
|
||||
|
||||
if (!d3d11_init_shader(
|
||||
d3d11->device, shader, sizeof(shader), "VSMain", "PSMain", NULL, desc,
|
||||
countof(desc), &d3d11->shaders[VIDEO_SHADER_STOCK_BLEND]))
|
||||
@ -312,11 +313,6 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
static const char shader[] =
|
||||
#include "d3d_shaders/sprite_sm4.hlsl.h"
|
||||
;
|
||||
|
||||
D3D11_INPUT_ELEMENT_DESC desc[] = {
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, offsetof(d3d11_sprite_t, pos),
|
||||
D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
@ -334,6 +330,10 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i
|
||||
D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
|
||||
static const char shader[] =
|
||||
#include "d3d_shaders/sprite_sm4.hlsl.h"
|
||||
;
|
||||
|
||||
if (!d3d11_init_shader(
|
||||
d3d11->device, shader, sizeof(shader), "VSMain", "PSMain", "GSMain", desc,
|
||||
countof(desc), &d3d11->sprites.shader))
|
||||
@ -345,91 +345,65 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i
|
||||
}
|
||||
|
||||
{
|
||||
static const char shader[] =
|
||||
#include "d3d_shaders/ribbon_sm4.hlsl.h"
|
||||
;
|
||||
|
||||
D3D11_INPUT_ELEMENT_DESC desc[] = {
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
|
||||
static const char ribbon[] =
|
||||
#include "d3d_shaders/ribbon_sm4.hlsl.h"
|
||||
;
|
||||
static const char ribbon_simple[] =
|
||||
#include "d3d_shaders/ribbon_simple_sm4.hlsl.h"
|
||||
;
|
||||
|
||||
if (!d3d11_init_shader(
|
||||
d3d11->device, shader, sizeof(shader), "VSMain", "PSMain", NULL, desc,
|
||||
d3d11->device, ribbon, sizeof(ribbon), "VSMain", "PSMain", NULL, desc,
|
||||
countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU]))
|
||||
goto error;
|
||||
}
|
||||
|
||||
{
|
||||
static const char shader[] =
|
||||
#include "d3d_shaders/ribbon_sm4.hlsl.h"
|
||||
;
|
||||
|
||||
D3D11_INPUT_ELEMENT_DESC desc[] = {
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
|
||||
if (!d3d11_init_shader(
|
||||
d3d11->device, shader, sizeof(shader), "VSMain", "PSMain", NULL, desc,
|
||||
d3d11->device, ribbon_simple, sizeof(ribbon_simple), "VSMain", "PSMain", NULL, desc,
|
||||
countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_2]))
|
||||
goto error;
|
||||
}
|
||||
|
||||
{
|
||||
static const char shader[] =
|
||||
#include "d3d_shaders/ribbon_sm4.hlsl.h"
|
||||
;
|
||||
|
||||
D3D11_INPUT_ELEMENT_DESC desc[] = {
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_vertex_t, position),
|
||||
D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_vertex_t, texcoord),
|
||||
D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
|
||||
static const char simple_snow[] =
|
||||
#include "d3d_shaders/simple_snow_sm4.hlsl.h"
|
||||
;
|
||||
static const char snow[] =
|
||||
#include "d3d_shaders/snow_sm4.hlsl.h"
|
||||
;
|
||||
static const char bokeh[] =
|
||||
#include "d3d_shaders/bokeh_sm4.hlsl.h"
|
||||
;
|
||||
static const char snowflake[] =
|
||||
#include "d3d_shaders/snowflake_sm4.hlsl.h"
|
||||
;
|
||||
|
||||
if (!d3d11_init_shader(
|
||||
d3d11->device, shader, sizeof(shader), "VSMain", "PSMain", NULL, desc,
|
||||
d3d11->device, simple_snow, sizeof(simple_snow), "VSMain", "PSMain", NULL, desc,
|
||||
countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_3]))
|
||||
goto error;
|
||||
}
|
||||
|
||||
{
|
||||
static const char shader[] =
|
||||
#include "d3d_shaders/ribbon_sm4.hlsl.h"
|
||||
;
|
||||
|
||||
D3D11_INPUT_ELEMENT_DESC desc[] = {
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
|
||||
if (!d3d11_init_shader(
|
||||
d3d11->device, shader, sizeof(shader), "VSMain", "PSMain", NULL, desc,
|
||||
countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_4]))
|
||||
d3d11->device, snow, sizeof(snow), "VSMain", "PSMain", NULL, desc, countof(desc),
|
||||
&d3d11->shaders[VIDEO_SHADER_MENU_4]))
|
||||
goto error;
|
||||
}
|
||||
|
||||
{
|
||||
static const char shader[] =
|
||||
#include "d3d_shaders/ribbon_sm4.hlsl.h"
|
||||
;
|
||||
|
||||
D3D11_INPUT_ELEMENT_DESC desc[] = {
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
|
||||
if (!d3d11_init_shader(
|
||||
d3d11->device, shader, sizeof(shader), "VSMain", "PSMain", NULL, desc,
|
||||
countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_5]))
|
||||
d3d11->device, bokeh, sizeof(bokeh), "VSMain", "PSMain", NULL, desc, countof(desc),
|
||||
&d3d11->shaders[VIDEO_SHADER_MENU_5]))
|
||||
goto error;
|
||||
}
|
||||
|
||||
{
|
||||
static const char shader[] =
|
||||
#include "d3d_shaders/ribbon_sm4.hlsl.h"
|
||||
;
|
||||
|
||||
D3D11_INPUT_ELEMENT_DESC desc[] = {
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
|
||||
if (!d3d11_init_shader(
|
||||
d3d11->device, shader, sizeof(shader), "VSMain", "PSMain", NULL, desc,
|
||||
d3d11->device, snowflake, sizeof(snowflake), "VSMain", "PSMain", NULL, desc,
|
||||
countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_6]))
|
||||
goto error;
|
||||
}
|
||||
|
41
gfx/drivers/d3d_shaders/bokeh_sm4.hlsl.h
Normal file
41
gfx/drivers/d3d_shaders/bokeh_sm4.hlsl.h
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
#define SRC(src) #src
|
||||
SRC(
|
||||
struct UBO
|
||||
{
|
||||
float4x4 modelViewProj;
|
||||
float2 OutputSize;
|
||||
float time;
|
||||
};
|
||||
uniform UBO global;
|
||||
|
||||
float4 VSMain(float4 position : POSITION, float2 texcoord : TEXCOORD0) : SV_POSITION
|
||||
{
|
||||
return mul(global.modelViewProj, position);
|
||||
}
|
||||
|
||||
float4 PSMain(float4 position : SV_POSITION) : SV_TARGET
|
||||
{
|
||||
float speed = global.time * 4.0;
|
||||
float2 uv = -1.0 + 2.0 * position.xy / global.OutputSize;
|
||||
uv.x *= global.OutputSize.x / global.OutputSize.y;
|
||||
float3 color = float3(0.0, 0.0, 0.0);
|
||||
|
||||
for( int i=0; i < 8; i++ )
|
||||
{
|
||||
float pha = sin(float(i) * 546.13 + 1.0) * 0.5 + 0.5;
|
||||
float siz = pow(sin(float(i) * 651.74 + 5.0) * 0.5 + 0.5, 4.0);
|
||||
float pox = sin(float(i) * 321.55 + 4.1) * global.OutputSize.x / global.OutputSize.y;
|
||||
float rad = 0.1 + 0.5 * siz + sin(pha + siz) / 4.0;
|
||||
float2 pos = float2(pox + sin(speed / 15. + pha + siz), - 1.0 - rad + (2.0 + 2.0 * rad) * frac(pha + 0.3 * (speed / 7.) * (0.2 + 0.8 * siz)));
|
||||
float dis = length(uv - pos);
|
||||
if(dis < rad)
|
||||
{
|
||||
float3 col = lerp(float3(0.194 * sin(speed / 6.0) + 0.3, 0.2, 0.3 * pha), float3(1.1 * sin(speed / 9.0) + 0.3, 0.2 * pha, 0.4), 0.5 + 0.5 * sin(float(i)));
|
||||
color += col.zyx * (1.0 - smoothstep(rad * 0.15, rad, dis));
|
||||
}
|
||||
}
|
||||
color *= sqrt(1.5 - 0.5 * length(uv));
|
||||
return float4(color.r, color.g, color.b , 0.5);
|
||||
};
|
||||
)
|
@ -1,17 +1,24 @@
|
||||
|
||||
#define SRC(src) #src
|
||||
SRC(
|
||||
struct UBO
|
||||
{
|
||||
float4x4 modelViewProj;
|
||||
float2 Outputsize;
|
||||
float time;
|
||||
};
|
||||
uniform UBO global;
|
||||
|
||||
struct PSInput
|
||||
{
|
||||
float4 position : SV_POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
uniform float4x4 modelViewProj;
|
||||
PSInput VSMain(float4 position : POSITION, float2 texcoord : TEXCOORD0, float4 color : COLOR)
|
||||
{
|
||||
PSInput result;
|
||||
result.position = mul(modelViewProj, position);
|
||||
result.position = mul(global.modelViewProj, position);
|
||||
result.texcoord = texcoord;
|
||||
result.color = color;
|
||||
return result;
|
||||
@ -21,6 +28,5 @@ SRC(
|
||||
float4 PSMain(PSInput input) : SV_TARGET
|
||||
{
|
||||
return input.color * t0.Sample(s0, input.texcoord);
|
||||
// return input.color;
|
||||
};
|
||||
)
|
||||
|
51
gfx/drivers/d3d_shaders/ribbon_simple_sm4.hlsl.h
Normal file
51
gfx/drivers/d3d_shaders/ribbon_simple_sm4.hlsl.h
Normal file
@ -0,0 +1,51 @@
|
||||
|
||||
#define SRC(src) #src
|
||||
SRC(
|
||||
|
||||
struct UBO
|
||||
{
|
||||
float4x4 modelViewProj;
|
||||
float2 Outputsize;
|
||||
float time;
|
||||
};
|
||||
uniform UBO global;
|
||||
|
||||
float iqhash(float n)
|
||||
{
|
||||
return frac(sin(n) * 43758.5453);
|
||||
}
|
||||
|
||||
float noise(float3 x)
|
||||
{
|
||||
float3 p = floor(x);
|
||||
float3 f = frac(x);
|
||||
f = f * f * (3.0 - 2.0 * f);
|
||||
float n = p.x + p.y * 57.0 + 113.0 * p.z;
|
||||
return lerp(lerp(lerp(iqhash(n), iqhash(n + 1.0), f.x),
|
||||
lerp(iqhash(n + 57.0), iqhash(n + 58.0), f.x), f.y),
|
||||
lerp(lerp(iqhash(n + 113.0), iqhash(n + 114.0), f.x),
|
||||
lerp(iqhash(n + 170.0), iqhash(n + 171.0), f.x), f.y), f.z);
|
||||
}
|
||||
|
||||
float xmb_noise2(float3 x)
|
||||
{
|
||||
return cos(x.z * 4.0) * cos(x.z + global.time / 10.0 + x.x);
|
||||
}
|
||||
|
||||
float4 VSMain(float2 position : POSITION) : SV_POSITION
|
||||
{
|
||||
float3 v = float3(position.x, 0.0, position.y);
|
||||
float3 v2 = v;
|
||||
v2.x = v2.x + global.time / 2.0;
|
||||
v2.z = v.z * 3.0;
|
||||
v.y = cos((v.x + v.z / 3.0 + global.time) * 2.0) / 10.0 + noise(v2.xyz) / 4.0;
|
||||
v.y = -v.y;
|
||||
|
||||
return float4(v.xy, 0.0, 1.0);
|
||||
}
|
||||
|
||||
float4 PSMain() : SV_TARGET
|
||||
{
|
||||
return float4(0.05, 0.05, 0.05, 1.0);
|
||||
};
|
||||
)
|
89
gfx/drivers/d3d_shaders/simple_snow_sm4.hlsl.h
Normal file
89
gfx/drivers/d3d_shaders/simple_snow_sm4.hlsl.h
Normal file
@ -0,0 +1,89 @@
|
||||
|
||||
#define SRC(src) #src
|
||||
SRC(
|
||||
struct UBO
|
||||
{
|
||||
float4x4 modelViewProj;
|
||||
float2 OutputSize;
|
||||
float time;
|
||||
};
|
||||
uniform UBO global;
|
||||
|
||||
struct PSInput
|
||||
{
|
||||
float4 position : SV_POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
PSInput VSMain(float4 position : POSITION, float2 texcoord : TEXCOORD0)
|
||||
{
|
||||
PSInput result;
|
||||
result.position = mul(global.modelViewProj, position);
|
||||
result.texcoord = texcoord;
|
||||
return result;
|
||||
}
|
||||
|
||||
static const float baseScale = 1.25; // [1.0 .. 10.0]
|
||||
static const float density = 0.5; // [0.01 .. 1.0]
|
||||
static const float speed = 0.15; // [0.1 .. 1.0]
|
||||
|
||||
float rand(float2 co)
|
||||
{
|
||||
return frac(sin(dot(co.xy, float2(12.9898, 78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
float dist_func(float2 distv)
|
||||
{
|
||||
float dist = sqrt((distv.x * distv.x) + (distv.y * distv.y)) * (40.0 / baseScale);
|
||||
dist = clamp(dist, 0.0, 1.0);
|
||||
return cos(dist * (3.14159265358 * 0.5)) * 0.5;
|
||||
}
|
||||
|
||||
float random_dots(float2 co)
|
||||
{
|
||||
float part = 1.0 / 20.0;
|
||||
float2 cd = floor(co / part);
|
||||
float p = rand(cd);
|
||||
|
||||
if (p > 0.005 * (density * 40.0))
|
||||
return 0.0;
|
||||
|
||||
float2 dpos = (float2(frac(p * 2.0) , p) + float2(2.0, 2.0)) * 0.25;
|
||||
|
||||
float2 cellpos = frac(co / part);
|
||||
float2 distv = (cellpos - dpos);
|
||||
|
||||
return dist_func(distv);
|
||||
}
|
||||
|
||||
float snow(float2 pos, float time, float scale)
|
||||
{
|
||||
// add wobble
|
||||
pos.x += cos(pos.y * 1.2 + time * 3.14159 * 2.0 + 1.0 / scale) / (8.0 / scale) * 4.0;
|
||||
// add gravity
|
||||
pos += time * scale * float2(-0.5, 1.0) * 4.0;
|
||||
return random_dots(pos / scale) * (scale * 0.5 + 0.5);
|
||||
}
|
||||
|
||||
|
||||
float4 PSMain(PSInput input) : SV_TARGET
|
||||
{
|
||||
float tim = global.time * 0.4 * speed;
|
||||
float2 pos = input.position.xy / global.OutputSize.xx;
|
||||
pos.y = 1.0 - pos.y; // Flip Y
|
||||
float a = 0.0;
|
||||
// Each of these is a layer of snow
|
||||
// Remove some for better performance
|
||||
// Changing the scale (3rd value) will mess with the looping
|
||||
a += snow(pos, tim, 1.0);
|
||||
a += snow(pos, tim, 0.7);
|
||||
a += snow(pos, tim, 0.6);
|
||||
a += snow(pos, tim, 0.5);
|
||||
a += snow(pos, tim, 0.4);
|
||||
a += snow(pos, tim, 0.3);
|
||||
a += snow(pos, tim, 0.25);
|
||||
a += snow(pos, tim, 0.125);
|
||||
a = a * min(pos.y * 4.0, 1.0);
|
||||
return float4(1.0, 1.0, 1.0, a);
|
||||
};
|
||||
)
|
89
gfx/drivers/d3d_shaders/snow_sm4.hlsl.h
Normal file
89
gfx/drivers/d3d_shaders/snow_sm4.hlsl.h
Normal file
@ -0,0 +1,89 @@
|
||||
|
||||
#define SRC(src) #src
|
||||
SRC(
|
||||
struct UBO
|
||||
{
|
||||
float4x4 modelViewProj;
|
||||
float2 OutputSize;
|
||||
float time;
|
||||
};
|
||||
uniform UBO global;
|
||||
|
||||
struct PSInput
|
||||
{
|
||||
float4 position : SV_POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
PSInput VSMain(float4 position : POSITION, float2 texcoord : TEXCOORD0)
|
||||
{
|
||||
PSInput result;
|
||||
result.position = mul(global.modelViewProj, position);
|
||||
result.texcoord = texcoord;
|
||||
return result;
|
||||
}
|
||||
|
||||
static const float baseScale = 3.5; // [1.0 .. 10.0]
|
||||
static const float density = 0.7; // [0.01 .. 1.0]
|
||||
static const float speed = 0.25; // [0.1 .. 1.0]
|
||||
|
||||
float rand(float2 co)
|
||||
{
|
||||
return frac(sin(dot(co.xy, float2(12.9898, 78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
float dist_func(float2 distv)
|
||||
{
|
||||
float dist = sqrt((distv.x * distv.x) + (distv.y * distv.y)) * (40.0 / baseScale);
|
||||
dist = clamp(dist, 0.0, 1.0);
|
||||
return cos(dist * (3.14159265358 * 0.5)) * 0.5;
|
||||
}
|
||||
|
||||
float random_dots(float2 co)
|
||||
{
|
||||
float part = 1.0 / 20.0;
|
||||
float2 cd = floor(co / part);
|
||||
float p = rand(cd);
|
||||
|
||||
if (p > 0.005 * (density * 40.0))
|
||||
return 0.0;
|
||||
|
||||
float2 dpos = (float2(frac(p * 2.0) , p) + float2(2.0, 2.0)) * 0.25;
|
||||
|
||||
float2 cellpos = frac(co / part);
|
||||
float2 distv = (cellpos - dpos);
|
||||
|
||||
return dist_func(distv);
|
||||
}
|
||||
|
||||
float snow(float2 pos, float time, float scale)
|
||||
{
|
||||
// add wobble
|
||||
pos.x += cos(pos.y * 1.2 + time * 3.14159 * 2.0 + 1.0 / scale) / (8.0 / scale) * 4.0;
|
||||
// add gravity
|
||||
pos += time * scale * float2(-0.5, 1.0) * 4.0;
|
||||
return random_dots(pos / scale) * (scale * 0.5 + 0.5);
|
||||
}
|
||||
|
||||
|
||||
float4 PSMain(PSInput input) : SV_TARGET
|
||||
{
|
||||
float tim = global.time * 0.4 * speed;
|
||||
float2 pos = input.position.xy / global.OutputSize.xx;
|
||||
pos.y = 1.0 - pos.y; // Flip Y
|
||||
float a = 0.0;
|
||||
// Each of these is a layer of snow
|
||||
// Remove some for better performance
|
||||
// Changing the scale (3rd value) will mess with the looping
|
||||
a += snow(pos, tim, 1.0);
|
||||
a += snow(pos, tim, 0.7);
|
||||
a += snow(pos, tim, 0.6);
|
||||
a += snow(pos, tim, 0.5);
|
||||
a += snow(pos, tim, 0.4);
|
||||
a += snow(pos, tim, 0.3);
|
||||
a += snow(pos, tim, 0.25);
|
||||
a += snow(pos, tim, 0.125);
|
||||
a = a * min(pos.y * 4.0, 1.0);
|
||||
return float4(1.0, 1.0, 1.0, a);
|
||||
};
|
||||
)
|
81
gfx/drivers/d3d_shaders/snowflake_sm4.hlsl.h
Normal file
81
gfx/drivers/d3d_shaders/snowflake_sm4.hlsl.h
Normal file
@ -0,0 +1,81 @@
|
||||
|
||||
#define SRC(src) #src
|
||||
SRC(
|
||||
struct UBO
|
||||
{
|
||||
float4x4 modelViewProj;
|
||||
float2 OutputSize;
|
||||
float time;
|
||||
};
|
||||
uniform UBO global;
|
||||
|
||||
float4 VSMain(float4 position : POSITION, float2 texcoord : TEXCOORD0) : SV_POSITION
|
||||
{
|
||||
return mul(global.modelViewProj, position);
|
||||
}
|
||||
|
||||
|
||||
static const float atime = (global.time + 1.0) / 4.0;
|
||||
|
||||
float rand(float2 co)
|
||||
{
|
||||
return frac(sin(dot(co.xy, float2(12.9898, 78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
float rand_float(float x)
|
||||
{
|
||||
return rand(float2(x, 1.0));
|
||||
}
|
||||
|
||||
float snow(float3 pos, float2 uv, float o)
|
||||
{
|
||||
float2 d = (pos.xy - uv);
|
||||
float a = atan(d.y / d.x) + sin(atime*1.0 + o) * 10.0;
|
||||
|
||||
float dist = d.x*d.x + d.y*d.y;
|
||||
|
||||
if(dist < pos.z/400.0)
|
||||
{
|
||||
float col = 0.0;
|
||||
if(sin(a * 8.0) < 0.0)
|
||||
{
|
||||
col=1.0;
|
||||
}
|
||||
if(dist < pos.z/800.0)
|
||||
{
|
||||
col+=1.0;
|
||||
}
|
||||
return col * pos.z;
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
float col(float2 c)
|
||||
{
|
||||
float color = 0.0;
|
||||
for (int i = 1; i < 15; i++)
|
||||
{
|
||||
float o = rand_float(float(i) / 3.0) * 15.0;
|
||||
float z = rand_float(float(i) + 13.0);
|
||||
float x = 1.8 - (3.6) * (rand_float(floor((global.time*((z + 1.0) / 2.0) +o) / 2.0)) + sin(global.time * o /1000.0) / 10.0);
|
||||
float y = 1.0 - fmod((global.time * ((z + 1.0)/2.0)) + o, 2.0);
|
||||
|
||||
color += snow(float3(x,y,z), c, o);
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
float4 PSMain(float4 position : SV_POSITION) : SV_TARGET
|
||||
{
|
||||
float2 uv = position.xy / global.OutputSize.xy;
|
||||
uv = uv * 2.0 - 1.0;
|
||||
float2 p = uv;
|
||||
p.x *= global.OutputSize.x / global.OutputSize.y;
|
||||
p.y =- p.y;
|
||||
|
||||
float c = col(p);
|
||||
return float4(c,c,c,c);
|
||||
};
|
||||
)
|
@ -58,12 +58,10 @@ static void menu_display_d3d11_draw(void* data)
|
||||
{
|
||||
case VIDEO_SHADER_MENU:
|
||||
case VIDEO_SHADER_MENU_2:
|
||||
#if 0
|
||||
case VIDEO_SHADER_MENU_3:
|
||||
case VIDEO_SHADER_MENU_4:
|
||||
case VIDEO_SHADER_MENU_5:
|
||||
case VIDEO_SHADER_MENU_6:
|
||||
#endif
|
||||
d3d11_set_shader(d3d11->ctx, &d3d11->shaders[draw->pipeline.id]);
|
||||
D3D11Draw(d3d11->ctx, draw->coords->vertices, 0);
|
||||
|
||||
@ -157,7 +155,7 @@ static void menu_display_d3d11_draw_pipeline(void* data)
|
||||
D3D11SetBlendState(d3d11->ctx, d3d11->blend_pipeline, NULL, D3D11_DEFAULT_SAMPLE_MASK);
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
|
||||
case VIDEO_SHADER_MENU_3:
|
||||
case VIDEO_SHADER_MENU_4:
|
||||
case VIDEO_SHADER_MENU_5:
|
||||
@ -165,7 +163,6 @@ static void menu_display_d3d11_draw_pipeline(void* data)
|
||||
D3D11SetVertexBuffer(d3d11->ctx, 0, d3d11->frame.vbo, sizeof(d3d11_vertex_t), 0);
|
||||
draw->coords->vertices = 4;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user