diff options
| author | HampusM <hampus@hampusmat.com> | 2026-08-13 16:37:50 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-08-13 16:37:50 +0200 |
| commit | f92e6a27adbff100661ad252f655e7debd2babe8 (patch) | |
| tree | 352107c5323607ee0a91291e80faa6698faa944b /engine/res | |
| parent | 9a9b5d4a5cc35834e929e275d7c33ebfc582d069 (diff) | |
feat(engine): add sky box support
Diffstat (limited to 'engine/res')
| -rw-r--r-- | engine/res/sky_box_shader.slang | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/engine/res/sky_box_shader.slang b/engine/res/sky_box_shader.slang new file mode 100644 index 0000000..1a41220 --- /dev/null +++ b/engine/res/sky_box_shader.slang @@ -0,0 +1,34 @@ +SamplerCube cube_texture; + +cbuffer Uniforms +{ + float4x4 projection; + float4x4 view; +} + +struct VertexStageOutput +{ + float4 sv_position : SV_Position; + float3 vertex_pos : VertexPosition; +}; + +[shader("vertex")] +VertexStageOutput vertex_main(float3 pos: STD_POSITION) +{ + VertexStageOutput output; + + output.vertex_pos = pos; + + float4x4 proj_view = mul(projection, view); + + output.sv_position = mul(proj_view, float4(pos, 1.0)).xyww; + + return output; +} + +[shader("fragment")] +float4 fragment_main(float3 vertex_pos: VertexPosition) : SV_Target +{ + return cube_texture.Sample(vertex_pos); +} + |
