diff --git a/engine/rend/shaders/lit_mesh.frag.hlsl b/engine/rend/shaders/lit_mesh.frag.hlsl index fd63573..7407a59 100644 --- a/engine/rend/shaders/lit_mesh.frag.hlsl +++ b/engine/rend/shaders/lit_mesh.frag.hlsl @@ -10,8 +10,8 @@ float4 main(float2 UV : TEXCOORD0, float3 WorldPos: TEXCOORD1) : SV_Target0 { float4 col = pow(Texture.Sample(Sampler, UV), 0.4545); - float SPEEEEEEEEEEEEEED = 0; - float strength = 0.0; + float SPEEEEEEEEEEEEEED = 0.0001 * time; + float strength = 0.00001; col.r = col.r + strength * sin(time * SPEEEEEEEEEEEEEED) * WorldPos.x + strength * cos(time * SPEEEEEEEEEEEEEED) * WorldPos.y; diff --git a/engine/rend/shaders/lit_mesh.frag.json b/engine/rend/shaders/lit_mesh.frag.json index 46ff298..dc0a6a1 100644 --- a/engine/rend/shaders/lit_mesh.frag.json +++ b/engine/rend/shaders/lit_mesh.frag.json @@ -5,11 +5,28 @@ "mode" : "frag" } ], + "types" : { + "_10" : { + "name" : "type.Uniforms", + "members" : [ + { + "name" : "time", + "type" : "float", + "offset" : 0 + } + ] + } + }, "inputs" : [ { "type" : "vec2", "name" : "in.var.TEXCOORD0", "location" : 0 + }, + { + "type" : "vec3", + "name" : "in.var.TEXCOORD1", + "location" : 1 } ], "outputs" : [ @@ -34,5 +51,14 @@ "set" : 2, "binding" : 0 } + ], + "ubos" : [ + { + "type" : "_10", + "name" : "type.Uniforms", + "block_size" : 4, + "set" : 3, + "binding" : 0 + } ] } \ No newline at end of file diff --git a/engine/rend/shaders/meshes.vert.hlsl b/engine/rend/shaders/meshes.vert.hlsl index 3d1f56a..59046e0 100644 --- a/engine/rend/shaders/meshes.vert.hlsl +++ b/engine/rend/shaders/meshes.vert.hlsl @@ -37,7 +37,6 @@ Output main(Input input) output.TexCoord = input.UV; float4 pos = float4(input.Position, 1.0); - pos.y = pos.y - 50; // pos.x += 0.2 * sin(time * 0.5 ) * pos.y * 0.5; // pos.y += 0.2 * cos(time * 0.5 ) * pos.z * 0.5; diff --git a/projects/content/_shaders/dxil/lit_mesh.frag.dxil b/projects/content/_shaders/dxil/lit_mesh.frag.dxil index 7c2a312..c742c37 100644 Binary files a/projects/content/_shaders/dxil/lit_mesh.frag.dxil and b/projects/content/_shaders/dxil/lit_mesh.frag.dxil differ diff --git a/projects/content/_shaders/dxil/meshes.vert.dxil b/projects/content/_shaders/dxil/meshes.vert.dxil index ecdaf5a..304f9a0 100644 Binary files a/projects/content/_shaders/dxil/meshes.vert.dxil and b/projects/content/_shaders/dxil/meshes.vert.dxil differ diff --git a/projects/content/_shaders/msl/lit_mesh.frag.msl b/projects/content/_shaders/msl/lit_mesh.frag.msl index ff5140b..a49c3e9 100644 --- a/projects/content/_shaders/msl/lit_mesh.frag.msl +++ b/projects/content/_shaders/msl/lit_mesh.frag.msl @@ -3,6 +3,11 @@ using namespace metal; +struct type_Uniforms +{ + float time; +}; + struct main0_out { float4 out_var_SV_Target0 [[color(0)]]; @@ -11,14 +16,16 @@ struct main0_out struct main0_in { float2 in_var_TEXCOORD0 [[user(locn0)]]; + float3 in_var_TEXCOORD1 [[user(locn1)]]; }; -fragment main0_out main0(main0_in in [[stage_in]], texture2d Texture [[texture(0)]], sampler Sampler [[sampler(0)]]) +fragment main0_out main0(main0_in in [[stage_in]], constant type_Uniforms& Uniforms [[buffer(0)]], texture2d Texture [[texture(0)]], sampler Sampler [[sampler(0)]]) { main0_out out = {}; - float4 _27 = powr(Texture.sample(Sampler, in.in_var_TEXCOORD0), float4(0.4544999897480010986328125)); - _27.x = _27.x; - out.out_var_SV_Target0 = _27; + float4 _40 = powr(Texture.sample(Sampler, in.in_var_TEXCOORD0), float4(0.4544999897480010986328125)); + float _45 = Uniforms.time * (9.9999997473787516355514526367188e-05 * Uniforms.time); + _40.x = (_40.x + ((9.9999997473787516355514526367188e-06 * sin(_45)) * in.in_var_TEXCOORD1.x)) + ((9.9999997473787516355514526367188e-06 * cos(_45)) * in.in_var_TEXCOORD1.y); + out.out_var_SV_Target0 = _40; return out; } diff --git a/projects/content/_shaders/msl/meshes.vert.msl b/projects/content/_shaders/msl/meshes.vert.msl index 1853618..068f8c4 100644 --- a/projects/content/_shaders/msl/meshes.vert.msl +++ b/projects/content/_shaders/msl/meshes.vert.msl @@ -35,11 +35,10 @@ struct main0_in vertex main0_out main0(main0_in in [[stage_in]], constant type_Uniforms& Uniforms [[buffer(0)]], const device type_StructuredBuffer_Scene& scene [[buffer(1)]], uint gl_InstanceIndex [[instance_id]]) { main0_out out = {}; - float4 _42 = float4(in.in_var_TEXCOORD0, 1.0); - _42.y = in.in_var_TEXCOORD0.y - 50.0; + float4 _41 = float4(in.in_var_TEXCOORD0, 1.0); out.out_var_TEXCOORD0 = in.in_var_TEXCOORD3; - out.out_var_TEXCOORD1 = _42.xyz; - out.gl_Position = Uniforms.ViewProjection * (scene._m0[gl_InstanceIndex].Model * _42); + out.out_var_TEXCOORD1 = _41.xyz; + out.gl_Position = Uniforms.ViewProjection * (scene._m0[gl_InstanceIndex].Model * _41); return out; } diff --git a/projects/content/_shaders/spv/lit_mesh.frag.spv b/projects/content/_shaders/spv/lit_mesh.frag.spv index 82899a9..a67a828 100644 Binary files a/projects/content/_shaders/spv/lit_mesh.frag.spv and b/projects/content/_shaders/spv/lit_mesh.frag.spv differ diff --git a/projects/content/_shaders/spv/meshes.vert.spv b/projects/content/_shaders/spv/meshes.vert.spv index 023dd4c..019eed8 100644 Binary files a/projects/content/_shaders/spv/meshes.vert.spv and b/projects/content/_shaders/spv/meshes.vert.spv differ