2009-04-19 18:07:22 +00:00
|
|
|
// 3D world rendering shader
|
|
|
|
// Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
|
|
|
|
|
|
// Vertex input data
|
|
|
|
struct VertexData
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
float3 pos : POSITION;
|
|
|
|
float4 color : COLOR0;
|
|
|
|
float2 uv : TEXCOORD0;
|
|
|
|
float3 normal : NORMAL; //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Pixel input data
|
|
|
|
struct PixelData
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
float4 pos : POSITION;
|
|
|
|
float4 color : COLOR0;
|
|
|
|
float2 uv : TEXCOORD0;
|
2012-04-17 19:13:47 +00:00
|
|
|
};
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
//mxd. Vertex input data for sky rendering
|
|
|
|
struct SkyVertexData
|
|
|
|
{
|
|
|
|
float3 pos : POSITION;
|
|
|
|
float2 uv : TEXCOORD0;
|
|
|
|
};
|
|
|
|
|
|
|
|
//mxd. Pixel input data for sky rendering
|
|
|
|
struct SkyPixelData
|
|
|
|
{
|
|
|
|
float4 pos : POSITION;
|
|
|
|
float3 tex : TEXCOORD0;
|
|
|
|
};
|
|
|
|
|
|
|
|
//mxd. Pixel input data for light pass
|
2012-04-17 19:13:47 +00:00
|
|
|
struct LitPixelData
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
float4 pos : POSITION;
|
|
|
|
float4 color : COLOR0;
|
|
|
|
float2 uv : TEXCOORD0;
|
|
|
|
float3 pos_w : TEXCOORD1; //mxd. pixel position in world space
|
|
|
|
float3 normal : TEXCOORD2; //mxd. normal
|
2009-04-19 18:07:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Highlight color
|
|
|
|
float4 highlightcolor;
|
|
|
|
|
|
|
|
// Matrix for final transformation
|
Cosmetic, actions: renamed "Lower Floor/Ceiling by 8 mp" to "Lower Floor/Ceiling/Thing by 8 mp", "Raise Floor/Ceiling by 8 mp" to "Raise Floor/Ceiling/Thing by 8 mp", "Lower Floor/Ceiling by 1 mp" to "Lower Floor/Ceiling/Thing by 1 mp", "Raise Floor/Ceiling by 1 mp" to "Raise Floor/Ceiling/Thing by 1 mp", "Lower Floor/Ceiling to adjacent sector" to "Lower Floor/Ceiling/Thing to adjacent Sector/Thing", "Raise Floor/Ceiling to adjacent sector" to "Raise Floor/Ceiling/Thing to adjacent Sector/Thing".
Updated, Visual mode, "Raise Floor/Ceiling/Thing to adjacent Sector/Thing" / "Lower Floor/Ceiling/Thing to adjacent Sector/Thing" actions: sectors across targeted sectors are now taken into account when determining target height.
Updated, Visual mode, "Raise Floor/Ceiling/Thing to adjacent Sector/Thing" / "Lower Floor/Ceiling/Thing to adjacent Sector/Thing" actions: the actions can now stack things on top of other things when their bounding boxes intersect.
Internal: cosmetic changes to shader update logic.
Internal: thing bounding box is now used when adding a thing to VisualBlockMap.
2015-12-10 14:34:34 +00:00
|
|
|
const float4x4 worldviewproj;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
2012-04-17 19:13:47 +00:00
|
|
|
//mxd
|
|
|
|
float4x4 world;
|
|
|
|
float4 vertexColor;
|
2015-12-01 14:51:45 +00:00
|
|
|
|
2012-04-17 19:13:47 +00:00
|
|
|
//light
|
|
|
|
float4 lightPosAndRadius;
|
2012-05-20 00:56:59 +00:00
|
|
|
float4 lightColor; //also used as fog color
|
2015-12-01 14:51:45 +00:00
|
|
|
|
2012-05-20 00:56:59 +00:00
|
|
|
//fog
|
2016-01-11 13:00:52 +00:00
|
|
|
const float4 campos; //w is set to fade factor (distance, at wich fog color completely overrides pixel color)
|
|
|
|
|
|
|
|
//sky
|
|
|
|
static const float4 skynormal = float4(0.0f, 1.0f, 0.0f, 0.0f);
|
2012-04-17 19:13:47 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Texture input
|
Cosmetic, actions: renamed "Lower Floor/Ceiling by 8 mp" to "Lower Floor/Ceiling/Thing by 8 mp", "Raise Floor/Ceiling by 8 mp" to "Raise Floor/Ceiling/Thing by 8 mp", "Lower Floor/Ceiling by 1 mp" to "Lower Floor/Ceiling/Thing by 1 mp", "Raise Floor/Ceiling by 1 mp" to "Raise Floor/Ceiling/Thing by 1 mp", "Lower Floor/Ceiling to adjacent sector" to "Lower Floor/Ceiling/Thing to adjacent Sector/Thing", "Raise Floor/Ceiling to adjacent sector" to "Raise Floor/Ceiling/Thing to adjacent Sector/Thing".
Updated, Visual mode, "Raise Floor/Ceiling/Thing to adjacent Sector/Thing" / "Lower Floor/Ceiling/Thing to adjacent Sector/Thing" actions: sectors across targeted sectors are now taken into account when determining target height.
Updated, Visual mode, "Raise Floor/Ceiling/Thing to adjacent Sector/Thing" / "Lower Floor/Ceiling/Thing to adjacent Sector/Thing" actions: the actions can now stack things on top of other things when their bounding boxes intersect.
Internal: cosmetic changes to shader update logic.
Internal: thing bounding box is now used when adding a thing to VisualBlockMap.
2015-12-10 14:34:34 +00:00
|
|
|
const texture texture1;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Filter settings
|
Cosmetic, actions: renamed "Lower Floor/Ceiling by 8 mp" to "Lower Floor/Ceiling/Thing by 8 mp", "Raise Floor/Ceiling by 8 mp" to "Raise Floor/Ceiling/Thing by 8 mp", "Lower Floor/Ceiling by 1 mp" to "Lower Floor/Ceiling/Thing by 1 mp", "Raise Floor/Ceiling by 1 mp" to "Raise Floor/Ceiling/Thing by 1 mp", "Lower Floor/Ceiling to adjacent sector" to "Lower Floor/Ceiling/Thing to adjacent Sector/Thing", "Raise Floor/Ceiling to adjacent sector" to "Raise Floor/Ceiling/Thing to adjacent Sector/Thing".
Updated, Visual mode, "Raise Floor/Ceiling/Thing to adjacent Sector/Thing" / "Lower Floor/Ceiling/Thing to adjacent Sector/Thing" actions: sectors across targeted sectors are now taken into account when determining target height.
Updated, Visual mode, "Raise Floor/Ceiling/Thing to adjacent Sector/Thing" / "Lower Floor/Ceiling/Thing to adjacent Sector/Thing" actions: the actions can now stack things on top of other things when their bounding boxes intersect.
Internal: cosmetic changes to shader update logic.
Internal: thing bounding box is now used when adding a thing to VisualBlockMap.
2015-12-10 14:34:34 +00:00
|
|
|
const dword minfiltersettings;
|
|
|
|
const dword magfiltersettings;
|
|
|
|
const dword mipfiltersettings;
|
|
|
|
const float maxanisotropysetting;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Texture sampler settings
|
|
|
|
sampler2D texturesamp = sampler_state
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
Texture = <texture1>;
|
|
|
|
MagFilter = magfiltersettings;
|
|
|
|
MinFilter = minfiltersettings;
|
|
|
|
MipFilter = mipfiltersettings;
|
|
|
|
MipMapLodBias = 0.0f;
|
|
|
|
MaxAnisotropy = maxanisotropysetting;
|
2009-04-19 18:07:22 +00:00
|
|
|
};
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
//mxd. Skybox texture sampler settings
|
|
|
|
samplerCUBE skysamp = sampler_state
|
|
|
|
{
|
|
|
|
Texture = <texture1>;
|
|
|
|
MagFilter = magfiltersettings;
|
|
|
|
MinFilter = minfiltersettings;
|
|
|
|
MipFilter = mipfiltersettings;
|
|
|
|
MipMapLodBias = 0.0f;
|
|
|
|
MaxAnisotropy = maxanisotropysetting;
|
|
|
|
};
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Vertex shader
|
2014-12-03 23:15:26 +00:00
|
|
|
PixelData vs_main(VertexData vd)
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
PixelData pd;
|
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
// Fill pixel data input
|
|
|
|
pd.pos = mul(float4(vd.pos, 1.0f), worldviewproj);
|
|
|
|
pd.color = vd.color;
|
|
|
|
pd.uv = vd.uv;
|
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
// Return result
|
|
|
|
return pd;
|
2012-04-17 19:13:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//mxd. same as vs_main, but uses vertexColor var instead of actual vertex color. used in models rendering
|
2014-12-03 23:15:26 +00:00
|
|
|
PixelData vs_customvertexcolor(VertexData vd)
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
PixelData pd;
|
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
// Fill pixel data input
|
|
|
|
pd.pos = mul(float4(vd.pos, 1.0f), worldviewproj);
|
|
|
|
pd.color = vertexColor;
|
|
|
|
pd.uv = vd.uv;
|
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
// Return result
|
|
|
|
return pd;
|
2012-04-17 19:13:47 +00:00
|
|
|
}
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
LitPixelData vs_customvertexcolor_fog(VertexData vd)
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
LitPixelData pd;
|
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
// Fill pixel data input
|
|
|
|
pd.pos = mul(float4(vd.pos, 1.0f), worldviewproj);
|
2016-01-11 13:00:52 +00:00
|
|
|
pd.pos_w = mul(float4(vd.pos, 1.0f), world).xyz;
|
2013-09-11 09:47:53 +00:00
|
|
|
pd.color = vertexColor;
|
|
|
|
pd.uv = vd.uv;
|
|
|
|
pd.normal = vd.normal;
|
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
// Return result
|
|
|
|
return pd;
|
2012-05-20 00:56:59 +00:00
|
|
|
}
|
|
|
|
|
2012-04-17 19:13:47 +00:00
|
|
|
//mxd. light pass vertex shader
|
2014-12-03 23:15:26 +00:00
|
|
|
LitPixelData vs_lightpass(VertexData vd)
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
LitPixelData pd;
|
|
|
|
pd.pos = mul(float4(vd.pos, 1.0f), worldviewproj);
|
2016-01-11 13:00:52 +00:00
|
|
|
pd.pos_w = mul(float4(vd.pos, 1.0f), world).xyz;
|
2013-09-11 09:47:53 +00:00
|
|
|
pd.color = vd.color;
|
|
|
|
pd.uv = vd.uv;
|
|
|
|
pd.normal = vd.normal;
|
|
|
|
|
|
|
|
// Return result
|
|
|
|
return pd;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Normal pixel shader
|
|
|
|
float4 ps_main(PixelData pd) : COLOR
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
float4 tcolor = tex2D(texturesamp, pd.uv);
|
2015-09-27 21:09:14 +00:00
|
|
|
return tcolor * pd.color;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Full-bright pixel shader
|
|
|
|
float4 ps_fullbright(PixelData pd) : COLOR
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
float4 tcolor = tex2D(texturesamp, pd.uv);
|
|
|
|
tcolor.a *= pd.color.a;
|
2015-09-27 21:09:14 +00:00
|
|
|
return tcolor;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Normal pixel shader with highlight
|
|
|
|
float4 ps_main_highlight(PixelData pd) : COLOR
|
|
|
|
{
|
|
|
|
float4 tcolor = tex2D(texturesamp, pd.uv);
|
2016-01-26 08:00:54 +00:00
|
|
|
if(tcolor.a == 0) return tcolor;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
2015-09-27 21:09:14 +00:00
|
|
|
// Blend texture color and vertex color
|
|
|
|
float4 ncolor = tcolor * pd.color;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
2015-11-20 14:31:54 +00:00
|
|
|
return float4(highlightcolor.rgb * highlightcolor.a + (ncolor.rgb - 0.4f * highlightcolor.a), max(pd.color.a + 0.25f, 0.5f));
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Full-bright pixel shader with highlight
|
|
|
|
float4 ps_fullbright_highlight(PixelData pd) : COLOR
|
|
|
|
{
|
|
|
|
float4 tcolor = tex2D(texturesamp, pd.uv);
|
2016-01-26 08:00:54 +00:00
|
|
|
if(tcolor.a == 0) return tcolor;
|
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
|
|
|
|
|
|
|
// Blend texture color and vertex color
|
|
|
|
float4 ncolor = tcolor * pd.color;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
2015-11-20 14:31:54 +00:00
|
|
|
return float4(highlightcolor.rgb * highlightcolor.a + (tcolor.rgb - 0.4f * highlightcolor.a), max(pd.color.a + 0.25f, 0.5f));
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
2012-05-20 00:56:59 +00:00
|
|
|
//mxd. This adds fog color to current pixel color
|
2014-12-03 23:15:26 +00:00
|
|
|
float4 getFogColor(LitPixelData pd, float4 color)
|
|
|
|
{
|
2016-01-11 13:00:52 +00:00
|
|
|
float fogdist = max(16.0f, distance(pd.pos_w, campos.xyz));
|
|
|
|
float fogfactor = exp2(campos.w * fogdist);
|
2015-10-02 14:47:34 +00:00
|
|
|
|
|
|
|
color.rgb = lerp(lightColor.rgb, color.rgb, fogfactor);
|
|
|
|
return color;
|
2012-05-20 00:56:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//mxd. Shaders with fog calculation
|
|
|
|
// Normal pixel shader
|
2014-12-03 23:15:26 +00:00
|
|
|
float4 ps_main_fog(LitPixelData pd) : COLOR
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
float4 tcolor = tex2D(texturesamp, pd.uv);
|
2016-01-26 08:00:54 +00:00
|
|
|
if(tcolor.a == 0) return tcolor;
|
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
|
|
|
|
2015-09-27 21:09:14 +00:00
|
|
|
return getFogColor(pd, tcolor * pd.color);
|
2012-05-20 00:56:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Normal pixel shader with highlight
|
2014-12-03 23:15:26 +00:00
|
|
|
float4 ps_main_highlight_fog(LitPixelData pd) : COLOR
|
|
|
|
{
|
2012-05-20 00:56:59 +00:00
|
|
|
float4 tcolor = tex2D(texturesamp, pd.uv);
|
2016-01-26 08:00:54 +00:00
|
|
|
if(tcolor.a == 0) return tcolor;
|
2012-05-20 00:56:59 +00:00
|
|
|
|
2015-09-27 21:09:14 +00:00
|
|
|
// Blend texture color and vertex color
|
|
|
|
float4 ncolor = getFogColor(pd, tcolor * pd.color);
|
|
|
|
|
2015-12-01 14:51:45 +00:00
|
|
|
return float4(highlightcolor.rgb * highlightcolor.a + (ncolor.rgb - 0.4f * highlightcolor.a), max(ncolor.a + 0.25f, 0.5f));
|
2012-05-20 00:56:59 +00:00
|
|
|
}
|
|
|
|
|
2012-04-17 19:13:47 +00:00
|
|
|
//mxd: used to draw bounding boxes
|
2014-12-03 23:15:26 +00:00
|
|
|
float4 ps_constant_color(PixelData pd) : COLOR
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
return vertexColor;
|
2012-04-17 19:13:47 +00:00
|
|
|
}
|
|
|
|
|
2015-08-08 21:56:43 +00:00
|
|
|
//mxd: used to draw event lines
|
|
|
|
float4 ps_vertex_color(PixelData pd) : COLOR
|
|
|
|
{
|
|
|
|
return pd.color;
|
|
|
|
}
|
|
|
|
|
2012-04-17 19:13:47 +00:00
|
|
|
//mxd. dynamic light pixel shader pass, dood!
|
2014-12-03 23:15:26 +00:00
|
|
|
float4 ps_lightpass(LitPixelData pd) : COLOR
|
|
|
|
{
|
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
|
|
|
//is face facing away from light source?
|
2016-02-02 21:07:15 +00:00
|
|
|
if(dot(pd.normal, normalize(lightPosAndRadius.xyz - pd.pos_w)) < -0.1f) // (lightPosAndRadius.xyz - pd.pos_w) == direction from light to current pixel
|
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
|
|
|
clip(-1);
|
|
|
|
|
|
|
|
//is pixel in light range?
|
|
|
|
float dist = distance(pd.pos_w, lightPosAndRadius.xyz);
|
|
|
|
if(dist > lightPosAndRadius.w)
|
|
|
|
clip(-1);
|
|
|
|
|
|
|
|
//is pixel tranparent?
|
|
|
|
float4 tcolor = tex2D(texturesamp, pd.uv);
|
|
|
|
if(tcolor.a == 0.0f)
|
|
|
|
clip(-1);
|
|
|
|
|
|
|
|
//if it is - calculate color at current pixel
|
|
|
|
float4 lightColorMod = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
|
|
|
|
|
|
lightColorMod.rgb = lightColor.rgb * max(lightPosAndRadius.w - dist, 0.0f) / lightPosAndRadius.w;
|
|
|
|
if(lightColorMod.r > 0.0f || lightColorMod.g > 0.0f || lightColorMod.b > 0.0f)
|
|
|
|
{
|
|
|
|
lightColorMod.rgb *= lightColor.a;
|
|
|
|
if(lightColor.a > 0.4f) //Normal, vavoom or negative light
|
|
|
|
return tcolor * lightColorMod;
|
|
|
|
return lightColorMod; //Additive light
|
|
|
|
}
|
|
|
|
clip(-1);
|
|
|
|
return lightColorMod; //should never get here
|
2012-04-17 19:13:47 +00:00
|
|
|
}
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
//mxd. Vertex skybox shader
|
|
|
|
SkyPixelData vs_skybox(SkyVertexData vd)
|
|
|
|
{
|
|
|
|
SkyPixelData pd;
|
|
|
|
pd.pos = mul(float4(vd.pos, 1.0f), worldviewproj);
|
|
|
|
float3 worldpos = mul(float4(vd.pos, 1.0f), world).xyz;
|
|
|
|
pd.tex = reflect(worldpos - campos.xyz, normalize(mul(skynormal, world).xyz));
|
|
|
|
return pd;
|
|
|
|
}
|
|
|
|
|
|
|
|
//mxd. Pixel skybox shader
|
|
|
|
float4 ps_skybox(SkyPixelData pd) : COLOR
|
|
|
|
{
|
|
|
|
float4 ncolor = texCUBE(skysamp, pd.tex);
|
|
|
|
return float4(highlightcolor.rgb * highlightcolor.a + (ncolor.rgb - 0.4f * highlightcolor.a), 1.0f);
|
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Technique for shader model 2.0
|
2014-12-03 23:15:26 +00:00
|
|
|
technique SM20
|
|
|
|
{
|
2009-04-19 18:07:22 +00:00
|
|
|
// Normal
|
2014-12-03 23:15:26 +00:00
|
|
|
pass p0
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
VertexShader = compile vs_2_0 vs_main();
|
|
|
|
PixelShader = compile ps_2_0 ps_main();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Full brightness mode
|
2014-12-03 23:15:26 +00:00
|
|
|
pass p1
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
VertexShader = compile vs_2_0 vs_main();
|
|
|
|
PixelShader = compile ps_2_0 ps_fullbright();
|
|
|
|
}
|
2012-04-17 19:13:47 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Normal with highlight
|
2014-12-03 23:15:26 +00:00
|
|
|
pass p2
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
VertexShader = compile vs_2_0 vs_main();
|
|
|
|
PixelShader = compile ps_2_0 ps_main_highlight();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Full brightness mode with highlight
|
2014-12-03 23:15:26 +00:00
|
|
|
pass p3
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
VertexShader = compile vs_2_0 vs_main();
|
|
|
|
PixelShader = compile ps_2_0 ps_fullbright_highlight();
|
|
|
|
}
|
|
|
|
|
|
|
|
//mxd. same as p0-p3, but using vertexColor variable
|
|
|
|
// Normal
|
2014-12-03 23:15:26 +00:00
|
|
|
pass p4
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
VertexShader = compile vs_2_0 vs_customvertexcolor();
|
|
|
|
PixelShader = compile ps_2_0 ps_main();
|
|
|
|
}
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
//mxd. Skybox shader
|
|
|
|
pass p5
|
|
|
|
{
|
|
|
|
VertexShader = compile vs_2_0 vs_skybox();
|
|
|
|
PixelShader = compile ps_2_0 ps_skybox();
|
|
|
|
}
|
2012-04-17 19:13:47 +00:00
|
|
|
|
|
|
|
// Normal with highlight
|
2014-12-03 23:15:26 +00:00
|
|
|
pass p6
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
VertexShader = compile vs_2_0 vs_customvertexcolor();
|
|
|
|
PixelShader = compile ps_2_0 ps_main_highlight();
|
|
|
|
}
|
|
|
|
|
|
|
|
pass p7 {} //mxd. need this only to maintain offset
|
|
|
|
|
|
|
|
//mxd. same as p0-p3, but with fog calculation
|
2015-12-01 14:51:45 +00:00
|
|
|
// Normal
|
2014-12-03 23:15:26 +00:00
|
|
|
pass p8
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
VertexShader = compile vs_2_0 vs_lightpass();
|
|
|
|
PixelShader = compile ps_2_0 ps_main_fog();
|
|
|
|
}
|
|
|
|
|
|
|
|
pass p9 {} //mxd. need this only to maintain offset
|
2012-05-20 00:56:59 +00:00
|
|
|
|
|
|
|
// Normal with highlight
|
2014-12-03 23:15:26 +00:00
|
|
|
pass p10
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
VertexShader = compile vs_2_0 vs_lightpass();
|
|
|
|
PixelShader = compile ps_2_0 ps_main_highlight_fog();
|
|
|
|
}
|
|
|
|
|
|
|
|
pass p11 {} //mxd. need this only to maintain offset
|
|
|
|
|
|
|
|
//mxd. same as p4-p7, but with fog calculation
|
|
|
|
// Normal
|
2014-12-03 23:15:26 +00:00
|
|
|
pass p12
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
VertexShader = compile vs_2_0 vs_customvertexcolor_fog();
|
|
|
|
PixelShader = compile ps_2_0 ps_main_fog();
|
|
|
|
}
|
|
|
|
|
|
|
|
pass p13 {} //mxd. need this only to maintain offset
|
2012-05-20 00:56:59 +00:00
|
|
|
|
|
|
|
// Normal with highlight
|
2014-12-03 23:15:26 +00:00
|
|
|
pass p14
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
VertexShader = compile vs_2_0 vs_customvertexcolor_fog();
|
|
|
|
PixelShader = compile ps_2_0 ps_main_highlight_fog();
|
|
|
|
}
|
|
|
|
|
2015-08-08 21:56:43 +00:00
|
|
|
//mxd. Used to render event lines
|
|
|
|
pass p15
|
|
|
|
{
|
|
|
|
VertexShader = compile vs_2_0 vs_main();
|
|
|
|
PixelShader = compile ps_2_0 ps_vertex_color();
|
|
|
|
}
|
2013-09-11 09:47:53 +00:00
|
|
|
|
|
|
|
//mxd. Just fills everything with vertexColor. Used in ThingCage rendering.
|
2014-12-03 23:15:26 +00:00
|
|
|
pass p16
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
VertexShader = compile vs_2_0 vs_customvertexcolor();
|
|
|
|
PixelShader = compile ps_2_0 ps_constant_color();
|
|
|
|
}
|
|
|
|
|
|
|
|
//mxd. Light pass
|
2014-12-03 23:15:26 +00:00
|
|
|
pass p17
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
VertexShader = compile vs_2_0 vs_lightpass();
|
|
|
|
PixelShader = compile ps_2_0 ps_lightpass();
|
|
|
|
AlphaBlendEnable = true;
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|