Reestructura carpetes: src->source, third_party->source/external, shaders->data/shaders
This commit is contained in:
42
data/shaders/creation/creation.frag.msl
Normal file
42
data/shaders/creation/creation.frag.msl
Normal file
@@ -0,0 +1,42 @@
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
|
||||
// Creation by Silexars — Danguafer
|
||||
// MSL port of creation.vk.glsl.
|
||||
|
||||
struct ShadertoyUBO {
|
||||
float iTime;
|
||||
float2 iResolution;
|
||||
};
|
||||
|
||||
struct PassthroughVOut {
|
||||
float4 pos [[position]];
|
||||
float2 uv;
|
||||
};
|
||||
|
||||
fragment float4 creation_fs(PassthroughVOut in [[stage_in]],
|
||||
constant ShadertoyUBO& U [[buffer(0)]]) {
|
||||
float2 fragCoord = in.uv * U.iResolution;
|
||||
float t = U.iTime;
|
||||
float2 r = U.iResolution;
|
||||
|
||||
float3 c = float3(0.0);
|
||||
float l = 0.0;
|
||||
float z = t;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
float2 p = fragCoord / r;
|
||||
float2 uv = p;
|
||||
p -= 0.5;
|
||||
p.x *= r.x / r.y;
|
||||
z += 0.07;
|
||||
l = length(p);
|
||||
float invl = (l > 0.0) ? (1.0 / l) : 0.0;
|
||||
uv += p * invl * (sin(z) + 1.0) * abs(sin(l * 9.0 - z - z));
|
||||
float2 m = fract(uv) - 0.5;
|
||||
float denom = length(m);
|
||||
if (denom < 1e-6) denom = 1e-6;
|
||||
c[i] = 0.01 / denom;
|
||||
}
|
||||
float L = (l > 0.0) ? l : 1.0;
|
||||
return float4(c / L, t);
|
||||
}
|
||||
BIN
data/shaders/creation/creation.frag.spv
Normal file
BIN
data/shaders/creation/creation.frag.spv
Normal file
Binary file not shown.
45
data/shaders/creation/creation.gl.glsl
Normal file
45
data/shaders/creation/creation.gl.glsl
Normal file
@@ -0,0 +1,45 @@
|
||||
// Name: Creation by Silexars
|
||||
// Author: Danguafer
|
||||
// URL: https://www.shadertoy.com/view/XsXXDn
|
||||
#version 330 core
|
||||
precision highp float;
|
||||
|
||||
out vec4 FragColor;
|
||||
in vec2 vUV;
|
||||
uniform vec2 iResolution;
|
||||
uniform float iTime;
|
||||
|
||||
#define t iTime
|
||||
#define r iResolution.xy
|
||||
|
||||
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
|
||||
vec3 c = vec3(0.0);
|
||||
float l;
|
||||
float z = t;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
vec2 uv, p = fragCoord.xy / r;
|
||||
uv = p;
|
||||
p -= 0.5;
|
||||
p.x *= r.x / r.y;
|
||||
z += 0.07;
|
||||
l = length(p);
|
||||
// evitar división por cero
|
||||
float invl = (l > 0.0) ? (1.0 / l) : 0.0;
|
||||
uv += p * invl * (sin(z) + 1.0) * abs(sin(l * 9.0 - z - z));
|
||||
vec2 m = mod(uv, 1.0) - 0.5;
|
||||
float denom = length(m);
|
||||
// evitar división por cero en el denominador
|
||||
if (denom < 1e-6) denom = 1e-6;
|
||||
c[i] = 0.01 / denom;
|
||||
}
|
||||
// si l es cero, usar 1.0 para evitar NaN
|
||||
float L = (l > 0.0) ? l : 1.0;
|
||||
fragColor = vec4(c / L, t);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 fragCoordPixels = vUV * iResolution;
|
||||
vec4 outColor;
|
||||
mainImage(outColor, fragCoordPixels);
|
||||
FragColor = outColor;
|
||||
}
|
||||
45
data/shaders/creation/creation.vk.glsl
Normal file
45
data/shaders/creation/creation.vk.glsl
Normal file
@@ -0,0 +1,45 @@
|
||||
#version 450
|
||||
|
||||
// Name: Creation by Silexars
|
||||
// Author: Danguafer
|
||||
// URL: https://www.shadertoy.com/view/XsXXDn
|
||||
|
||||
layout(location = 0) in vec2 vUV;
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
|
||||
layout(set = 3, binding = 0) uniform ShadertoyUBO {
|
||||
float iTime;
|
||||
vec2 iResolution;
|
||||
};
|
||||
|
||||
#define t iTime
|
||||
#define r iResolution.xy
|
||||
|
||||
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
|
||||
vec3 c = vec3(0.0);
|
||||
float l;
|
||||
float z = t;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
vec2 uv, p = fragCoord.xy / r;
|
||||
uv = p;
|
||||
p -= 0.5;
|
||||
p.x *= r.x / r.y;
|
||||
z += 0.07;
|
||||
l = length(p);
|
||||
float invl = (l > 0.0) ? (1.0 / l) : 0.0;
|
||||
uv += p * invl * (sin(z) + 1.0) * abs(sin(l * 9.0 - z - z));
|
||||
vec2 m = mod(uv, 1.0) - 0.5;
|
||||
float denom = length(m);
|
||||
if (denom < 1e-6) denom = 1e-6;
|
||||
c[i] = 0.01 / denom;
|
||||
}
|
||||
float L = (l > 0.0) ? l : 1.0;
|
||||
fragColor = vec4(c / L, t);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 fragCoordPixels = vUV * iResolution;
|
||||
vec4 outColor;
|
||||
mainImage(outColor, fragCoordPixels);
|
||||
FragColor = outColor;
|
||||
}
|
||||
2
data/shaders/creation/meta.txt
Normal file
2
data/shaders/creation/meta.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Name: Creation by Silexars
|
||||
Author: Danguafer
|
||||
Reference in New Issue
Block a user