diff options
| author | vimene <vincent.menegaux@gmail.com> | 2026-02-15 15:11:49 +0100 |
|---|---|---|
| committer | vimene <vincent.menegaux@gmail.com> | 2026-02-15 15:11:49 +0100 |
| commit | 7536dd705d121ed3a49b7e4b05af88fd241d1674 (patch) | |
| tree | 5ed271fd91c76360319e49c79883f969fafad283 /src/shaders/shader.slang | |
| parent | 950f577a5b82c72fd2acdfa81cbac1db3f177fc6 (diff) | |
| download | engine-7536dd705d121ed3a49b7e4b05af88fd241d1674.tar.gz | |
more improvements in builds setup
- moved slang shaders to spvshaders to separate software and hardware
shaders
- split Makefile.am into Makefile.am, src/Makefile.am and
src/spvshaders/Makefile.am
- build shaders as DATA primary, instead of both PROGRAMS and SCRIPTS,
which greatly simplifies building. Before that, we had to first build
them as PROGRAMS, and then copy them as SCRIPTS to remove executable
extensions (i.e. ".exe" for Windows)
- changed final executable dir from enginedir to bindir, which makes
automake see it as an exec instead of data
- compute relative paths from C++, which makes it possible to change
dirs arbitrarily when running make while still having a relocatable
executable
- updated README.md to reflect changes in dirs
- use AX_COMPARE_VERSION() to simplify checking if Vulkan headers
version is correct
- factored out most of paths computation in engine::path_utils::Paths
Diffstat (limited to 'src/shaders/shader.slang')
| -rw-r--r-- | src/shaders/shader.slang | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/src/shaders/shader.slang b/src/shaders/shader.slang deleted file mode 100644 index 245df4b..0000000 --- a/src/shaders/shader.slang +++ /dev/null @@ -1,48 +0,0 @@ -struct VertexInput { - float3 pos; - float3 normal; - float2 uv; -}; - -struct UniformBuffer { - float4x4 model, view, proj, inv_view; -}; - -ConstantBuffer<UniformBuffer> ubo; - -struct VertexOutput { - float4 pos : SV_Position; - float3 world_loc; - float3 normal; - float2 uv; -}; - -[shader("vertex")] -VertexOutput vert_main(VertexInput vi) { - VertexOutput vo; - float4 world_loc = mul(ubo.model, float4(vi.pos, 1.)); - vo.pos = mul(ubo.proj, mul(ubo.view, world_loc)); - vo.world_loc = world_loc.xyz; - vo.normal = mul(ubo.model, float4(vi.normal, 0.)).xyz; - vo.uv = vi.uv; - return vo; -} - -Sampler2D texture; - -[shader("fragment")] -float4 frag_main(VertexOutput vo) : SV_Target { - // float3 u = vo.world_loc - (ubo.inv_view * float4(0., 0., 0., 1.)).xyz; - // float u_len_sq = dot(u, u); - // u = normalize(u); - // float attenuation = dot(mul(ubo.inv_view, float4(0., 0., -1., 0.)).xyz, u); - // if (attenuation < .7) attenuation = 0.f; - // else if (attenuation > .8) attenuation = 1.; - // else attenuation = (attenuation - .7) / .1; - // float light = -dot(vo.normal, u) / u_len_sq; - // if (light < 0.) light = 0.; - // float final_light = .003 + light * attenuation * .8 * .997; - // if (final_light > 1.) final_light = 1.; - // return float4(final_light, final_light, final_light, 1.); - return float4(texture.Sample(vo.uv).rgb, 1.f); -} |
