// Copyright 2021 Michael Fabian Dirks // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // 3. Neither the name of the copyright holder nor the names of its contributors // may be used to endorse or promote products derived from this software // without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. //------------------------------------------------------------------------------ // Defines //------------------------------------------------------------------------------ // Variations of PI/TAU #define PI 3.141592653 #define TAU 6.283185307 #define PIm2 6.283185307 #define PIb2 1.570796326 #define PIb4 0.785398163 // Phi/Φ = Golden Ratio #define PHI 1.61803398874989484820459 // e (Eulers Constant) #define EULERS_CONSTANT 2,7182818284590452353602874713527 // Degrees <-> Radians Conversion #define TO_RAD(x) (x * 0.017453292) #define TO_DEG(x) (x * 57.295779513) //------------------------------------------------------------------------------ // Uniforms //------------------------------------------------------------------------------ uniform float4x4 ViewProj< bool automatic = true; >; uniform float4 Time< bool automatic = true; >; uniform float4 ViewSize< bool automatic = true; >; // Filter Support #ifdef IS_FILTER uniform texture2d InputA< bool automatic = true; >; #endif // Transition Support #ifdef IS_TRANSITION uniform texture2d InputA< bool automatic = true; >; uniform texture2d InputB< bool automatic = true; >; uniform float TransitionTime< bool automatic = true; >; #endif uniform int RandomSeed< bool automatic = true; >; uniform float4x4 Random< bool automatic = true; >; //------------------------------------------------------------------------------ // Structures //------------------------------------------------------------------------------ struct VertexInformation { float4 position : POSITION; float4 texcoord0 : TEXCOORD0; }; //------------------------------------------------------------------------------ // Samplers //------------------------------------------------------------------------------ sampler_state PointRepeatSampler { Filter = Point; AddressU = Repeat; AddressV = Repeat; }; sampler_state LinearRepeatSampler { Filter = Linear; AddressU = Repeat; AddressV = Repeat; }; sampler_state PointClampSampler { Filter = Point; AddressU = Clamp; AddressV = Clamp; }; sampler_state LinearClampSampler { Filter = Linear; AddressU = Clamp; AddressV = Clamp; }; //------------------------------------------------------------------------------ // Functions //------------------------------------------------------------------------------ VertexInformation DefaultVertexShader(VertexInformation vtx) { vtx.position = mul(float4(vtx.position.xyz, 1.0), ViewProj); return vtx; };