80ab27df22
commit 409d4d96ead69028a164274637d23e350acb73fb Merge: 95169f539 26e89c63d Author: EdusFF <pitkanen.eetu@gmail.com> Date: Mon Mar 11 15:13:27 2019 +0200 Merge branch 'dev' of github.com:Regalis11/Barotrauma into dev commit 95169f53937f9a7e168a884171eaa21ae7f08023 Author: EdusFF <pitkanen.eetu@gmail.com> Date: Mon Mar 11 15:13:11 2019 +0200 Modified: ServerMessage structure to allow _ ; in player & submarine names commit 26e89c63dc8da771aea9f09978a630a6cff60a6f Merge: b7646d06d fb0b821bc Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Mar 11 14:42:44 2019 +0200 Merge branch 'kuraiookami-logicExpantion' into dev # Conflicts: # Barotrauma/BarotraumaShared/SharedContent.projitems commit fb0b821bc97891cdeec8f2c740a12119696393ea Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Mar 11 14:41:21 2019 +0200 Use invariant culture when parsing floats or converting them to strings in signal components commit f0c8afba934b41358cf5d59a22b87caf33f98a61 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Mar 11 14:00:44 2019 +0200 Update new signal components to use identifiers & added names and descriptions to the text file, use invariant culture in equalscomponent, memorycomponent doesn't require the signals to be floats commit 674d9ec804fc4770b602d4b09240b08cafc8ccec Merge: 3ea33fb54 242e2429f Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Mar 11 12:01:27 2019 +0200 Merge branch 'logicExpantion' of https://github.com/kuraiookami/Barotrauma into kuraiookami-logicExpantion # Conflicts: # Barotrauma/BarotraumaShared/BarotraumaShared.projitems # Barotrauma/BarotraumaShared/Content/Items/Electricity/poweritems.xml # Barotrauma/BarotraumaShared/Content/Items/Electricity/signalitems.xml # Barotrauma/BarotraumaShared/Source/Items/Components/Power/PowerContainer.cs # Barotrauma/BarotraumaShared/Source/Items/Components/Signal/AdderComponent.cs commit b7646d06d53fb05227276e6286d0e15da5dc9080 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Mar 11 11:37:33 2019 +0200 Re-enabled multiplayer campaign commit cf7258f6410a5995c881ec6e95eb9def5cd90ad4 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Mar 11 11:28:48 2019 +0200 Fixed item interfaces getting repositioned every frame when the editing HUD is open. Closes #1212 commit e8906239c779cf71de694bc65c81058e5cae16ef Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Mar 11 11:12:05 2019 +0200 Fixed VoipCapture creating new "could not start voice capture" popups constantly if there's no suitable capture device. Closes #1262 commit a30f47fbe47fde4fccb0453c1773a76d730d226b Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Sun Mar 10 19:04:59 2019 +0200 Disable audio instead of crashing if no audio device is found. Closes #1214 commit 242e2429fd2c3ed199ac26b55e2cbdc8636e73f9 Author: Darkwolf <Darkwolf0101@gmail.com> Date: Mon Jan 21 21:26:57 2019 -0600 Expansion of Barotrauma's logic system. Changed: - AdderComponent and children can clamp their output - Powercontainer signals for charge,charge% and charge rate Added: - ColorComponent: Dynamic signals for light set_color inputs - MemoryComponent: Stores and sends a signal that is edge latched - DivideComponent: Standard division - MultiplyComponent: Standard multiplication - SubtractComponent: Standard subtraction - XorComponent: Exclusive or - EqualsComponent: Equals comparison - GreaterComponent: Greater than comparison
229 lines
7.7 KiB
HLSL
229 lines
7.7 KiB
HLSL
Texture2D xTexture;
|
|
sampler TextureSampler = sampler_state { Texture = <xTexture>; };
|
|
|
|
Texture2D xDistortTexture;
|
|
sampler DistortSampler =
|
|
sampler_state
|
|
{
|
|
Texture = <xDistortTexture>;
|
|
MagFilter = LINEAR;
|
|
MinFilter = LINEAR;
|
|
MipFilter = LINEAR;
|
|
AddressU = WRAP;
|
|
AddressV = WRAP;
|
|
};
|
|
|
|
float blurDistance;
|
|
|
|
float2 distortScale;
|
|
float2 distortUvOffset;
|
|
|
|
float3 chromaticAberrationStrength;
|
|
|
|
// Apply radial distortion to the given coordinate.
|
|
float2 radialDistortion(float2 coord, float distortion)
|
|
{
|
|
float2 cc = coord - 0.5;
|
|
float dist = dot(cc, cc) * distortion;
|
|
//return coord * (pos + cc * (1.0 + dist) * dist) / pos;
|
|
return coord + (dist * dist + dist) * cc;
|
|
}
|
|
|
|
/*float4 sampleWithChromaticAberration(float2 samplePos)
|
|
{
|
|
return float4(
|
|
tex2D(TextureSampler, radialDistortion(samplePos, chromaticAberrationStrength.r)).r,
|
|
tex2D(TextureSampler, radialDistortion(samplePos, chromaticAberrationStrength.g)).g,
|
|
tex2D(TextureSampler, radialDistortion(samplePos, chromaticAberrationStrength.b)).b,
|
|
1);
|
|
}*/
|
|
float3 sampleChannelsSeparately(float2 samplePosR, float2 samplePosG, float2 samplePosB)
|
|
{
|
|
return float3(
|
|
tex2D(TextureSampler, samplePosR).r,
|
|
tex2D(TextureSampler, samplePosG).g,
|
|
tex2D(TextureSampler, samplePosB).b);
|
|
}
|
|
|
|
float3 sampleWithChromaticAberration(float2 samplePos)
|
|
{
|
|
return float3(
|
|
tex2D(TextureSampler, radialDistortion(samplePos, chromaticAberrationStrength.r)).r,
|
|
tex2D(TextureSampler, radialDistortion(samplePos, chromaticAberrationStrength.g)).g,
|
|
tex2D(TextureSampler, radialDistortion(samplePos, chromaticAberrationStrength.b)).b);
|
|
}
|
|
|
|
float4 blur(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
|
{
|
|
float4 sample;
|
|
sample = tex2D(TextureSampler, float2(texCoord.x + blurDistance, texCoord.y + blurDistance));
|
|
sample += tex2D(TextureSampler, float2(texCoord.x - blurDistance, texCoord.y - blurDistance));
|
|
sample += tex2D(TextureSampler, float2(texCoord.x + blurDistance, texCoord.y - blurDistance));
|
|
sample += tex2D(TextureSampler, float2(texCoord.x - blurDistance, texCoord.y + blurDistance));
|
|
sample = sample * 0.25f;
|
|
|
|
return sample;
|
|
}
|
|
|
|
float4 distort(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
|
{
|
|
float4 bumpColor = tex2D(DistortSampler, texCoord + distortUvOffset);
|
|
bumpColor = (bumpColor + tex2D(DistortSampler, texCoord - distortUvOffset * 2.0f)) * 0.5f;
|
|
|
|
float2 samplePos = texCoord;
|
|
|
|
samplePos.x += (bumpColor.r - 0.5f) * distortScale.x;
|
|
samplePos.y += (bumpColor.g - 0.5f) * distortScale.y;
|
|
|
|
return tex2D(TextureSampler, samplePos);
|
|
}
|
|
|
|
float4 blurDistort(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
|
{
|
|
float4 bumpColor = tex2D(DistortSampler, texCoord + distortUvOffset);
|
|
bumpColor = (bumpColor + tex2D(DistortSampler, texCoord - distortUvOffset * 2.0f)) * 0.5f;
|
|
|
|
float2 samplePos = texCoord;
|
|
|
|
samplePos.x += (bumpColor.r - 0.5f) * distortScale.x;
|
|
samplePos.y += (bumpColor.g - 0.5f) * distortScale.y;
|
|
|
|
float4 sample;
|
|
sample = tex2D(TextureSampler, float2(samplePos.x + blurDistance, samplePos.y + blurDistance));
|
|
sample += tex2D(TextureSampler, float2(samplePos.x - blurDistance, samplePos.y - blurDistance));
|
|
sample += tex2D(TextureSampler, float2(samplePos.x + blurDistance, samplePos.y - blurDistance));
|
|
sample += tex2D(TextureSampler, float2(samplePos.x - blurDistance, samplePos.y + blurDistance));
|
|
|
|
sample = sample * 0.25f;
|
|
|
|
return sample;
|
|
}
|
|
|
|
float4 chromaticAberration(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
|
{
|
|
return float4(sampleWithChromaticAberration(texCoord), 1);
|
|
}
|
|
|
|
float4 chromaticAberrationDistort(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
|
{
|
|
float4 bumpColor = tex2D(DistortSampler, texCoord + distortUvOffset);
|
|
bumpColor = (bumpColor + tex2D(DistortSampler, texCoord - distortUvOffset * 2.0f)) * 0.5f;
|
|
|
|
float2 samplePos = texCoord;
|
|
|
|
samplePos.x += (bumpColor.r - 0.5f) * distortScale.x;
|
|
samplePos.y += (bumpColor.g - 0.5f) * distortScale.y;
|
|
|
|
return float4(sampleWithChromaticAberration(samplePos), 1);
|
|
}
|
|
|
|
float4 blurChromaticAberration(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
|
{
|
|
float2 samplePosR = radialDistortion(texCoord, chromaticAberrationStrength.r);
|
|
float2 samplePosG = radialDistortion(texCoord, chromaticAberrationStrength.g);
|
|
float2 samplePosB = radialDistortion(texCoord, chromaticAberrationStrength.b);
|
|
|
|
float2 blurTopLeft = -blurDistance;
|
|
float2 blurTopRight = float2(blurDistance, -blurDistance);
|
|
float2 blurBottomRight = blurDistance;
|
|
float2 blurBottomLeft = float2(-blurDistance, blurDistance);
|
|
|
|
float3 sample;
|
|
sample = sampleChannelsSeparately(samplePosR + blurTopLeft, samplePosG + blurTopLeft, samplePosB + blurTopLeft);
|
|
sample += sampleChannelsSeparately(samplePosR + blurTopRight, samplePosG + blurTopRight, samplePosB + blurTopRight);
|
|
sample += sampleChannelsSeparately(samplePosR + blurBottomRight, samplePosG + blurBottomRight, samplePosB + blurBottomRight);
|
|
sample += sampleChannelsSeparately(samplePosR + blurBottomLeft, samplePosG + blurBottomLeft, samplePosB + blurBottomLeft);
|
|
|
|
sample = sample * 0.25f;
|
|
|
|
return float4(sample, 1);
|
|
}
|
|
|
|
float4 blurChromaticAberrationDistort(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
|
{
|
|
float4 bumpColor = tex2D(DistortSampler, texCoord + distortUvOffset);
|
|
bumpColor = (bumpColor + tex2D(DistortSampler, texCoord - distortUvOffset * 2.0f)) * 0.5f;
|
|
|
|
float2 samplePos = texCoord;
|
|
|
|
samplePos.x += (bumpColor.r - 0.5f) * distortScale.x;
|
|
samplePos.y += (bumpColor.g - 0.5f) * distortScale.y;
|
|
|
|
float2 samplePosR = radialDistortion(samplePos, chromaticAberrationStrength.r);
|
|
float2 samplePosG = radialDistortion(samplePos, chromaticAberrationStrength.g);
|
|
float2 samplePosB = radialDistortion(samplePos, chromaticAberrationStrength.b);
|
|
|
|
float2 blurTopLeft = -blurDistance;
|
|
float2 blurTopRight = float2(blurDistance, -blurDistance);
|
|
float2 blurBottomRight = blurDistance;
|
|
float2 blurBottomLeft = float2(-blurDistance, blurDistance);
|
|
|
|
float3 sample;
|
|
sample = sampleChannelsSeparately(samplePosR + blurTopLeft, samplePosG + blurTopLeft, samplePosB + blurTopLeft);
|
|
sample += sampleChannelsSeparately(samplePosR + blurTopRight, samplePosG + blurTopRight, samplePosB + blurTopRight);
|
|
sample += sampleChannelsSeparately(samplePosR + blurBottomRight, samplePosG + blurBottomRight, samplePosB + blurBottomRight);
|
|
sample += sampleChannelsSeparately(samplePosR + blurBottomLeft, samplePosG + blurBottomLeft, samplePosB + blurBottomLeft);
|
|
|
|
sample = sample * 0.25f;
|
|
|
|
return float4(sample, 1);
|
|
}
|
|
|
|
technique Distort
|
|
{
|
|
pass Pass1
|
|
{
|
|
PixelShader = compile ps_4_0_level_9_1 distort();
|
|
}
|
|
}
|
|
|
|
technique Blur
|
|
{
|
|
pass Pass1
|
|
{
|
|
PixelShader = compile ps_4_0_level_9_1 blur();
|
|
}
|
|
}
|
|
|
|
technique BlurDistort
|
|
{
|
|
pass Pass1
|
|
{
|
|
PixelShader = compile ps_4_0_level_9_1 blurDistort();
|
|
}
|
|
}
|
|
|
|
technique BlurChromaticAberration
|
|
{
|
|
pass Pass1
|
|
{
|
|
PixelShader = compile ps_4_0_level_9_1 blurChromaticAberration();
|
|
}
|
|
}
|
|
|
|
|
|
technique ChromaticAberration
|
|
{
|
|
pass Pass1
|
|
{
|
|
PixelShader = compile ps_4_0_level_9_1 chromaticAberration();
|
|
}
|
|
}
|
|
|
|
technique ChromaticAberrationDistort
|
|
{
|
|
pass Pass1
|
|
{
|
|
PixelShader = compile ps_4_0_level_9_1 chromaticAberrationDistort();
|
|
}
|
|
}
|
|
|
|
technique BlurChromaticAberrationDistort
|
|
{
|
|
pass Pass1
|
|
{
|
|
PixelShader = compile ps_4_0_level_9_1 blurChromaticAberrationDistort();
|
|
}
|
|
}
|
|
|