Reestructura carpetes: src->source, third_party->source/external, shaders->data/shaders

This commit is contained in:
2026-05-04 13:21:34 +02:00
parent cec347a97c
commit e51ee84167
82 changed files with 36 additions and 39 deletions

View File

@@ -0,0 +1,2 @@
Name: Test
Author: JailDesigner

View File

@@ -0,0 +1,36 @@
#include <metal_stdlib>
using namespace metal;
// Test shader (Metal Shading Language port of test.vk.glsl).
// Author: JailDesigner
struct ShadertoyUBO {
float iTime;
float2 iResolution;
};
struct PassthroughVOut {
float4 pos [[position]];
float2 uv;
};
static float3 palette(float t) {
float3 a = float3(1.0, 0.5, 0.5);
float3 b = float3(1.0, 0.5, 0.5);
float3 c = float3(1.0, 1.0, 1.0);
float3 d = float3(0.263, 0.416, 0.557);
return a + b * cos(6.28318 * (c * t * d));
}
fragment float4 test_fs(PassthroughVOut in [[stage_in]],
constant ShadertoyUBO& u [[buffer(0)]]) {
float2 fragCoord = in.uv * u.iResolution;
float2 uv = (fragCoord * 2.0 - u.iResolution) / u.iResolution.y;
float d = length(uv);
float3 col = palette(d);
d = sin(d * 8.0 + u.iTime) / 8.0;
d = abs(d);
d = 0.02 / d;
col *= d;
return float4(col, 1.0);
}

Binary file not shown.

View File

@@ -0,0 +1,34 @@
// Name: Test
// Author: JailDesigner
#version 330 core
out vec4 FragColor;
in vec2 vUV;
uniform vec2 iResolution;
uniform float iTime;
vec3 palette( float t) {
vec3 a = vec3(1.0, 0.5, 0.5);
vec3 b = vec3(1.0, 0.5, 0.5);
vec3 c = vec3(1.0, 1.0, 1.0);
vec3 d = vec3(0.263, 0.416, 0.557);
return a + b * cos( 6.28318 * (c * t * d) );
}
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 uv = (fragCoord * 2.0 - iResolution.xy) / iResolution.y;
float d = length(uv);
vec3 col = palette(d);
d = sin(d * 8.0 + iTime) / 8.0;
d = abs(d);
d = 0.02 / d;
col *= d;
fragColor = vec4(col, 1.0);
}
void main() {
vec2 fragCoordPixels = vUV * iResolution;
vec4 outColor;
mainImage(outColor, fragCoordPixels);
FragColor = outColor;
}

View File

@@ -0,0 +1,42 @@
#version 450
// Name: Test
// Author: JailDesigner
//
// Vulkan port of test.gl.glsl. Bindings follow the SDL3 GPU convention:
// set=3, binding=0 — fragment uniform buffer (anonymous block: members
// are accessible directly as iTime / iResolution, like Shadertoy).
layout(location = 0) in vec2 vUV;
layout(location = 0) out vec4 FragColor;
layout(set = 3, binding = 0) uniform ShadertoyUBO {
float iTime;
vec2 iResolution;
};
vec3 palette(float t) {
vec3 a = vec3(1.0, 0.5, 0.5);
vec3 b = vec3(1.0, 0.5, 0.5);
vec3 c = vec3(1.0, 1.0, 1.0);
vec3 d = vec3(0.263, 0.416, 0.557);
return a + b * cos(6.28318 * (c * t * d));
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord * 2.0 - iResolution) / iResolution.y;
float d = length(uv);
vec3 col = palette(d);
d = sin(d * 8.0 + iTime) / 8.0;
d = abs(d);
d = 0.02 / d;
col *= d;
fragColor = vec4(col, 1.0);
}
void main() {
vec2 fragCoordPixels = vUV * iResolution;
vec4 outColor;
mainImage(outColor, fragCoordPixels);
FragColor = outColor;
}