mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-18 22:51:39 +00:00
Rename ColorAdd to AddColor, and use it ingame
Rename ColorAdd to AddColor Add AddColor to FRenderState Tweak SpecialColors array in ZScript to include the additive color Add uAddColor to the shader compiler Add uAddColor to the texel # Conflicts: # src/gl/shaders/gl_shader.cpp # src/hwrenderer/scene/hw_flats.cpp # src/hwrenderer/scene/hw_renderstate.h # src/hwrenderer/utility/hw_draw2d.cpp # Conflicts: # src/gl/scene/gl_flats.cpp # src/hwrenderer/scene/hw_flats.cpp
This commit is contained in:
parent
8dd306a081
commit
575b660b20
9 changed files with 23 additions and 4 deletions
|
@ -81,6 +81,7 @@ void FRenderState::Reset()
|
|||
mBlendEquation = GL_FUNC_ADD;
|
||||
mModelMatrixEnabled = false;
|
||||
mTextureMatrixEnabled = false;
|
||||
mAddColor = 0;
|
||||
mObjectColor = 0xffffffff;
|
||||
mObjectColor2 = 0;
|
||||
mVertexBuffer = mCurrentVertexBuffer = NULL;
|
||||
|
@ -188,6 +189,7 @@ bool FRenderState::ApplyShader()
|
|||
activeShader->muClipSplit.Set(mClipSplit);
|
||||
activeShader->muViewHeight.Set(viewheight);
|
||||
activeShader->muSpecularMaterial.Set(mGlossiness, mSpecularLevel);
|
||||
activeShader->muAddColor.Set(mAddColor); // Can this be done without a shader?
|
||||
|
||||
if (mGlowEnabled)
|
||||
{
|
||||
|
|
|
@ -100,13 +100,14 @@ class FRenderState
|
|||
|
||||
FVertexBuffer *mVertexBuffer, *mCurrentVertexBuffer;
|
||||
FStateVec4 mNormal;
|
||||
FStateVec4 mColor, mColorAdd;
|
||||
FStateVec4 mColor;
|
||||
FStateVec4 mCameraPos;
|
||||
FStateVec4 mGlowTop, mGlowBottom;
|
||||
FStateVec4 mGlowTopPlane, mGlowBottomPlane;
|
||||
FStateVec4 mGradientTopPlane, mGradientBottomPlane;
|
||||
FStateVec4 mSplitTopPlane, mSplitBottomPlane;
|
||||
FStateVec4 mClipLine;
|
||||
PalEntry mAddColor;
|
||||
PalEntry mFogColor;
|
||||
PalEntry mObjectColor;
|
||||
PalEntry mObjectColor2;
|
||||
|
@ -407,6 +408,11 @@ public:
|
|||
mObjectColor2 = pe;
|
||||
}
|
||||
|
||||
void SetAddColor(PalEntry pe)
|
||||
{
|
||||
mAddColor = pe;
|
||||
}
|
||||
|
||||
void SetSpecular(float glossiness, float specularLevel)
|
||||
{
|
||||
mGlossiness = glossiness;
|
||||
|
|
|
@ -380,6 +380,7 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
|
|||
case GLPASS_ALL: // Same, but also creates the dynlight data.
|
||||
mDrawer->SetColor(lightlevel, rel, Colormap,1.0f);
|
||||
mDrawer->SetFog(lightlevel, rel, &Colormap, false);
|
||||
gl_RenderState.SetAddColor(flat->AddColor | 0xff000000);
|
||||
if (!gltexture->tex->isFullbright())
|
||||
gl_RenderState.SetObjectColor(FlatColor | 0xff000000);
|
||||
if (sector->special != GLSector_Skybox)
|
||||
|
@ -443,6 +444,7 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
|
|||
gl_RenderState.EnableTextureMatrix(false);
|
||||
break;
|
||||
}
|
||||
gl_RenderState.SetAddColor(0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -557,14 +559,15 @@ void GLFlat::SetFrom3DFloor(F3DFloor *rover, bool top, bool underside)
|
|||
{
|
||||
Colormap.LightColor = light->extra_colormap.FadeColor;
|
||||
FlatColor = 0xffffffff;
|
||||
AddColor = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Colormap.CopyFrom3DLight(light);
|
||||
FlatColor = *plane.flatcolor;
|
||||
// AddColor = sector->SpecialColors[sector_t::add];
|
||||
}
|
||||
|
||||
|
||||
alpha = rover->alpha/255.0f;
|
||||
renderstyle = rover->flags&FF_ADDITIVETRANS? STYLE_Add : STYLE_Translucent;
|
||||
if (plane.model->VBOHeightcheck(plane.isceiling))
|
||||
|
@ -620,6 +623,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
|
|||
lightlevel = gl_ClampLight(frontsector->GetFloorLight());
|
||||
Colormap = frontsector->Colormap;
|
||||
FlatColor = frontsector->SpecialColors[sector_t::floor];
|
||||
AddColor = frontsector->SpecialColors[sector_t::add];
|
||||
port = frontsector->ValidatePortal(sector_t::floor);
|
||||
if ((stack = (port != NULL)))
|
||||
{
|
||||
|
@ -680,6 +684,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
|
|||
lightlevel = gl_ClampLight(frontsector->GetCeilingLight());
|
||||
Colormap = frontsector->Colormap;
|
||||
FlatColor = frontsector->SpecialColors[sector_t::ceiling];
|
||||
AddColor = frontsector->SpecialColors[sector_t::add];
|
||||
port = frontsector->ValidatePortal(sector_t::ceiling);
|
||||
if ((stack = (port != NULL)))
|
||||
{
|
||||
|
|
|
@ -311,6 +311,7 @@ public:
|
|||
|
||||
FColormap Colormap; // light and fog
|
||||
PalEntry FlatColor;
|
||||
PalEntry AddColor;
|
||||
ERenderStyle renderstyle;
|
||||
|
||||
float alpha;
|
||||
|
|
|
@ -317,6 +317,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
i_data += "uniform vec4 uObjectColor;\n";
|
||||
i_data += "uniform vec4 uObjectColor2;\n";
|
||||
i_data += "uniform vec4 uDynLightColor;\n";
|
||||
i_data += "uniform vec4 uAddColor;\n";
|
||||
i_data += "uniform vec4 uFogColor;\n";
|
||||
i_data += "uniform float uDesaturationFactor;\n";
|
||||
i_data += "uniform float uInterpolationFactor;\n";
|
||||
|
@ -666,6 +667,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
muShadowmapFilter.Init(hShader, "uShadowmapFilter");
|
||||
muAlphaThreshold.Init(hShader, "uAlphaThreshold");
|
||||
muSpecularMaterial.Init(hShader, "uSpecularMaterial");
|
||||
muAddColor.Init(hShader, "uAddColor");
|
||||
muViewHeight.Init(hShader, "uViewHeight");
|
||||
muTimer.Init(hShader, "timer");
|
||||
|
||||
|
|
|
@ -273,6 +273,7 @@ class FShader
|
|||
FBufferedUniform4f muDynLightColor;
|
||||
FBufferedUniformPE muObjectColor;
|
||||
FBufferedUniformPE muObjectColor2;
|
||||
FBufferedUniformPE muAddColor;
|
||||
FUniform4f muGlowBottomColor;
|
||||
FUniform4f muGlowTopColor;
|
||||
FUniform4f muGlowBottomPlane;
|
||||
|
|
|
@ -301,7 +301,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sector_t &p, sector_t
|
|||
("linked_floor", p.e->Linked.Floor.Sectors)
|
||||
("linked_ceiling", p.e->Linked.Ceiling.Sectors)
|
||||
("colormap", p.Colormap, def->Colormap)
|
||||
.Array("specialcolors", p.SpecialColors, def->SpecialColors, 5, true)
|
||||
.Array("specialcolors", p.SpecialColors, def->SpecialColors, 6, true)
|
||||
("gravity", p.gravity, def->gravity)
|
||||
.Terrain("floorterrain", p.terrainnum[0], &def->terrainnum[0])
|
||||
.Terrain("ceilingterrain", p.terrainnum[1], &def->terrainnum[1])
|
||||
|
|
|
@ -93,6 +93,8 @@ vec4 getTexel(vec2 st)
|
|||
if (uObjectColor2.a == 0.0) texel *= uObjectColor;
|
||||
else texel *= mix(uObjectColor, uObjectColor2, gradientdist.z);
|
||||
|
||||
texel += uAddColor;
|
||||
|
||||
return desaturate(texel);
|
||||
}
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ struct Sector native play
|
|||
{
|
||||
|
||||
native readonly FColormap ColorMap;
|
||||
native readonly Color SpecialColors[5];
|
||||
native readonly Color SpecialColors[6];
|
||||
|
||||
native Actor SoundTarget;
|
||||
|
||||
|
|
Loading…
Reference in a new issue