mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 05:21:16 +00:00
- scaled down the texture colorization feature for easier usability.
It makes little sense exposing every minute detail of this through UDMF. Setting it up that way is far too complicated. Using virtual textures that map to a real texture plus a colorization record should be far easier to use by mappers. This also doesn't piggyback on the Doom64 color feature anymore and is completely separate, despite some redundancies. This is still missing the texture definition part, though.
This commit is contained in:
parent
fd15af0b50
commit
bb8db9422f
19 changed files with 207 additions and 546 deletions
|
@ -207,25 +207,9 @@ Note: All <bool> fields default to false unless mentioned otherwise.
|
|||
useowncoloradd_top = <bool>; // Controls where the advanced colorization properties are taken from.
|
||||
useowncoloradd_mid = <bool>; // 0: From the containing sector, 1: from the given part of the linedef itself
|
||||
useowncoloradd_bottom = <bool>; // Default for all 3 is 0.
|
||||
|
||||
// Note: All following properties are subject to the 'useowncoloradd' flag for the given wall tier.
|
||||
coloradd_top = <int>; // Additive material color to apply to top section of sidedef. Default is black (0x000000)
|
||||
coloradd_mid = <int>; // Additive material color to apply to middle section of sidedef. Default is black (0x000000)
|
||||
coloradd_bottom = <int>; // Additive material color to apply to bottom section of sidedef. Default is black (0x000000)
|
||||
|
||||
colorblend_top = <int> // Blended material color to apply to top section of sidedef. Default is black (0x000000) Only active if a blend mode is set to non-0.
|
||||
colorblend_mid = <int> // Blended material color to apply to middle section of sidedef. Default is black (0x000000) Only active if a blend mode is set to non-0.
|
||||
colorblend_bottom = <int> // Blended material color to apply to bottom section of sidedef. Default is black (0x000000) Only active if a blend mode is set to non-0.
|
||||
blendmode_top = <int> // Controls how the blend is applied. 0: off; 1: Blend by alpha of the blend color.
|
||||
blendmode_mid = <int> // 2, 3 and 4 are modes taken from Build engine games, called "Screen", "Overlay" and "Hardlight"
|
||||
blendmode_bottom = <int> // Default is 0 (off)
|
||||
desaturationfactor_top = <float> // Desaturates the texture by the given amount. Default is 0, 1 is fully desaturated.
|
||||
desaturationfactor_mid = <float> // Out-of-range values are explicitly supported. (e.g. negative factors will oversaturate the texture color.)
|
||||
desaturationfactor_bottom = <float>
|
||||
inverttexture_top = <bool> // Inverts the texture color. Default is off. This operation occurs after desaturation but before other color manipulations.
|
||||
inverttexture_mid = <bool>
|
||||
inverttexture_bottom = <bool>
|
||||
|
||||
}
|
||||
|
||||
sector
|
||||
|
@ -304,19 +288,6 @@ Note: All <bool> fields default to false unless mentioned otherwise.
|
|||
coloradd_sprites = <int>; // Additive material color applied to sprites within the sector. Default is black (0x000000)
|
||||
coloradd_walls = <int>; // Additive material color applied to walls within the sector. Default is black (0x000000)
|
||||
|
||||
colorblend_floor = <int> // Blended material color to apply to the floor. Default is black (0x000000) Only active if a blend mode is set to non-0.
|
||||
colorblend_ceiling = <int> // Blended material color to apply to the ceiling. Default is black (0x000000) Only active if a blend mode is set to non-0.
|
||||
colorblend_walls = <int> // Blended material color to apply to walls. Default is black (0x000000) Only active if a blend mode is set to non-0.
|
||||
blendmode_floor = <int> // Controls how the blend is applied. 0: off; 1: Blend by alpha of the blend color.
|
||||
blendmode_ceiling = <int> // 2, 3 and 4 are modes taken from Build engine games, called "Screen", "Overlay" and "Hardlight"
|
||||
blendmode_walls = <int> // Default is 0 (off)
|
||||
desaturationfactor_floor = <float> // Desaturates the texture by the given amount. Default is 0, 1 is fully desaturated.
|
||||
desaturationfactor_ceiling = <float> // Out-of-range values are explicitly supported. (e.g. negative factors will oversaturate the texture color.)
|
||||
desaturationfactor_walls = <float>
|
||||
inverttexture_floor = <bool> // Inverts the texture color. Default is off. This operation occurs after desaturation but before other color manipulations.
|
||||
inverttexture_ceiling = <bool>
|
||||
inverttexture_walls = <bool>
|
||||
|
||||
portal_ceil_blocksound = <bool>; // ceiling portal blocks sound.
|
||||
portal_ceil_disabled = <bool>; // ceiling portal disabled.
|
||||
portal_ceil_nopass = <bool>; // ceiling portal blocks movement if true.
|
||||
|
@ -524,9 +495,6 @@ arg0str in dynamic lights.
|
|||
Added automapstyle and revealed linedef properties.
|
||||
Replaced tabs with spaces.
|
||||
|
||||
1.31 20.12.2019
|
||||
Added more color manipulation options for sectors and linedefs
|
||||
|
||||
===============================================================================
|
||||
EOF
|
||||
===============================================================================
|
||||
|
|
|
@ -601,6 +601,24 @@ FSerializer &Serialize(FSerializer &arc, const char *key, secspecial_t &spec, se
|
|||
|
||||
enum class EMoveResult { ok, crushed, pastdest };
|
||||
|
||||
struct TextureManipulation
|
||||
{
|
||||
enum
|
||||
{
|
||||
BlendNone = 0,
|
||||
BlendAlpha = 1,
|
||||
BlendScreen = 2,
|
||||
BlendOverlay = 3,
|
||||
BlendHardLight = 4,
|
||||
BlendMask = 7,
|
||||
InvertBit = 8
|
||||
};
|
||||
PalEntry AddColor; // Alpha contains the blend flags
|
||||
PalEntry ModulateColor; // Alpha may contain a multiplier to get higher values than 1.0 without promoting this to 4 full floats.
|
||||
PalEntry BlendColor;
|
||||
float DesaturationFactor;
|
||||
};
|
||||
|
||||
struct sector_t
|
||||
{
|
||||
|
||||
|
@ -645,6 +663,7 @@ struct sector_t
|
|||
PalEntry GlowColor;
|
||||
float GlowHeight;
|
||||
FTextureID Texture;
|
||||
TextureManipulation TextureFx;
|
||||
};
|
||||
|
||||
|
||||
|
@ -663,11 +682,6 @@ struct sector_t
|
|||
|
||||
PalEntry SpecialColors[5]; // Doom64 style colors
|
||||
PalEntry AdditiveColors[5];
|
||||
PalEntry BlendColors[3];
|
||||
float ColorScaleFactor[3];
|
||||
float MaterialDesaturationFactor[3]; // Unlike desaturated light this only affects the texture, nothing else.
|
||||
uint8_t BlendModes[3];
|
||||
uint8_t InvertModes;
|
||||
|
||||
FColormap Colormap; // Sector's own color/fog info.
|
||||
|
||||
|
@ -1050,37 +1064,52 @@ public:
|
|||
AdditiveColors[slot] = rgb;
|
||||
}
|
||||
|
||||
void SetBlendColor(int slot, PalEntry rgb)
|
||||
// TextureFX parameters
|
||||
|
||||
void SetTextureFx(int slot, const TextureManipulation &tm)
|
||||
{
|
||||
BlendColors[slot] = rgb;
|
||||
planes[slot].TextureFx = tm; // this is for getting the data from a texture.
|
||||
}
|
||||
|
||||
void SetColorScaleFactor(int slot, double fac)
|
||||
void SetTextureModulateColor(int slot, PalEntry rgb)
|
||||
{
|
||||
ColorScaleFactor[slot] = (float)fac;
|
||||
rgb.a = planes[slot].TextureFx.ModulateColor.a;
|
||||
planes[slot].TextureFx.ModulateColor = rgb;
|
||||
}
|
||||
|
||||
void SetDesaturationFactor(int slot, double fac)
|
||||
void SetTextureModulateScaleFactor(int slot, int fac)
|
||||
{
|
||||
MaterialDesaturationFactor[slot] = (float)fac;
|
||||
planes[slot].TextureFx.ModulateColor.a = (uint8_t)fac;
|
||||
}
|
||||
|
||||
void SetBlendMode(int slot, int mode)
|
||||
void SetTextureAdditiveColor(int slot, PalEntry rgb)
|
||||
{
|
||||
BlendModes[slot] = mode;
|
||||
rgb.a = planes[slot].TextureFx.AddColor.a;
|
||||
planes[slot].TextureFx.AddColor = rgb;
|
||||
}
|
||||
|
||||
void SetInvertMode(int num, bool on)
|
||||
void SetTextureBlendColor(int slot, PalEntry rgb)
|
||||
{
|
||||
if (on) InvertModes |= (1 << num);
|
||||
else InvertModes &= ~(1 << num);
|
||||
planes[slot].TextureFx.BlendColor = rgb;
|
||||
}
|
||||
|
||||
bool InvertMode(int num) const
|
||||
void SetTextureDesaturationFactor(int slot, double fac)
|
||||
{
|
||||
return !!(InvertModes & (1 << num));
|
||||
planes[slot].TextureFx.DesaturationFactor = (float)fac;
|
||||
}
|
||||
|
||||
void SetTextureBlendMode(int slot, int mode)
|
||||
{
|
||||
planes[slot].TextureFx.AddColor.a = (planes[slot].TextureFx.AddColor.a & ~TextureManipulation::BlendMask) | (mode & TextureManipulation::BlendMask);
|
||||
}
|
||||
|
||||
void SetTextureInvert(int slot, bool on)
|
||||
{
|
||||
if (on) planes[slot].TextureFx.AddColor.a |= TextureManipulation::InvertBit;
|
||||
else planes[slot].TextureFx.AddColor.a &= ~TextureManipulation::InvertBit;
|
||||
}
|
||||
|
||||
|
||||
inline bool PortalBlocksView(int plane);
|
||||
inline bool PortalBlocksSight(int plane);
|
||||
inline bool PortalBlocksMovement(int plane);
|
||||
|
@ -1190,21 +1219,17 @@ struct side_t
|
|||
ClampGradient = 4,
|
||||
UseOwnSpecialColors = 8,
|
||||
UseOwnAdditiveColor = 16,
|
||||
InvertedTexture = 32,
|
||||
BlendBits = 64 + 128 + 256, // 4 blend modes plus off value means 5 possible values, so 3 bits are needed.
|
||||
};
|
||||
double xOffset;
|
||||
double yOffset;
|
||||
double xScale;
|
||||
double yScale;
|
||||
TObjPtr<DInterpolation*> interpolation;
|
||||
FTextureID texture;
|
||||
int flags;
|
||||
FTextureID texture;
|
||||
TextureManipulation TextureFx;
|
||||
PalEntry SpecialColors[2];
|
||||
PalEntry AdditiveColor;
|
||||
PalEntry BlendColor;
|
||||
float ColorScaleFactor;
|
||||
float MaterialDesaturationFactor; // Unlike desaturated light this only affects the texture, nothing else.
|
||||
|
||||
|
||||
void InitFrom(const part &other)
|
||||
|
@ -1377,30 +1402,42 @@ struct side_t
|
|||
textures[which].AdditiveColor = rgb;
|
||||
}
|
||||
|
||||
void SetBlendColor(int which, PalEntry rgb)
|
||||
void SetTextureModulateColor(int slot, PalEntry rgb)
|
||||
{
|
||||
textures[which].BlendColor = rgb;
|
||||
rgb.a = textures[slot].TextureFx.ModulateColor.a;
|
||||
textures[slot].TextureFx.ModulateColor = rgb;
|
||||
}
|
||||
|
||||
void SetDesaturationFactor(int which, double factor)
|
||||
void SetTextureModulateScaleFactor(int slot, int fac)
|
||||
{
|
||||
textures[which].MaterialDesaturationFactor = (float)factor;
|
||||
textures[slot].TextureFx.ModulateColor.a = (uint8_t)fac;
|
||||
}
|
||||
|
||||
void SetColorScaleFactor(int which, double factor)
|
||||
void SetTextureAdditiveColor(int slot, PalEntry rgb)
|
||||
{
|
||||
textures[which].ColorScaleFactor = (float)factor;
|
||||
rgb.a = textures[slot].TextureFx.AddColor.a;
|
||||
textures[slot].TextureFx.AddColor = rgb;
|
||||
}
|
||||
|
||||
void SetBlendMode(int which, int mode)
|
||||
void SetTextureBlendColor(int slot, PalEntry rgb)
|
||||
{
|
||||
textures[which].flags &= ~part::BlendBits;
|
||||
textures[which].flags |= (mode << 6) & part::BlendBits;
|
||||
textures[slot].TextureFx.BlendColor = rgb;
|
||||
}
|
||||
void SetInvertMode(int which, bool on)
|
||||
|
||||
void SetTextureDesaturationFactor(int slot, double fac)
|
||||
{
|
||||
if (on) textures[which].flags |= part::InvertedTexture;
|
||||
else textures[which].flags &= ~part::InvertedTexture;
|
||||
textures[slot].TextureFx.DesaturationFactor = (float)fac;
|
||||
}
|
||||
|
||||
void SetTextureBlendMode(int slot, int mode)
|
||||
{
|
||||
textures[slot].TextureFx.AddColor.a = (textures[slot].TextureFx.AddColor.a & ~TextureManipulation::BlendMask) | (mode & TextureManipulation::BlendMask);
|
||||
}
|
||||
|
||||
void SetTextureInvert(int slot, bool on)
|
||||
{
|
||||
if (on) textures[slot].TextureFx.AddColor.a |= TextureManipulation::InvertBit;
|
||||
else textures[slot].TextureFx.AddColor.a &= ~TextureManipulation::InvertBit;
|
||||
}
|
||||
|
||||
PalEntry GetAdditiveColor(int which, sector_t *frontsector) const
|
||||
|
@ -1414,62 +1451,6 @@ struct side_t
|
|||
}
|
||||
}
|
||||
|
||||
PalEntry GetBlendColor(int which, sector_t* frontsector) const
|
||||
{
|
||||
if (textures[which].flags & part::UseOwnAdditiveColor) {
|
||||
return textures[which].BlendColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
return frontsector->BlendColors[sector_t::walltop];
|
||||
}
|
||||
}
|
||||
|
||||
float GetDesaturationFactor(int which, sector_t* frontsector) const
|
||||
{
|
||||
if (textures[which].flags & part::UseOwnAdditiveColor) {
|
||||
return textures[which].MaterialDesaturationFactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
return frontsector->MaterialDesaturationFactor[sector_t::walltop];
|
||||
}
|
||||
}
|
||||
|
||||
float GetColorScaleFactor(int which, sector_t* frontsector) const
|
||||
{
|
||||
if (textures[which].flags & part::UseOwnAdditiveColor) {
|
||||
return textures[which].ColorScaleFactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
return frontsector->ColorScaleFactor[sector_t::walltop];
|
||||
}
|
||||
}
|
||||
|
||||
int GetBlendMode(int which, sector_t *frontsector) const
|
||||
{
|
||||
if (textures[which].flags & part::UseOwnAdditiveColor)
|
||||
{
|
||||
return (textures[which].flags & part::BlendBits) >> 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
return frontsector->BlendModes[sector_t::walltop];
|
||||
}
|
||||
}
|
||||
|
||||
bool GetInvertMode(int which, sector_t* frontsector) const
|
||||
{
|
||||
if (textures[which].flags & part::UseOwnAdditiveColor)
|
||||
{
|
||||
return !!(textures[which].flags & part::InvertedTexture);
|
||||
}
|
||||
else
|
||||
{
|
||||
return !!(frontsector->InvertModes & (1<<sector_t::walltop));
|
||||
}
|
||||
}
|
||||
|
||||
DInterpolation *SetInterpolation(int position);
|
||||
void StopInterpolation(int position);
|
||||
|
|
|
@ -1106,7 +1106,6 @@ void MapLoader::LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
|
|||
ss->prevsec = -1; // stair retriggering until build completes
|
||||
memset(ss->SpecialColors, -1, sizeof(ss->SpecialColors));
|
||||
memset(ss->AdditiveColors, 0, sizeof(ss->AdditiveColors));
|
||||
ss->ColorScaleFactor[0] = ss->ColorScaleFactor[1] = ss->ColorScaleFactor[2] = 1.f;
|
||||
|
||||
ss->SetAlpha(sector_t::floor, 1.);
|
||||
ss->SetAlpha(sector_t::ceiling, 1.);
|
||||
|
|
|
@ -1379,77 +1379,14 @@ public:
|
|||
sd->SetAdditiveColor(side_t::bottom, CheckInt(key));
|
||||
break;
|
||||
|
||||
case NAME_colorblend_top:
|
||||
sd->SetBlendColor(side_t::top, CheckInt(key));
|
||||
break;
|
||||
|
||||
case NAME_colorblend_mid:
|
||||
sd->SetBlendColor(side_t::mid, CheckInt(key));
|
||||
break;
|
||||
|
||||
case NAME_colorblend_bottom:
|
||||
sd->SetBlendColor(side_t::bottom, CheckInt(key));
|
||||
break;
|
||||
|
||||
case NAME_desaturationfactor_top:
|
||||
sd->SetDesaturationFactor(side_t::top, CheckFloat(key));
|
||||
break;
|
||||
|
||||
case NAME_desaturationfactor_mid:
|
||||
sd->SetDesaturationFactor(side_t::mid, CheckFloat(key));
|
||||
break;
|
||||
|
||||
case NAME_desaturationfactor_bottom:
|
||||
sd->SetDesaturationFactor(side_t::bottom, CheckFloat(key));
|
||||
break;
|
||||
|
||||
case NAME_colorscalefactor_top:
|
||||
sd->SetColorScaleFactor(side_t::top, CheckFloat(key));
|
||||
break;
|
||||
|
||||
case NAME_colorscalefactor_mid:
|
||||
sd->SetColorScaleFactor(side_t::mid, CheckFloat(key));
|
||||
break;
|
||||
|
||||
case NAME_colorscalefactor_bottom:
|
||||
sd->SetColorScaleFactor(side_t::bottom, CheckFloat(key));
|
||||
break;
|
||||
|
||||
case NAME_blendmode_top:
|
||||
sd->SetColorScaleFactor(side_t::top, CheckInt(key));
|
||||
break;
|
||||
|
||||
case NAME_blendmode_mid:
|
||||
sd->SetColorScaleFactor(side_t::mid, CheckInt(key));
|
||||
break;
|
||||
|
||||
case NAME_blendmode_bottom:
|
||||
sd->SetColorScaleFactor(side_t::bottom, CheckInt(key));
|
||||
break;
|
||||
|
||||
case NAME_inverttexture_top:
|
||||
sd->SetInvertMode(side_t::top, CheckBool(key));
|
||||
break;
|
||||
|
||||
case NAME_inverttexture_mid:
|
||||
sd->SetInvertMode(side_t::mid, CheckBool(key));
|
||||
break;
|
||||
|
||||
case NAME_inverttexture_bottom:
|
||||
sd->SetInvertMode(side_t::bottom, CheckBool(key));
|
||||
break;
|
||||
|
||||
case NAME_useowncoloradd_top:
|
||||
sd->textures[side_t::top].flags |= side_t::part::UseOwnAdditiveColor * CheckBool(key);
|
||||
break;
|
||||
|
||||
case NAME_useowncoloradd_mid:
|
||||
sd->textures[side_t::mid].flags |= side_t::part::UseOwnAdditiveColor * CheckBool(key);
|
||||
break;
|
||||
|
||||
case NAME_useowncoloradd_bottom:
|
||||
sd->textures[side_t::bottom].flags |= side_t::part::UseOwnAdditiveColor * CheckBool(key);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -1503,7 +1440,6 @@ public:
|
|||
sec->SetYScale(sector_t::ceiling, 1.);
|
||||
sec->SetAlpha(sector_t::floor, 1.);
|
||||
sec->SetAlpha(sector_t::ceiling, 1.);
|
||||
sec->ColorScaleFactor[0] = sec->ColorScaleFactor[1] = sec->ColorScaleFactor[2] = 1.f;
|
||||
sec->thinglist = nullptr;
|
||||
sec->touching_thinglist = nullptr; // phares 3/14/98
|
||||
sec->sectorportal_thinglist = nullptr;
|
||||
|
@ -1706,67 +1642,6 @@ public:
|
|||
sec->AdditiveColors[sector_t::sprites] = CheckInt(key) | 0xff000000;
|
||||
break;
|
||||
|
||||
case NAME_colorblend_floor:
|
||||
sec->SetBlendColor(sector_t::floor, CheckInt(key));
|
||||
break;
|
||||
|
||||
case NAME_colorblend_ceiling:
|
||||
sec->SetBlendColor(sector_t::ceiling, CheckInt(key));
|
||||
break;
|
||||
|
||||
case NAME_colorblend_walls:
|
||||
sec->SetBlendColor(sector_t::walltop, CheckInt(key));
|
||||
break;
|
||||
|
||||
case NAME_desaturationfactor_floor:
|
||||
sec->SetDesaturationFactor(sector_t::floor, CheckFloat(key));
|
||||
break;
|
||||
|
||||
case NAME_desaturationfactor_ceiling:
|
||||
sec->SetDesaturationFactor(sector_t::ceiling, CheckFloat(key));
|
||||
break;
|
||||
|
||||
case NAME_desaturationfactor_walls:
|
||||
sec->SetDesaturationFactor(sector_t::walltop, CheckFloat(key));
|
||||
break;
|
||||
|
||||
case NAME_colorscalefactor_floor:
|
||||
sec->SetColorScaleFactor(sector_t::floor, CheckFloat(key));
|
||||
break;
|
||||
|
||||
case NAME_colorscalefactor_ceiling:
|
||||
sec->SetColorScaleFactor(sector_t::ceiling, CheckFloat(key));
|
||||
break;
|
||||
|
||||
case NAME_colorscalefactor_walls:
|
||||
sec->SetColorScaleFactor(sector_t::walltop, CheckFloat(key));
|
||||
break;
|
||||
|
||||
case NAME_blendmode_floor:
|
||||
sec->SetColorScaleFactor(sector_t::floor, CheckInt(key));
|
||||
break;
|
||||
|
||||
case NAME_blendmode_ceiling:
|
||||
sec->SetColorScaleFactor(sector_t::ceiling, CheckInt(key));
|
||||
break;
|
||||
|
||||
case NAME_blendmode_walls:
|
||||
sec->SetColorScaleFactor(sector_t::walltop, CheckInt(key));
|
||||
break;
|
||||
|
||||
case NAME_inverttexture_floor:
|
||||
sec->SetInvertMode(sector_t::floor, CheckBool(key));
|
||||
break;
|
||||
|
||||
case NAME_inverttexture_ceiling:
|
||||
sec->SetInvertMode(sector_t::ceiling, CheckBool(key));
|
||||
break;
|
||||
|
||||
case NAME_inverttexture_walls:
|
||||
sec->SetInvertMode(sector_t::walltop, CheckBool(key));
|
||||
break;
|
||||
|
||||
|
||||
case NAME_Desaturation:
|
||||
desaturation = int(255*CheckFloat(key) + FLT_EPSILON); // FLT_EPSILON to avoid rounding errors with numbers slightly below a full integer.
|
||||
continue;
|
||||
|
|
|
@ -114,9 +114,6 @@ FSerializer &Serialize(FSerializer &arc, const char *key, side_t::part &part, si
|
|||
("color1", part.SpecialColors[0], def->SpecialColors[0])
|
||||
("color2", part.SpecialColors[1], def->SpecialColors[1])
|
||||
("addcolor", part.AdditiveColor, def->AdditiveColor)
|
||||
("blendcolor", part.BlendColor, def->BlendColor)
|
||||
("colorscalefactor", part.ColorScaleFactor, def->ColorScaleFactor)
|
||||
("desaturationfactor", part.MaterialDesaturationFactor, def->MaterialDesaturationFactor)
|
||||
.EndObject();
|
||||
}
|
||||
return arc;
|
||||
|
@ -299,11 +296,6 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sector_t &p, sector_t
|
|||
("colormap", p.Colormap, def->Colormap)
|
||||
.Array("specialcolors", p.SpecialColors, def->SpecialColors, 5, true)
|
||||
.Array("additivecolors", p.AdditiveColors, def->AdditiveColors, 5, true)
|
||||
.Array("blendcolors", p.BlendColors, def->BlendColors, 3, true)
|
||||
.Array("colorscalefactors", p.ColorScaleFactor, def->ColorScaleFactor, 3, true)
|
||||
.Array("desaturationfactors", p.MaterialDesaturationFactor, def->MaterialDesaturationFactor, 3, true)
|
||||
.Array("blendmodes", p.BlendModes, def->BlendModes, 3, true)
|
||||
("invertmodes", p.InvertModes, def->InvertModes)
|
||||
("gravity", p.gravity, def->gravity)
|
||||
.Terrain("floorterrain", p.terrainnum[0], &def->terrainnum[0])
|
||||
.Terrain("ceilingterrain", p.terrainnum[1], &def->terrainnum[1])
|
||||
|
|
|
@ -138,11 +138,9 @@ bool FGLRenderState::ApplyShader()
|
|||
activeShader->muClipSplit.Set(mClipSplit);
|
||||
activeShader->muSpecularMaterial.Set(mGlossiness, mSpecularLevel);
|
||||
activeShader->muAddColor.Set(mStreamData.uAddColor);
|
||||
activeShader->muBlendColor.Set(mStreamData.uBlendColor);
|
||||
activeShader->muObjectBlendMode.Set(mStreamData.uObjectBlendMode);
|
||||
activeShader->muObjectColorizeFactor.Set(mStreamData.uObjectColorizeFactor);
|
||||
activeShader->muObjectDesaturationFactor.Set(mStreamData.uObjectDesaturationFactor);
|
||||
activeShader->muObjectInvertColor.Set(mStreamData.uObjectInvertColor);
|
||||
activeShader->muTextureAddColor.Set(mStreamData.uTextureAddColor);
|
||||
activeShader->muTextureModulateColor.Set(mStreamData.uTextureModulateColor);
|
||||
activeShader->muTextureBlendColor.Set(mStreamData.uTextureBlendColor);
|
||||
|
||||
if (mGlowEnabled || activeShader->currentglowstate)
|
||||
{
|
||||
|
|
|
@ -543,11 +543,9 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
muAlphaThreshold.Init(hShader, "uAlphaThreshold");
|
||||
muSpecularMaterial.Init(hShader, "uSpecularMaterial");
|
||||
muAddColor.Init(hShader, "uAddColor");
|
||||
muBlendColor.Init(hShader, "uBlendColor");
|
||||
muObjectDesaturationFactor.Init(hShader, "uObjectDesaturationFactor");
|
||||
muObjectColorizeFactor.Init(hShader, "uObjectColorizeFactor");
|
||||
muObjectBlendMode.Init(hShader, "uObjectBlendMode");
|
||||
muObjectInvertColor.Init(hShader, "uObjectInvertColor");
|
||||
muTextureAddColor.Init(hShader, "uTextureAddColor");
|
||||
muTextureModulateColor.Init(hShader, "uTextureModulateColor");
|
||||
muTextureBlendColor.Init(hShader, "uTextureBlendColor");
|
||||
muTimer.Init(hShader, "timer");
|
||||
|
||||
lights_index = glGetUniformLocation(hShader, "lights");
|
||||
|
|
|
@ -246,7 +246,9 @@ class FShader
|
|||
FBufferedUniformPE muObjectColor;
|
||||
FBufferedUniformPE muObjectColor2;
|
||||
FBufferedUniformPE muAddColor;
|
||||
FBufferedUniformPE muBlendColor;
|
||||
FBufferedUniformPE muTextureBlendColor;
|
||||
FBufferedUniformPE muTextureModulateColor;
|
||||
FBufferedUniformPE muTextureAddColor;
|
||||
FUniform4f muGlowBottomColor;
|
||||
FUniform4f muGlowTopColor;
|
||||
FUniform4f muGlowBottomPlane;
|
||||
|
@ -259,11 +261,6 @@ class FShader
|
|||
FBufferedUniform1f muAlphaThreshold;
|
||||
FBufferedUniform2f muSpecularMaterial;
|
||||
FBufferedUniform1f muTimer;
|
||||
|
||||
FBufferedUniform1f muObjectDesaturationFactor;
|
||||
FBufferedUniform1f muObjectColorizeFactor;
|
||||
FBufferedUniform1i muObjectBlendMode;
|
||||
FBufferedUniform1i muObjectInvertColor;
|
||||
|
||||
int lights_index;
|
||||
int modelmatrix_index;
|
||||
|
|
|
@ -295,16 +295,13 @@ class HWFlat
|
|||
public:
|
||||
sector_t * sector;
|
||||
FSection *section;
|
||||
float z; // the z position of the flat (only valid for non-sloped planes)
|
||||
FMaterial *gltexture;
|
||||
TextureManipulation* TextureFx;
|
||||
|
||||
float z; // the z position of the flat (only valid for non-sloped planes)
|
||||
FColormap Colormap; // light and fog
|
||||
PalEntry FlatColor;
|
||||
PalEntry AddColor;
|
||||
PalEntry BlendColor;
|
||||
float DesaturationFactor, ColorFactor;
|
||||
int BlendMode;
|
||||
bool Invert;
|
||||
ERenderStyle renderstyle;
|
||||
|
||||
float alpha;
|
||||
|
|
|
@ -308,11 +308,7 @@ void HWFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
di->SetFog(state, lightlevel, rel, di->isFullbrightScene(), &Colormap, false);
|
||||
state.SetObjectColor(FlatColor | 0xff000000);
|
||||
state.SetAddColor(AddColor | 0xff000000);
|
||||
state.SetBlendColor(BlendColor);
|
||||
state.SetObjectBlendMode(BlendMode);
|
||||
state.SetColorizeFactor(ColorFactor);
|
||||
state.SetObjectDesaturateFactor(DesaturationFactor);
|
||||
state.SetObjectInvert(Invert);
|
||||
state.ApplyTextureManipulation(TextureFx);
|
||||
|
||||
|
||||
if (hacktype & SSRF_PLANEHACK)
|
||||
|
@ -364,11 +360,7 @@ void HWFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
}
|
||||
state.SetObjectColor(0xffffffff);
|
||||
state.SetAddColor(0);
|
||||
state.SetBlendColor(0);
|
||||
state.SetObjectDesaturateFactor(0);
|
||||
state.SetObjectBlendMode(0);
|
||||
state.SetObjectInvert(false);
|
||||
state.SetColorizeFactor(1);
|
||||
state.ApplyTextureManipulation(nullptr);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -459,22 +451,14 @@ void HWFlat::SetFrom3DFloor(F3DFloor *rover, bool top, bool underside)
|
|||
Colormap.LightColor = light->extra_colormap.FadeColor;
|
||||
FlatColor = 0xffffffff;
|
||||
AddColor = 0;
|
||||
BlendColor = 0;
|
||||
BlendMode = 0;
|
||||
ColorFactor = 1.f;
|
||||
DesaturationFactor = 0.f;
|
||||
Invert = false;
|
||||
TextureFx = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
Colormap.CopyFrom3DLight(light);
|
||||
FlatColor = plane.model->SpecialColors[plane.isceiling];
|
||||
AddColor = plane.model->AdditiveColors[plane.isceiling];
|
||||
BlendColor = plane.model->BlendColors[plane.isceiling];
|
||||
BlendMode = plane.model->BlendModes[plane.isceiling];
|
||||
ColorFactor = plane.model->ColorScaleFactor[plane.isceiling];
|
||||
DesaturationFactor = plane.model->MaterialDesaturationFactor[plane.isceiling];
|
||||
Invert = plane.model->InvertMode(plane.isceiling);
|
||||
TextureFx = &plane.model->planes[plane.isceiling].TextureFx;
|
||||
}
|
||||
|
||||
|
||||
|
@ -530,11 +514,7 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sector_t * frontsector, int which)
|
|||
Colormap = frontsector->Colormap;
|
||||
FlatColor = frontsector->SpecialColors[sector_t::floor];
|
||||
AddColor = frontsector->AdditiveColors[sector_t::floor];
|
||||
BlendColor = frontsector->BlendColors[sector_t::floor];
|
||||
BlendMode = frontsector->BlendModes[sector_t::floor];
|
||||
DesaturationFactor = frontsector->MaterialDesaturationFactor[sector_t::floor];
|
||||
ColorFactor = frontsector->ColorScaleFactor[sector_t::floor];
|
||||
Invert = frontsector->InvertMode(sector_t::floor);
|
||||
TextureFx = &frontsector->planes[sector_t::floor].TextureFx;
|
||||
|
||||
port = frontsector->ValidatePortal(sector_t::floor);
|
||||
if ((stack = (port != NULL)))
|
||||
|
@ -592,11 +572,7 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sector_t * frontsector, int which)
|
|||
Colormap = frontsector->Colormap;
|
||||
FlatColor = frontsector->SpecialColors[sector_t::ceiling];
|
||||
AddColor = frontsector->AdditiveColors[sector_t::ceiling];
|
||||
BlendColor = frontsector->BlendColors[sector_t::ceiling];
|
||||
BlendMode = frontsector->BlendModes[sector_t::ceiling];
|
||||
DesaturationFactor = frontsector->MaterialDesaturationFactor[sector_t::ceiling];
|
||||
ColorFactor = frontsector->ColorScaleFactor[sector_t::ceiling];
|
||||
Invert = frontsector->InvertMode(sector_t::ceiling);
|
||||
TextureFx = &frontsector->planes[sector_t::ceiling].TextureFx;
|
||||
port = frontsector->ValidatePortal(sector_t::ceiling);
|
||||
if ((stack = (port != NULL)))
|
||||
{
|
||||
|
|
|
@ -150,6 +150,26 @@ struct FVector4PalEntry
|
|||
a = newvalue.a * normScale;
|
||||
return *this;
|
||||
}
|
||||
|
||||
FVector4PalEntry& SetIA(PalEntry newvalue)
|
||||
{
|
||||
const float normScale = 1.0f / 255.0f;
|
||||
r = newvalue.r * normScale;
|
||||
g = newvalue.g * normScale;
|
||||
b = newvalue.b * normScale;
|
||||
a = newvalue.a;
|
||||
return *this;
|
||||
}
|
||||
|
||||
FVector4PalEntry& SetFlt(float v1, float v2, float v3, float v4)
|
||||
{
|
||||
r = v1;
|
||||
g = v2;
|
||||
b = v3;
|
||||
a = v4;
|
||||
return *this;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct StreamData
|
||||
|
@ -158,16 +178,14 @@ struct StreamData
|
|||
FVector4PalEntry uObjectColor2;
|
||||
FVector4 uDynLightColor;
|
||||
FVector4PalEntry uAddColor;
|
||||
FVector4PalEntry uBlendColor;
|
||||
FVector4PalEntry uTextureAddColor;
|
||||
FVector4PalEntry uTextureModulateColor;
|
||||
FVector4PalEntry uTextureBlendColor;
|
||||
FVector4PalEntry uFogColor;
|
||||
float uDesaturationFactor;
|
||||
float uInterpolationFactor;
|
||||
float timer;
|
||||
int useVertexData;
|
||||
float uObjectDesaturationFactor;
|
||||
float uObjectColorizeFactor;
|
||||
int uObjectBlendMode;
|
||||
int uObjectInvertColor;
|
||||
FVector4 uVertexColor;
|
||||
FVector4 uVertexNormal;
|
||||
|
||||
|
@ -241,11 +259,9 @@ public:
|
|||
mStreamData.uAddColor = 0;
|
||||
mStreamData.uObjectColor = 0xffffffff;
|
||||
mStreamData.uObjectColor2 = 0;
|
||||
mStreamData.uBlendColor = 0;
|
||||
mStreamData.uObjectDesaturationFactor = 0;
|
||||
mStreamData.uObjectBlendMode = 0;
|
||||
mStreamData.uObjectColorizeFactor = 1;
|
||||
mStreamData.uObjectInvertColor = 0;
|
||||
mStreamData.uTextureBlendColor = 0;
|
||||
mStreamData.uTextureAddColor = 0;
|
||||
mStreamData.uTextureModulateColor = 0;
|
||||
mSoftLight = 0;
|
||||
mLightParms[0] = mLightParms[1] = mLightParms[2] = 0.0f;
|
||||
mLightParms[3] = -1.f;
|
||||
|
@ -455,29 +471,20 @@ public:
|
|||
mStreamData.uAddColor = pe;
|
||||
}
|
||||
|
||||
void SetBlendColor(PalEntry pe)
|
||||
void ApplyTextureManipulation(TextureManipulation* texfx)
|
||||
{
|
||||
mStreamData.uBlendColor = pe;
|
||||
}
|
||||
|
||||
void SetColorizeFactor(float f)
|
||||
{
|
||||
mStreamData.uObjectColorizeFactor = f;
|
||||
}
|
||||
|
||||
void SetObjectDesaturateFactor(float f)
|
||||
{
|
||||
mStreamData.uObjectDesaturationFactor = f;
|
||||
}
|
||||
|
||||
void SetObjectInvert(bool on)
|
||||
{
|
||||
mStreamData.uObjectInvertColor = on;
|
||||
}
|
||||
|
||||
void SetObjectBlendMode(int b)
|
||||
{
|
||||
mStreamData.uObjectBlendMode = b;
|
||||
if (!texfx || texfx->AddColor.a == 0)
|
||||
{
|
||||
mStreamData.uTextureAddColor.a = 0; // we only need to set the flags to 0
|
||||
}
|
||||
else
|
||||
{
|
||||
// set up the whole thing
|
||||
mStreamData.uTextureAddColor.SetIA(texfx->AddColor);
|
||||
auto pe = texfx->ModulateColor;
|
||||
mStreamData.uTextureModulateColor.SetFlt(pe.r * pe.a / 255.f, pe.g * pe.a / 255.f, pe.b * pe.a / 255.f, texfx->DesaturationFactor);
|
||||
mStreamData.uTextureBlendColor = texfx->BlendColor;
|
||||
}
|
||||
}
|
||||
|
||||
void SetFog(PalEntry c, float d)
|
||||
|
|
|
@ -297,11 +297,6 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
|
||||
state.SetObjectColor(0xffffffff);
|
||||
state.SetAddColor(0);
|
||||
state.SetBlendColor(0);
|
||||
state.SetObjectDesaturateFactor(0);
|
||||
state.SetObjectBlendMode(0);
|
||||
state.SetObjectInvert(false);
|
||||
state.SetColorizeFactor(1);
|
||||
state.EnableTexture(true);
|
||||
state.SetDynLight(0, 0, 0);
|
||||
}
|
||||
|
|
|
@ -175,10 +175,7 @@ void HWWall::RenderTexturedWall(HWDrawInfo *di, FRenderState &state, int rflags)
|
|||
state.SetObjectColor(color1);
|
||||
state.SetObjectColor2((color1 != color2) ? color2 : PalEntry(0));
|
||||
state.SetAddColor(side->GetAdditiveColor(tierndx, frontsector));
|
||||
state.SetBlendColor(side->GetBlendColor(tierndx, frontsector));
|
||||
state.SetObjectBlendMode(side->GetBlendMode(tierndx, frontsector));
|
||||
state.SetObjectDesaturateFactor(side->GetDesaturationFactor(tierndx, frontsector));
|
||||
state.SetObjectInvert(side->GetInvertMode(tierndx, frontsector));
|
||||
state.ApplyTextureManipulation(&side->textures[tierndx].TextureFx);
|
||||
|
||||
if (color1 != color2)
|
||||
{
|
||||
|
@ -248,10 +245,7 @@ void HWWall::RenderTexturedWall(HWDrawInfo *di, FRenderState &state, int rflags)
|
|||
state.SetTextureMode(tmode);
|
||||
state.EnableGlow(false);
|
||||
state.EnableGradient(false);
|
||||
state.SetObjectDesaturateFactor(0);
|
||||
state.SetObjectInvert(false);
|
||||
state.SetObjectBlendMode(0);
|
||||
state.SetColorizeFactor(1);
|
||||
state.ApplyTextureManipulation(nullptr);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -103,11 +103,6 @@ void HWDrawInfo::DrawPSprite(HUDSprite *huds, FRenderState &state)
|
|||
state.AlphaFunc(Alpha_GEqual, gl_mask_sprite_threshold);
|
||||
state.SetObjectColor(0xffffffff);
|
||||
state.SetAddColor(0);
|
||||
state.SetBlendColor(0);
|
||||
state.SetObjectDesaturateFactor(0);
|
||||
state.SetObjectBlendMode(0);
|
||||
state.SetObjectInvert(false);
|
||||
state.SetColorizeFactor(1);
|
||||
state.SetDynLight(0, 0, 0);
|
||||
state.EnableBrightmap(false);
|
||||
}
|
||||
|
|
|
@ -118,16 +118,14 @@ static const char *shaderBindings = R"(
|
|||
vec4 uObjectColor2;
|
||||
vec4 uDynLightColor;
|
||||
vec4 uAddColor;
|
||||
vec4 uBlendColor;
|
||||
vec4 uTextureAddColor;
|
||||
vec4 uTextureModulateColor;
|
||||
vec4 uTextureBlendColor;
|
||||
vec4 uFogColor;
|
||||
float uDesaturationFactor;
|
||||
float uInterpolationFactor;
|
||||
float timer; // timer data for material shaders
|
||||
int useVertexData;
|
||||
float uObjectDesaturationFactor;
|
||||
float uObjectColorizeFactor;
|
||||
int uObjectBlendMode;
|
||||
int uObjectInvertColor;
|
||||
vec4 uVertexColor;
|
||||
vec4 uVertexNormal;
|
||||
|
||||
|
|
|
@ -618,12 +618,11 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetFade, SetFade)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void SetSpecialColor(sector_t *self, int num, int color, double factor)
|
||||
static void SetSpecialColor(sector_t *self, int num, int color)
|
||||
{
|
||||
if (num >= 0 && num < 5)
|
||||
{
|
||||
self->SetSpecialColor(num, color);
|
||||
self->SetColorScaleFactor(num, factor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -632,8 +631,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetSpecialColor, SetSpecialColor)
|
|||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
PARAM_INT(num);
|
||||
PARAM_COLOR(color);
|
||||
PARAM_FLOAT(factor)
|
||||
SetSpecialColor(self, num, color, factor);
|
||||
SetSpecialColor(self, num, color);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -654,45 +652,6 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetAdditiveColor, SetAdditiveColor)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void SetBlendColor(sector_t* self, int pos, int color, int mode)
|
||||
{
|
||||
if (pos >= 0 && pos < 3)
|
||||
{
|
||||
self->SetBlendColor(pos, color);
|
||||
self->SetBlendMode(pos, mode);
|
||||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetBlendColor, SetBlendColor)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
PARAM_INT(pos);
|
||||
PARAM_COLOR(color);
|
||||
PARAM_INT(mode);
|
||||
SetBlendColor(self, pos, color, mode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void SetTextureDesaturation(sector_t* self, int pos, double factor, int invert)
|
||||
{
|
||||
if (pos >= 0 && pos < 3)
|
||||
{
|
||||
self->SetDesaturationFactor(pos, factor);
|
||||
self->SetInvertMode(pos, !!invert);
|
||||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetTextureDesaturation, SetTextureDesaturation)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
PARAM_INT(pos);
|
||||
PARAM_FLOAT(factor);
|
||||
PARAM_BOOL(invert);
|
||||
SetTextureDesaturation(self, pos, factor, invert);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void SetFogDensity(sector_t *self, int dens)
|
||||
{
|
||||
self->Colormap.FogDensity = dens;
|
||||
|
@ -1721,12 +1680,11 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetXOffset, SetXOffset)
|
|||
ACTION_RETURN_POINTER(self->V2());
|
||||
}
|
||||
|
||||
static void SetSideSpecialColor(side_t *self, int tier, int position, int color, double factor)
|
||||
static void SetSideSpecialColor(side_t *self, int tier, int position, int color)
|
||||
{
|
||||
if (tier >= 0 && tier < 3 && position >= 0 && position < 2)
|
||||
{
|
||||
self->SetSpecialColor(tier, position, color);
|
||||
if (position == 0) self->SetColorScaleFactor(tier, factor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1736,8 +1694,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetXOffset, SetXOffset)
|
|||
PARAM_INT(tier);
|
||||
PARAM_INT(position);
|
||||
PARAM_COLOR(color);
|
||||
PARAM_FLOAT(factor)
|
||||
SetSideSpecialColor(self, tier, position, color, factor);
|
||||
SetSideSpecialColor(self, tier, position, color);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1775,45 +1732,6 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetXOffset, SetXOffset)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void SetSideBlendColor(side_t* self, int tier, int color, int mode)
|
||||
{
|
||||
if (tier >= 0 && tier < 3)
|
||||
{
|
||||
self->SetBlendColor(tier, color);
|
||||
self->SetBlendMode(tier, mode);
|
||||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Side, SetBlendColor, SetSideBlendColor)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(tier);
|
||||
PARAM_COLOR(color);
|
||||
PARAM_INT(mode);
|
||||
SetSideBlendColor(self, tier, color, mode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void SetSideTextureDesaturation(side_t* self, int tier, double factor, int invert)
|
||||
{
|
||||
if (tier >= 0 && tier < 3)
|
||||
{
|
||||
self->SetDesaturationFactor(tier, factor);
|
||||
self->SetInvertMode(tier, !!invert);
|
||||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Side, SetTextureDesaturation, SetSideTextureDesaturation)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(tier);
|
||||
PARAM_FLOAT(factor);
|
||||
PARAM_BOOL(invert);
|
||||
SetSideTextureDesaturation(self, tier, factor, invert);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void EnableSideAdditiveColor(side_t *self, int tier, bool enable)
|
||||
{
|
||||
if (tier >= 0 && tier < 3)
|
||||
|
|
|
@ -671,39 +671,6 @@ xx(useowncoloradd_mid)
|
|||
xx(coloradd_mid)
|
||||
xx(useowncoloradd_bottom)
|
||||
xx(coloradd_bottom)
|
||||
xx(colorblend_top)
|
||||
xx(colorblend_mid)
|
||||
xx(colorblend_bottom)
|
||||
xx(desaturationfactor_top)
|
||||
xx(desaturationfactor_mid)
|
||||
xx(desaturationfactor_bottom)
|
||||
xx(colorscalefactor_top)
|
||||
xx(colorscalefactor_mid)
|
||||
xx(colorscalefactor_bottom)
|
||||
xx(blendmode_top)
|
||||
xx(blendmode_mid)
|
||||
xx(blendmode_bottom)
|
||||
xx(inverttexture_top)
|
||||
xx(inverttexture_mid)
|
||||
xx(inverttexture_bottom)
|
||||
xx(colorblend_floor)
|
||||
xx(colorblend_ceiling)
|
||||
xx(colorblend_walls)
|
||||
xx(desaturationfactor_floor)
|
||||
xx(desaturationfactor_ceiling)
|
||||
xx(desaturationfactor_walls)
|
||||
xx(colorscalefactor_floor)
|
||||
xx(colorscalefactor_ceiling)
|
||||
xx(colorscalefactor_walls)
|
||||
xx(blendmode_floor)
|
||||
xx(blendmode_ceiling)
|
||||
xx(blendmode_walls)
|
||||
xx(inverttexture_floor)
|
||||
xx(inverttexture_ceiling)
|
||||
xx(inverttexture_walls)
|
||||
|
||||
|
||||
|
||||
|
||||
xx(Renderstyle)
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ vec4 desaturate(vec4 texel)
|
|||
|
||||
//===========================================================================
|
||||
//
|
||||
// Texture tinting code originally from JFDuke.
|
||||
// Texture tinting code originally from JFDuke but with a few more options
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
|
@ -89,6 +89,61 @@ const int Tex_Blend_Screen = 2;
|
|||
const int Tex_Blend_Overlay = 3;
|
||||
const int Tex_Blend_Hardlight = 4;
|
||||
|
||||
vec4 ApplyTextureManipulation(vec4 texel, int blendflags)
|
||||
{
|
||||
// Step 1: desaturate according to the material's desaturation factor.
|
||||
texel = dodesaturate(texel, uTextureModulateColor.a);
|
||||
|
||||
// Step 2: Invert if requested
|
||||
if ((blendflags & 8) != 0)
|
||||
{
|
||||
texel.rgb = vec3(1.0 - texel.r, 1.0 - texel.g, 1.0 - texel.b);
|
||||
}
|
||||
|
||||
// Step 3: Apply additive color
|
||||
texel.rgb += uTextureAddColor.rgb;
|
||||
|
||||
// Step 4: Colorization, including gradient if set.
|
||||
texel.rgb *= uTextureModulateColor.rgb;
|
||||
|
||||
// Before applying the blend the value needs to be clamped to [0..1] range.
|
||||
texel.rgb = clamp(texel.rgb, 0.0, 1.0);
|
||||
|
||||
// Step 5: Apply a blend. This may just be a translucent overlay or one of the blend modes present in current Build engines.
|
||||
if (uObjectBlendMode != 0)
|
||||
{
|
||||
vec3 tcol = texel.rgb * 255.0; // * 255.0 to make it easier to reuse the integer math.
|
||||
vec4 tint = uTextureBlendColor * 255.0;
|
||||
|
||||
switch (blendflags & 7)
|
||||
{
|
||||
default:
|
||||
tcol.b = tcol.b * (1.0 - uTextureBlendColor.a) + tint.b * uTextureBlendColor.a;
|
||||
tcol.g = tcol.g * (1.0 - uTextureBlendColor.a) + tint.g * uTextureBlendColor.a;
|
||||
tcol.r = tcol.r * (1.0 - uTextureBlendColor.a) + tint.r * uTextureBlendColor.a;
|
||||
break;
|
||||
// The following 3 are taken 1:1 from the Build engine
|
||||
case Tex_Blend_Screen:
|
||||
tcol.b = 255.0 - (((255.0 - tcol.b) * (255.0 - tint.r)) / 256.0);
|
||||
tcol.g = 255.0 - (((255.0 - tcol.g) * (255.0 - tint.g)) / 256.0);
|
||||
tcol.r = 255.0 - (((255.0 - tcol.r) * (255.0 - tint.b)) / 256.0);
|
||||
break;
|
||||
case Tex_Blend_Overlay:
|
||||
tcol.b = tcol.b < 128.0? (tcol.b * tint.b) / 128.0 : 255.0 - (((255.0 - tcol.b) * (255.0 - tint.b)) / 128.0);
|
||||
tcol.g = tcol.g < 128.0? (tcol.g * tint.g) / 128.0 : 255.0 - (((255.0 - tcol.g) * (255.0 - tint.g)) / 128.0);
|
||||
tcol.r = tcol.r < 128.0? (tcol.r * tint.r) / 128.0 : 255.0 - (((255.0 - tcol.r) * (255.0 - tint.r)) / 128.0);
|
||||
break;
|
||||
case Tex_Blend_Hardlight:
|
||||
tcol.b = tint.b < 128.0 ? (tcol.b * tint.b) / 128.0 : 255.0 - (((255.0 - tcol.b) * (255.0 - tint.b)) / 128.0);
|
||||
tcol.g = tint.g < 128.0 ? (tcol.g * tint.g) / 128.0 : 255.0 - (((255.0 - tcol.g) * (255.0 - tint.g)) / 128.0);
|
||||
tcol.r = tint.r < 128.0 ? (tcol.r * tint.r) / 128.0 : 255.0 - (((255.0 - tcol.r) * (255.0 - tint.r)) / 128.0);
|
||||
break;
|
||||
}
|
||||
texel.rgb = tcol / 255.0;
|
||||
}
|
||||
return texel;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// This function is common for all (non-special-effect) fragment shaders
|
||||
|
@ -139,58 +194,21 @@ vec4 getTexel(vec2 st)
|
|||
|
||||
}
|
||||
|
||||
// Step 1: desaturate according to the material's desaturation factor.
|
||||
texel = dodesaturate(texel, uObjectDesaturationFactor);
|
||||
|
||||
// Step 2: Invert if requested
|
||||
if (uObjectInvertColor != 0)
|
||||
// Apply the texture modification colors.
|
||||
int blendflags = int(uTextureAddColor.a); // this alpha is unused otherwise
|
||||
if (blendflags != 0)
|
||||
{
|
||||
texel.rgb = vec3(1.0 - texel.r, 1.0 - texel.g, 1.0 - texel.b);
|
||||
// only apply the texture manipulation if it contains something.
|
||||
texel = ApplyTextureManipulation(texel, blendflags);
|
||||
}
|
||||
|
||||
// Step 3: Apply additive color
|
||||
|
||||
// Apply the Doom64 style material colors on top of everything from the texture modification settings.
|
||||
// This may be a bit redundant in terms of features but the data comes from different sources so this is unavoidable.
|
||||
texel.rgb += uAddColor.rgb;
|
||||
|
||||
// Step 4: Colorization, including gradient if set.
|
||||
if (uObjectColor2.a == 0.0)
|
||||
texel.rgb = clamp(texel.rgb * uObjectColor.rgb * uObjectColorizeFactor, 0.0, 1.0);
|
||||
else
|
||||
texel.rgb *= clamp(texel.rgb * mix(uObjectColor.rgb, uObjectColor2.rgb, gradientdist.z) * uObjectColorizeFactor, 0.0, 1.0);
|
||||
texel.a *= uObjectColor.a; // note that the ObjectColor can have an alpha component.
|
||||
|
||||
// Step 5: Apply a blend. This may just be a translucent overlay or one of the blend modes present in current Build engines.
|
||||
if (uObjectBlendMode != 0)
|
||||
{
|
||||
vec3 tcol = texel.rgb * 255.0; // * 255.0 to make it easier to reuse the integer math.
|
||||
vec4 tint = uBlendColor * 255.0;
|
||||
|
||||
switch (uObjectBlendMode)
|
||||
{
|
||||
default:
|
||||
tcol.b = tcol.b * (1.0 - uBlendColor.a) + tint.b * uBlendColor.a;
|
||||
tcol.g = tcol.g * (1.0 - uBlendColor.a) + tint.g * uBlendColor.a;
|
||||
tcol.r = tcol.r * (1.0 - uBlendColor.a) + tint.r * uBlendColor.a;
|
||||
break;
|
||||
// The following 3 are taken 1:1 from the Build engine
|
||||
case Tex_Blend_Screen:
|
||||
tcol.b = 255.0 - (((255.0 - tcol.b) * (255.0 - tint.r)) / 256.0);
|
||||
tcol.g = 255.0 - (((255.0 - tcol.g) * (255.0 - tint.g)) / 256.0);
|
||||
tcol.r = 255.0 - (((255.0 - tcol.r) * (255.0 - tint.b)) / 256.0);
|
||||
break;
|
||||
case Tex_Blend_Overlay:
|
||||
tcol.b = tcol.b < 128.0? (tcol.b * tint.b) / 128.0 : 255.0 - (((255.0 - tcol.b) * (255.0 - tint.b)) / 128.0);
|
||||
tcol.g = tcol.g < 128.0? (tcol.g * tint.g) / 128.0 : 255.0 - (((255.0 - tcol.g) * (255.0 - tint.g)) / 128.0);
|
||||
tcol.r = tcol.r < 128.0? (tcol.r * tint.r) / 128.0 : 255.0 - (((255.0 - tcol.r) * (255.0 - tint.r)) / 128.0);
|
||||
break;
|
||||
case Tex_Blend_Hardlight:
|
||||
tcol.b = tint.b < 128.0 ? (tcol.b * tint.b) / 128.0 : 255.0 - (((255.0 - tcol.b) * (255.0 - tint.b)) / 128.0);
|
||||
tcol.g = tint.g < 128.0 ? (tcol.g * tint.g) / 128.0 : 255.0 - (((255.0 - tcol.g) * (255.0 - tint.g)) / 128.0);
|
||||
tcol.r = tint.r < 128.0 ? (tcol.r * tint.r) / 128.0 : 255.0 - (((255.0 - tcol.r) * (255.0 - tint.r)) / 128.0);
|
||||
break;
|
||||
}
|
||||
texel.rgb = tcol / 255.0;
|
||||
}
|
||||
if (uObjectColor2.a == 0.0) texel *= uObjectColor;
|
||||
else texel *= mix(uObjectColor, uObjectColor2, gradientdist.z);
|
||||
|
||||
// Last but not least apply the desaturation from the sector's light.
|
||||
return desaturate(texel);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,4 @@
|
|||
|
||||
enum BlendModes
|
||||
{
|
||||
BLEND_Off = 0,
|
||||
BLEND_Alpha,
|
||||
BLEND_Screen,
|
||||
BLEND_Overlay,
|
||||
BLEND_Hardlight
|
||||
}
|
||||
struct SectorPortal native play
|
||||
{
|
||||
enum EType
|
||||
|
@ -91,12 +83,10 @@ struct Side native play
|
|||
native void SetTextureYScale(int which, double scale);
|
||||
native double GetTextureYScale(int which);
|
||||
native void MultiplyTextureYScale(int which, double delta);
|
||||
native void SetSpecialColor(int tier, int position, Color scolor, double factor = 1.0);
|
||||
native void SetSpecialColor(int tier, int position, Color scolor);
|
||||
native Color GetAdditiveColor(int tier);
|
||||
native void SetAdditiveColor(int tier, Color color);
|
||||
native void EnableAdditiveColor(int tier, bool enable);
|
||||
native void SetBlendColor(int tier, Color color, int mode);
|
||||
native void SetTextureDesaturation(int tier, double factor, bool invert = false);
|
||||
//native DInterpolation *SetInterpolation(int position);
|
||||
//native void StopInterpolation(int position);
|
||||
|
||||
|
@ -477,10 +467,8 @@ struct Sector native play
|
|||
native color GetGlowColor(int pos);
|
||||
native void SetGlowHeight(int pos, double height);
|
||||
native void SetGlowColor(int pos, color color);
|
||||
native void SetSpecialColor(int pos, color color, float factor = 1.0);
|
||||
native void SetSpecialColor(int pos, color color);
|
||||
native void SetAdditiveColor(int pos, Color color);
|
||||
native void SetBlendColor(int pos, Color color, int mode);
|
||||
native void SetTextureDesaturation(int pos, double factor, bool invert = false);
|
||||
|
||||
native TextureID GetTexture(int pos);
|
||||
native void SetTexture(int pos, TextureID tex, bool floorclip = true);
|
||||
|
|
Loading…
Reference in a new issue