mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Code correction in Functions.cpp
Updated global shader example files.
This commit is contained in:
@@ -31,11 +31,16 @@ sampler BloomSampler : samplerstate
|
||||
AddressV = Clamp;
|
||||
};
|
||||
|
||||
// Variables that set the width and height of the current game resolution from sfall
|
||||
float w;
|
||||
float h;
|
||||
// Variables that set the width and height of the current game resolution from sfall (only for global shaders)
|
||||
int w;
|
||||
int h;
|
||||
|
||||
// the pixel size is computed as: 1.0f / resolution
|
||||
float2 rcpRes;
|
||||
|
||||
// system ticks (received from sfall)
|
||||
//int tickcount;
|
||||
|
||||
static const float2 resolution = float2(w, h);
|
||||
static const float2 wPass = float2(1, 0);
|
||||
static const float2 hPass = float2(0, 1);
|
||||
|
||||
@@ -60,7 +65,7 @@ float4 BlurDeltaPassPS(float2 uv : TEXCOORD0, uniform float2 delta) : COLOR0
|
||||
float3 sumColor = (tex2D(s0, uv).rgb);
|
||||
float brightness = Brightness(sumColor);
|
||||
|
||||
delta *= (1 / resolution);
|
||||
delta *= rcpRes;
|
||||
float totalWeight = 1;
|
||||
|
||||
float2 pointUV = uv + delta;
|
||||
@@ -72,8 +77,8 @@ float4 BlurDeltaPassPS(float2 uv : TEXCOORD0, uniform float2 delta) : COLOR0
|
||||
return float4((sumColor / totalWeight), 1);
|
||||
}
|
||||
|
||||
static const float2 wDelta = float2(1, 0) * (1 / resolution);
|
||||
static const float2 hDelta = float2(0, 1) * (1 / resolution);
|
||||
static const float2 wDelta = float2(1, 0) * rcpRes;
|
||||
static const float2 hDelta = float2(0, 1) * rcpRes;
|
||||
|
||||
float4 BlurPS(float4 color : COLOR0, float2 uv : TEXCOORD0) : COLOR0
|
||||
{
|
||||
@@ -166,8 +171,8 @@ static const float sharpenVal0 = (Sharpen * (1.5 + EdgeSharpen));
|
||||
static const float sharpenVal1 = ((sharpenVal0 - 1) / 8.0);
|
||||
|
||||
// pixel "width"
|
||||
static const float px = (1.0 / w);
|
||||
static const float py = (1.0 / h);
|
||||
static const float px = rcpRes.x;
|
||||
static const float py = rcpRes.y;
|
||||
|
||||
// for the blur filter
|
||||
#define mean 1.0
|
||||
|
||||
Reference in New Issue
Block a user