47 lines
No EOL
1 KiB
HLSL
47 lines
No EOL
1 KiB
HLSL
#include "stereokit.hlsli"
|
|
#include "dofdev.hlsli"
|
|
|
|
//--name = dofdev/unlit
|
|
|
|
//--diffuse = white
|
|
|
|
Texture2D diffuse : register(t0);
|
|
SamplerState diffuse_s : register(s0);
|
|
|
|
struct vsIn {
|
|
float4 pos : SV_Position;
|
|
float3 norm : NORMAL0;
|
|
float2 uv : TEXCOORD0;
|
|
float4 col : COLOR0;
|
|
};
|
|
struct psIn {
|
|
float4 pos : SV_Position;
|
|
float3 norm : NORMAL0;
|
|
float2 uv : TEXCOORD0;
|
|
float4 world : WORLD;
|
|
float4 color : COLOR0;
|
|
float3 campos : TEXCOORD1;
|
|
uint view_id : SV_RenderTargetArrayIndex;
|
|
};
|
|
|
|
psIn vs(vsIn input, uint id : SV_InstanceID) {
|
|
psIn o;
|
|
o.view_id = id % sk_view_count;
|
|
id = id / sk_view_count;
|
|
|
|
o.campos = sk_camera_pos[o.view_id].xyz;
|
|
|
|
o.world = mul(input.pos, sk_inst[id].world);
|
|
o.pos = mul(o.world, sk_viewproj[o.view_id]);
|
|
|
|
o.norm = normalize(mul(input.norm, (float3x3)sk_inst[id].world));
|
|
|
|
o.uv = input.uv;
|
|
o.color = input.col;
|
|
o.color *= linear_gamma(sk_inst[id].color);
|
|
return o;
|
|
}
|
|
|
|
float4 ps(psIn input) : SV_TARGET {
|
|
return input.color * diffuse.Sample(diffuse_s, input.uv);
|
|
} |