From a027a57d09227cd3950a8ab71e5aae39d205000b Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Tue, 2 Feb 2021 22:23:10 +0100 Subject: [PATCH] effects: Add generic shared header with common code --- CMakeLists.txt | 1 + data/effects/shared.effect | 54 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 data/effects/shared.effect diff --git a/CMakeLists.txt b/CMakeLists.txt index fab7bc32..01935972 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -970,6 +970,7 @@ list(APPEND PROJECT_DATA "data/effects/color-conversion.effect" "data/effects/mipgen.effect" "data/effects/pack-unpack.effect" + "data/effects/shared.effect" "data/locale/en-US.ini" ) list(APPEND PROJECT_INCLUDE_DIRS diff --git a/data/effects/shared.effect b/data/effects/shared.effect new file mode 100644 index 00000000..4a1f57c6 --- /dev/null +++ b/data/effects/shared.effect @@ -0,0 +1,54 @@ +//------------------------------------------------------------------------------ +// Uniforms +//------------------------------------------------------------------------------ + +// View Projection Matrix +uniform float4x4 ViewProj; + +//------------------------------------------------------------------------------ +// Samplers +//------------------------------------------------------------------------------ +sampler_state PointRepeatSampler { + Filter = Point; + AddressU = Repeat; + AddressV = Repeat; +}; + +sampler_state PointClampSampler { + Filter = Point; + AddressU = Clamp; + AddressV = Clamp; +}; + +sampler_state LinearRepeatSampler { + Filter = Linear; + AddressU = Repeat; + AddressV = Repeat; +}; + +sampler_state LinearClampSampler { + Filter = Linear; + AddressU = Clamp; + AddressV = Clamp; +}; + +//------------------------------------------------------------------------------ +// Structures +//------------------------------------------------------------------------------ +struct VertexData { + float4 pos : POSITION; + float2 uv : TEXCOORD0; +}; + +//------------------------------------------------------------------------------ +// Vertex Shaders +//------------------------------------------------------------------------------ +VertexData DefaultVertexShader(VertexData vtx) { + vtx.pos = mul(float4(vtx.pos.xyz, 1.0), ViewProj); + return vtx; +}; + +//------------------------------------------------------------------------------ +// Color Conversion +//------------------------------------------------------------------------------ +