summaryrefslogtreecommitdiff
path: root/engine/res/sky_box_shader.slang
blob: 1a41220b45bc1d9f26d4e380c5e56ee85b22275a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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);
}