- moved hw_renderstate.h to hwrenderer folder and renamed one GL constant it was using.

This commit is contained in:
Christoph Oelckers 2018-10-20 18:37:12 +02:00
parent a4f7fd2e46
commit 510aa600dd
10 changed files with 317 additions and 270 deletions

View file

@ -497,7 +497,7 @@ void FGLRenderer::Draw2D(F2DDrawer *drawer)
gl_RenderState.SetFog(cmd.mColor1, 0);
gl_RenderState.SetColor(1, 1, 1, 1, cmd.mDesaturate);
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
gl_RenderState.AlphaFunc(Alpha_GEqual, 0.f);
if (cmd.mTexture != nullptr)
{

View file

@ -27,6 +27,7 @@
#include "gl_load/gl_interface.h"
#include "r_data/matrix.h"
#include "hwrenderer/scene//hw_drawstructs.h"
#include "hwrenderer/scene//hw_renderstate.h"
#include "hwrenderer/textures/hw_material.h"
#include "c_cvars.h"
#include "r_defs.h"
@ -40,31 +41,6 @@ extern TArray<VSMatrix> gl_MatrixStack;
EXTERN_CVAR(Bool, gl_direct_state_change)
struct FStateVec4
{
float vec[4];
void Set(float r, float g, float b, float a)
{
vec[0] = r;
vec[1] = g;
vec[2] = b;
vec[3] = a;
}
};
enum EEffect
{
EFF_NONE=-1,
EFF_FOGBOUNDARY,
EFF_SPHEREMAP,
EFF_BURN,
EFF_STENCIL,
MAX_EFFECTS
};
enum EPassType
{
NORMAL_PASS,
@ -72,225 +48,6 @@ enum EPassType
MAX_PASS_TYPES
};
class FRenderState
{
protected:
uint8_t mFogEnabled;
uint8_t mTextureEnabled:1;
uint8_t mGlowEnabled : 1;
uint8_t mBrightmapEnabled : 1;
uint8_t mModelMatrixEnabled : 1;
uint8_t mTextureMatrixEnabled : 1;
int mSpecialEffect;
int mTextureMode;
int mDesaturation;
int mSoftLight;
float mLightParms[4];
float mAlphaThreshold;
FStateVec4 mNormal;
FStateVec4 mColor;
FStateVec4 mGlowTop, mGlowBottom;
FStateVec4 mGlowTopPlane, mGlowBottomPlane;
FStateVec4 mSplitTopPlane, mSplitBottomPlane;
PalEntry mFogColor;
PalEntry mObjectColor;
PalEntry mObjectColor2;
FStateVec4 mDynColor;
public:
VSMatrix mModelMatrix;
VSMatrix mTextureMatrix;
public:
void Reset()
{
mTextureEnabled = true;
mBrightmapEnabled = mFogEnabled = mGlowEnabled = false;
mFogColor.d = -1;
mTextureMode = -1;
mDesaturation = 0;
mAlphaThreshold = 0.5f;
mModelMatrixEnabled = false;
mTextureMatrixEnabled = false;
mObjectColor = 0xffffffff;
mObjectColor2 = 0;
mSoftLight = 0;
mLightParms[0] = mLightParms[1] = mLightParms[2] = 0.0f;
mLightParms[3] = -1.f;
mSpecialEffect = EFF_NONE;
mColor.Set(1.0f, 1.0f, 1.0f, 1.0f);
mGlowTop.Set(0.0f, 0.0f, 0.0f, 0.0f);
mGlowBottom.Set(0.0f, 0.0f, 0.0f, 0.0f);
mGlowTopPlane.Set(0.0f, 0.0f, 0.0f, 0.0f);
mGlowBottomPlane.Set(0.0f, 0.0f, 0.0f, 0.0f);
mSplitTopPlane.Set(0.0f, 0.0f, 0.0f, 0.0f);
mSplitBottomPlane.Set(0.0f, 0.0f, 0.0f, 0.0f);
mDynColor.Set(0.0f, 0.0f, 0.0f, 0.0f);
mModelMatrix.loadIdentity();
mTextureMatrix.loadIdentity();
}
void SetNormal(FVector3 norm)
{
mNormal.Set(norm.X, norm.Y, norm.Z, 0.f);
}
void SetNormal(float x, float y, float z)
{
mNormal.Set(x, y, z, 0.f);
}
void SetColor(float r, float g, float b, float a = 1.f, int desat = 0)
{
mColor.Set(r, g, b, a);
mDesaturation = desat;
}
void SetColor(PalEntry pe, int desat = 0)
{
mColor.Set(pe.r / 255.f, pe.g / 255.f, pe.b / 255.f, pe.a / 255.f);
mDesaturation = desat;
}
void SetColorAlpha(PalEntry pe, float alpha = 1.f, int desat = 0)
{
mColor.Set(pe.r / 255.f, pe.g / 255.f, pe.b / 255.f, alpha);
mDesaturation = desat;
}
void ResetColor()
{
mColor.Set(1, 1, 1, 1);
mDesaturation = 0;
}
void SetTextureMode(int mode)
{
mTextureMode = mode;
}
int GetTextureMode()
{
return mTextureMode;
}
void EnableTexture(bool on)
{
mTextureEnabled = on;
}
void EnableFog(uint8_t on)
{
mFogEnabled = on;
}
void SetEffect(int eff)
{
mSpecialEffect = eff;
}
void EnableGlow(bool on)
{
mGlowEnabled = on;
}
void EnableBrightmap(bool on)
{
mBrightmapEnabled = on;
}
void EnableModelMatrix(bool on)
{
mModelMatrixEnabled = on;
}
void EnableTextureMatrix(bool on)
{
mTextureMatrixEnabled = on;
}
void SetGlowParams(float *t, float *b)
{
mGlowTop.Set(t[0], t[1], t[2], t[3]);
mGlowBottom.Set(b[0], b[1], b[2], b[3]);
}
void SetSoftLightLevel(int llevel, int blendfactor = 0)
{
if (level.lightmode == 8 && blendfactor == 0) mLightParms[3] = llevel / 255.f;
else mLightParms[3] = -1.f;
}
void SetGlowPlanes(const secplane_t &top, const secplane_t &bottom)
{
DVector3 tn = top.Normal();
DVector3 bn = bottom.Normal();
mGlowTopPlane.Set(tn.X, tn.Y, 1. / tn.Z, top.fD());
mGlowBottomPlane.Set(bn.X, bn.Y, 1. / bn.Z, bottom.fD());
}
void SetSplitPlanes(const secplane_t &top, const secplane_t &bottom)
{
DVector3 tn = top.Normal();
DVector3 bn = bottom.Normal();
mSplitTopPlane.Set(tn.X, tn.Y, 1. / tn.Z, top.fD());
mSplitBottomPlane.Set(bn.X, bn.Y, 1. / bn.Z, bottom.fD());
}
void SetDynLight(float r, float g, float b)
{
mDynColor.Set(r, g, b, 0);
}
void SetObjectColor(PalEntry pe)
{
mObjectColor = pe;
}
void SetObjectColor2(PalEntry pe)
{
mObjectColor2 = pe;
}
void SetFog(PalEntry c, float d)
{
const float LOG2E = 1.442692f; // = 1/log(2)
mFogColor = c;
if (d >= 0.0f) mLightParms[2] = d * (-LOG2E / 64000.f);
}
void SetLightParms(float f, float d)
{
mLightParms[1] = f;
mLightParms[0] = d;
}
PalEntry GetFogColor() const
{
return mFogColor;
}
void AlphaFunc(int func, float thresh)
{
if (func == GL_GREATER) mAlphaThreshold = thresh;
else mAlphaThreshold = thresh - 0.001f;
}
void SetPlaneTextureRotation(GLSectorPlane *plane, FMaterial *texture)
{
if (hw_SetPlaneTextureRotation(plane, texture, mTextureMatrix))
{
EnableTextureMatrix(true);
}
}
};
class FGLRenderState : public FRenderState
{

View file

@ -244,15 +244,15 @@ void FDrawInfo::DrawFlat(GLFlat *flat, int pass, bool trans) // trans only has m
gl_RenderState.SetObjectColor(flat->FlatColor | 0xff000000);
if (!flat->gltexture)
{
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
gl_RenderState.AlphaFunc(Alpha_GEqual, 0.f);
gl_RenderState.EnableTexture(false);
DrawSubsectors(flat, pass, true);
gl_RenderState.EnableTexture(true);
}
else
{
if (!flat->gltexture->tex->GetTranslucency()) gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold);
else gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
if (!flat->gltexture->tex->GetTranslucency()) gl_RenderState.AlphaFunc(Alpha_GEqual, gl_mask_threshold);
else gl_RenderState.AlphaFunc(Alpha_GEqual, 0.f);
gl_RenderState.SetMaterial(flat->gltexture, CLAMP_NONE, 0, -1, false);
gl_RenderState.SetPlaneTextureRotation(&plane, flat->gltexture);
DrawSubsectors(flat, pass, true);

View file

@ -430,7 +430,7 @@ void GLHorizonPortal::DrawContents(HWDrawInfo *hwdi)
gl_RenderState.SetObjectColor(origin->specialcolor);
gl_RenderState.SetPlaneTextureRotation(sp, gltexture);
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
gl_RenderState.AlphaFunc(Alpha_GEqual, 0.f);
gl_RenderState.BlendFunc(GL_ONE,GL_ZERO);
gl_RenderState.Apply();

View file

@ -166,7 +166,7 @@ void FDrawInfo::RenderScene(int recursion)
// Part 1: solid geometry. This is set up so that there are no transparent parts
glDepthFunc(GL_LESS);
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
gl_RenderState.AlphaFunc(Alpha_GEqual, 0.f);
glDisable(GL_POLYGON_OFFSET_FILL);
int pass = GLPASS_ALL;
@ -183,7 +183,7 @@ void FDrawInfo::RenderScene(int recursion)
gl_RenderState.EnableTexture(true);
gl_RenderState.SetTextureMode(TM_MASK);
}
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold);
gl_RenderState.AlphaFunc(Alpha_GEqual, gl_mask_threshold);
drawlists[GLDL_MASKEDWALLS].DrawWalls(this, pass);
drawlists[GLDL_MASKEDFLATS].DrawFlats(this, pass);
@ -228,7 +228,7 @@ void FDrawInfo::RenderTranslucent()
RenderAll.Clock();
// final pass: translucent stuff
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_sprite_threshold);
gl_RenderState.AlphaFunc(Alpha_GEqual, gl_mask_sprite_threshold);
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gl_RenderState.EnableBrightmap(true);
@ -238,7 +238,7 @@ void FDrawInfo::RenderTranslucent()
gl_RenderState.EnableBrightmap(false);
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.5f);
gl_RenderState.AlphaFunc(Alpha_GEqual, 0.5f);
glDepthMask(true);
RenderAll.Unclock();

View file

@ -226,7 +226,7 @@ void GLSkyPortal::DrawContents(HWDrawInfo *di)
gl_RenderState.ResetColor();
gl_RenderState.EnableFog(false);
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
gl_RenderState.AlphaFunc(Alpha_GEqual, 0.f);
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
bool oldClamp = gl_RenderState.SetDepthClamp(true);
@ -248,7 +248,7 @@ void GLSkyPortal::DrawContents(HWDrawInfo *di)
gl_RenderState.SetTextureMode(TM_MODULATE);
}
gl_RenderState.AlphaFunc(GL_GREATER, 0.f);
gl_RenderState.AlphaFunc(Alpha_Greater, 0.f);
if (origin->doublesky && origin->texture[1])
{

View file

@ -96,11 +96,11 @@ void FDrawInfo::DrawSprite(GLSprite *sprite, int pass)
if (sprite->hw_styleflags == STYLEHW_NoAlphaTest)
{
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
gl_RenderState.AlphaFunc(Alpha_GEqual, 0.f);
}
else
{
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_sprite_threshold);
gl_RenderState.AlphaFunc(Alpha_GEqual, gl_mask_sprite_threshold);
}
if (RenderStyle.BlendOp == STYLEOP_Shadow)
@ -120,7 +120,7 @@ void FDrawInfo::DrawSprite(GLSprite *sprite, int pass)
minalpha*=factor;
}
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_sprite_threshold);
gl_RenderState.AlphaFunc(Alpha_GEqual, gl_mask_sprite_threshold);
gl_RenderState.SetColor(0.2f,0.2f,0.2f,fuzzalpha, sprite->Colormap.Desaturation);
additivefog = true;
sprite->lightlist = nullptr; // the fuzz effect does not use the sector's light level so splitting is not needed.
@ -182,7 +182,7 @@ void FDrawInfo::DrawSprite(GLSprite *sprite, int pass)
{
foglayer = true;
// Due to the two-layer approach we need to force an alpha test that lets everything pass
gl_RenderState.AlphaFunc(GL_GREATER, 0);
gl_RenderState.AlphaFunc(Alpha_Greater, 0);
}
}
else RenderStyle.BlendOp = STYLEOP_Fuzz; // subtractive with models is not going to work.

View file

@ -70,7 +70,7 @@ void FDrawInfo::RenderFogBoundary(GLWall *wall)
SetFog(wall->lightlevel, rel, &wall->Colormap, false);
gl_RenderState.EnableDrawBuffers(1);
gl_RenderState.SetEffect(EFF_FOGBOUNDARY);
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
gl_RenderState.AlphaFunc(Alpha_GEqual, 0.f);
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(-1.0f, -128.0f);
RenderWall(wall, GLWall::RWF_BLANK);
@ -100,7 +100,7 @@ void FDrawInfo::RenderMirrorSurface(GLWall *wall)
SetColor(wall->lightlevel, 0, wall->Colormap ,0.1f);
SetFog(wall->lightlevel, 0, &wall->Colormap, true);
gl_RenderState.BlendFunc(GL_SRC_ALPHA,GL_ONE);
gl_RenderState.AlphaFunc(GL_GREATER,0);
gl_RenderState.AlphaFunc(Alpha_Greater,0);
glDepthFunc(GL_LEQUAL);
FMaterial * pat=FMaterial::ValidateTexture(TexMan.mirrorTexture, false, false);
@ -114,7 +114,7 @@ void FDrawInfo::RenderMirrorSurface(GLWall *wall)
// Restore the defaults for the translucent pass
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_sprite_threshold);
gl_RenderState.AlphaFunc(Alpha_GEqual, gl_mask_sprite_threshold);
glDepthFunc(GL_LESS);
// This is drawn in the translucent pass which is done after the decal pass
@ -215,15 +215,15 @@ void FDrawInfo::RenderTranslucentWall(GLWall *wall)
{
if (wall->gltexture)
{
if (!wall->gltexture->tex->GetTranslucency()) gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold);
else gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
if (!wall->gltexture->tex->GetTranslucency()) gl_RenderState.AlphaFunc(Alpha_GEqual, gl_mask_threshold);
else gl_RenderState.AlphaFunc(Alpha_GEqual, 0.f);
if (wall->RenderStyle == STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA,GL_ONE);
RenderTexturedWall(wall, GLWall::RWF_TEXTURED | GLWall::RWF_NOSPLIT);
if (wall->RenderStyle == STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
else
{
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
gl_RenderState.AlphaFunc(Alpha_GEqual, 0.f);
SetColor(wall->lightlevel, 0, wall->Colormap, fabsf(wall->alpha));
SetFog(wall->lightlevel, 0, &wall->Colormap, wall->RenderStyle == STYLE_Add);
gl_RenderState.EnableTexture(false);
@ -472,8 +472,8 @@ void FDrawInfo::DrawDecal(GLDecal *gldecal)
// If srcalpha is one it looks better with a higher alpha threshold
if (decal->RenderStyle.SrcAlpha == STYLEALPHA_One) gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_sprite_threshold);
else gl_RenderState.AlphaFunc(GL_GREATER, 0.f);
if (decal->RenderStyle.SrcAlpha == STYLEALPHA_One) gl_RenderState.AlphaFunc(Alpha_GEqual, gl_mask_sprite_threshold);
else gl_RenderState.AlphaFunc(Alpha_Greater, 0.f);
SetColor(gldecal->lightlevel, gldecal->rellight, gldecal->Colormap, gldecal->alpha);

View file

@ -63,20 +63,20 @@ void FDrawInfo::DrawPSprite (HUDSprite *huds)
if (huds->mframe)
{
gl_RenderState.AlphaFunc(GL_GEQUAL, 0);
gl_RenderState.AlphaFunc(Alpha_GEqual, 0);
FGLModelRenderer renderer(this, huds->lightindex);
renderer.RenderHUDModel(huds->weapon, huds->mx, huds->my);
}
else
{
float thresh = (huds->tex->tex->GetTranslucency() || huds->OverrideShader != -1) ? 0.f : gl_mask_sprite_threshold;
gl_RenderState.AlphaFunc(GL_GEQUAL, thresh);
gl_RenderState.AlphaFunc(Alpha_GEqual, thresh);
gl_RenderState.SetMaterial(huds->tex, CLAMP_XY_NOMIP, 0, huds->OverrideShader, !!(huds->RenderStyle.Flags & STYLEF_RedIsAlpha));
gl_RenderState.Apply();
GLRenderer->mVBO->RenderArray(GL_TRIANGLE_STRIP, huds->mx, 4);
}
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_sprite_threshold);
gl_RenderState.AlphaFunc(Alpha_GEqual, gl_mask_sprite_threshold);
gl_RenderState.SetObjectColor(0xffffffff);
gl_RenderState.SetDynLight(0, 0, 0);
gl_RenderState.EnableBrightmap(false);

View file

@ -0,0 +1,290 @@
#pragma once
#include "v_palette.h"
#include "vectors.h"
#include "g_levellocals.h"
#include "r_data/matrix.h"
struct FColormap;
enum EEffect
{
EFF_NONE = -1,
EFF_FOGBOUNDARY,
EFF_SPHEREMAP,
EFF_BURN,
EFF_STENCIL,
MAX_EFFECTS
};
enum
{
Alpha_GEqual = 0,
Alpha_Greater = 1
};
struct FStateVec4
{
float vec[4];
void Set(float r, float g, float b, float a)
{
vec[0] = r;
vec[1] = g;
vec[2] = b;
vec[3] = a;
}
};
class FRenderState
{
protected:
uint8_t mFogEnabled;
uint8_t mTextureEnabled:1;
uint8_t mGlowEnabled : 1;
uint8_t mBrightmapEnabled : 1;
uint8_t mModelMatrixEnabled : 1;
uint8_t mTextureMatrixEnabled : 1;
int mLightIndex;
int mSpecialEffect;
int mTextureMode;
int mDesaturation;
int mSoftLight;
float mLightParms[4];
float mAlphaThreshold;
FStateVec4 mNormal;
FStateVec4 mColor;
FStateVec4 mGlowTop, mGlowBottom;
FStateVec4 mGlowTopPlane, mGlowBottomPlane;
FStateVec4 mSplitTopPlane, mSplitBottomPlane;
PalEntry mFogColor;
PalEntry mObjectColor;
PalEntry mObjectColor2;
FStateVec4 mDynColor;
// fixed function state
float mBias[2];
bool mBiasOn;
public:
VSMatrix mModelMatrix;
VSMatrix mTextureMatrix;
public:
void Reset()
{
mTextureEnabled = true;
mBrightmapEnabled = mFogEnabled = mGlowEnabled = false;
mFogColor.d = -1;
mTextureMode = -1;
mDesaturation = 0;
mAlphaThreshold = 0.5f;
mModelMatrixEnabled = false;
mTextureMatrixEnabled = false;
mObjectColor = 0xffffffff;
mObjectColor2 = 0;
mSoftLight = 0;
mLightParms[0] = mLightParms[1] = mLightParms[2] = 0.0f;
mLightParms[3] = -1.f;
mSpecialEffect = EFF_NONE;
mLightIndex = -1;
mBiasOn = false;
mColor.Set(1.0f, 1.0f, 1.0f, 1.0f);
mGlowTop.Set(0.0f, 0.0f, 0.0f, 0.0f);
mGlowBottom.Set(0.0f, 0.0f, 0.0f, 0.0f);
mGlowTopPlane.Set(0.0f, 0.0f, 0.0f, 0.0f);
mGlowBottomPlane.Set(0.0f, 0.0f, 0.0f, 0.0f);
mSplitTopPlane.Set(0.0f, 0.0f, 0.0f, 0.0f);
mSplitBottomPlane.Set(0.0f, 0.0f, 0.0f, 0.0f);
mDynColor.Set(0.0f, 0.0f, 0.0f, 0.0f);
mModelMatrix.loadIdentity();
mTextureMatrix.loadIdentity();
}
void SetNormal(FVector3 norm)
{
mNormal.Set(norm.X, norm.Y, norm.Z, 0.f);
}
void SetNormal(float x, float y, float z)
{
mNormal.Set(x, y, z, 0.f);
}
void SetColor(float r, float g, float b, float a = 1.f, int desat = 0)
{
mColor.Set(r, g, b, a);
mDesaturation = desat;
}
void SetColor(PalEntry pe, int desat = 0)
{
mColor.Set(pe.r / 255.f, pe.g / 255.f, pe.b / 255.f, pe.a / 255.f);
mDesaturation = desat;
}
void SetColorAlpha(PalEntry pe, float alpha = 1.f, int desat = 0)
{
mColor.Set(pe.r / 255.f, pe.g / 255.f, pe.b / 255.f, alpha);
mDesaturation = desat;
}
void ResetColor()
{
mColor.Set(1, 1, 1, 1);
mDesaturation = 0;
}
void SetTextureMode(int mode)
{
mTextureMode = mode;
}
int GetTextureMode()
{
return mTextureMode;
}
void EnableTexture(bool on)
{
mTextureEnabled = on;
}
void EnableFog(uint8_t on)
{
mFogEnabled = on;
}
void SetEffect(int eff)
{
mSpecialEffect = eff;
}
void EnableGlow(bool on)
{
mGlowEnabled = on;
}
void EnableBrightmap(bool on)
{
mBrightmapEnabled = on;
}
void EnableModelMatrix(bool on)
{
mModelMatrixEnabled = on;
}
void EnableTextureMatrix(bool on)
{
mTextureMatrixEnabled = on;
}
void SetGlowParams(float *t, float *b)
{
mGlowTop.Set(t[0], t[1], t[2], t[3]);
mGlowBottom.Set(b[0], b[1], b[2], b[3]);
}
void SetSoftLightLevel(int llevel, int blendfactor = 0)
{
if (level.lightmode == 8 && blendfactor == 0) mLightParms[3] = llevel / 255.f;
else mLightParms[3] = -1.f;
}
void SetGlowPlanes(const secplane_t &top, const secplane_t &bottom)
{
DVector3 tn = top.Normal();
DVector3 bn = bottom.Normal();
mGlowTopPlane.Set(tn.X, tn.Y, 1. / tn.Z, top.fD());
mGlowBottomPlane.Set(bn.X, bn.Y, 1. / bn.Z, bottom.fD());
}
void SetSplitPlanes(const secplane_t &top, const secplane_t &bottom)
{
DVector3 tn = top.Normal();
DVector3 bn = bottom.Normal();
mSplitTopPlane.Set(tn.X, tn.Y, 1. / tn.Z, top.fD());
mSplitBottomPlane.Set(bn.X, bn.Y, 1. / bn.Z, bottom.fD());
}
void SetDynLight(float r, float g, float b)
{
mDynColor.Set(r, g, b, 0);
}
void SetObjectColor(PalEntry pe)
{
mObjectColor = pe;
}
void SetObjectColor2(PalEntry pe)
{
mObjectColor2 = pe;
}
void SetFog(PalEntry c, float d)
{
const float LOG2E = 1.442692f; // = 1/log(2)
mFogColor = c;
if (d >= 0.0f) mLightParms[2] = d * (-LOG2E / 64000.f);
}
void SetLightParms(float f, float d)
{
mLightParms[1] = f;
mLightParms[0] = d;
}
PalEntry GetFogColor() const
{
return mFogColor;
}
void AlphaFunc(int func, float thresh)
{
if (func == Alpha_Greater) mAlphaThreshold = thresh;
else mAlphaThreshold = thresh - 0.001f;
}
void SetPlaneTextureRotation(GLSectorPlane *plane, FMaterial *texture)
{
if (hw_SetPlaneTextureRotation(plane, texture, mTextureMatrix))
{
EnableTextureMatrix(true);
}
}
void SetLightIndex(int index)
{
mLightIndex = index;
}
void SetDepthBias(float a, float b)
{
mBias[0] = a;
mBias[1] = b;
mBiasOn = true;
}
void ClearDepthBias()
{
mBias[0] = 0;
mBias[1] = 0;
mBiasOn = false;
}
void SetColor(int sectorlightlevel, int rellight, bool fullbright, const FColormap &cm, float alpha, bool weapon = false);
void SetFog(int lightlevel, int rellight, bool fullbright, const FColormap *cmap, bool isadditive);
};