mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-29 07:22:07 +00:00
- removed all code that mixes together the different lighting methods. Now everything goes through the 3 different light parameters in the render state.
- removed cm parameter from many functions.
This commit is contained in:
parent
887d35d559
commit
978ace241c
31 changed files with 154 additions and 507 deletions
|
@ -241,7 +241,7 @@ bool gl_SetupLightTexture()
|
|||
|
||||
if (GLRenderer->gllight == NULL) return false;
|
||||
FMaterial * pat = FMaterial::ValidateTexture(GLRenderer->gllight);
|
||||
pat->BindPatch(CM_DEFAULT, 0);
|
||||
pat->BindPatch(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -626,7 +626,6 @@ void gl_RenderFrameModels( const FSpriteModelFrame *smf,
|
|||
const FState *curState,
|
||||
const int curTics,
|
||||
const PClass *ti,
|
||||
int cm,
|
||||
Matrix3x4 *normaltransform,
|
||||
int translation)
|
||||
{
|
||||
|
@ -684,14 +683,14 @@ void gl_RenderFrameModels( const FSpriteModelFrame *smf,
|
|||
if (mdl!=NULL)
|
||||
{
|
||||
if ( smfNext && smf->modelframes[i] != smfNext->modelframes[i] )
|
||||
mdl->RenderFrameInterpolated(smf->skins[i], smf->modelframes[i], smfNext->modelframes[i], inter, cm, translation);
|
||||
mdl->RenderFrameInterpolated(smf->skins[i], smf->modelframes[i], smfNext->modelframes[i], inter, translation);
|
||||
else
|
||||
mdl->RenderFrame(smf->skins[i], smf->modelframes[i], cm, translation);
|
||||
mdl->RenderFrame(smf->skins[i], smf->modelframes[i], translation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void gl_RenderModel(GLSprite * spr, int cm)
|
||||
void gl_RenderModel(GLSprite * spr)
|
||||
{
|
||||
FSpriteModelFrame * smf = spr->modelframe;
|
||||
|
||||
|
@ -808,11 +807,11 @@ void gl_RenderModel(GLSprite * spr, int cm)
|
|||
if (pitch != 0) NormalTransform.Rotate(0,0,1,-pitch);
|
||||
if (angle != 0) NormalTransform.Rotate(0,1,0, angle);
|
||||
|
||||
gl_RenderFrameModels( smf, spr->actor->state, spr->actor->tics, RUNTIME_TYPE(spr->actor), cm, &ModelToWorld, &NormalTransform, translation );
|
||||
gl_RenderFrameModels( smf, spr->actor->state, spr->actor->tics, RUNTIME_TYPE(spr->actor), &ModelToWorld, &NormalTransform, translation );
|
||||
}
|
||||
#endif
|
||||
|
||||
gl_RenderFrameModels( smf, spr->actor->state, spr->actor->tics, RUNTIME_TYPE(spr->actor), cm, NULL, translation );
|
||||
gl_RenderFrameModels( smf, spr->actor->state, spr->actor->tics, RUNTIME_TYPE(spr->actor), NULL, translation );
|
||||
|
||||
if (!gl.hasGLSL())
|
||||
{
|
||||
|
@ -840,7 +839,7 @@ void gl_RenderModel(GLSprite * spr, int cm)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void gl_RenderHUDModel(pspdef_t *psp, fixed_t ofsx, fixed_t ofsy, int cm)
|
||||
void gl_RenderHUDModel(pspdef_t *psp, fixed_t ofsx, fixed_t ofsy)
|
||||
{
|
||||
AActor * playermo=players[consoleplayer].camera;
|
||||
FSpriteModelFrame *smf = gl_FindModelFrame(playermo->player->ReadyWeapon->GetClass(), psp->state->sprite, psp->state->GetFrame(), false);
|
||||
|
@ -883,7 +882,7 @@ void gl_RenderHUDModel(pspdef_t *psp, fixed_t ofsx, fixed_t ofsy, int cm)
|
|||
glRotatef(smf->pitchoffset, 0, 0, 1);
|
||||
glRotatef(-smf->rolloffset, 1, 0, 0);
|
||||
|
||||
gl_RenderFrameModels( smf, psp->state, psp->tics, playermo->player->ReadyWeapon->GetClass(), cm, NULL, 0 );
|
||||
gl_RenderFrameModels( smf, psp->state, psp->tics, playermo->player->ReadyWeapon->GetClass(), NULL, 0 );
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
|
|
|
@ -27,9 +27,9 @@ public:
|
|||
|
||||
virtual bool Load(const char * fn, int lumpnum, const char * buffer, int length) = 0;
|
||||
virtual int FindFrame(const char * name) = 0;
|
||||
virtual void RenderFrame(FTexture * skin, int frame, int cm, int translation=0) = 0;
|
||||
virtual void RenderFrame(FTexture * skin, int frame, int translation=0) = 0;
|
||||
// [BB] Added RenderFrameInterpolated
|
||||
virtual void RenderFrameInterpolated(FTexture * skin, int frame, int frame2, double inter, int cm, int translation=0) = 0;
|
||||
virtual void RenderFrameInterpolated(FTexture * skin, int frame, int frame2, double inter, int translation=0) = 0;
|
||||
virtual void MakeGLData() {}
|
||||
virtual void CleanGLData() {}
|
||||
|
||||
|
@ -138,8 +138,8 @@ public:
|
|||
|
||||
virtual bool Load(const char * fn, int lumpnum, const char * buffer, int length);
|
||||
virtual int FindFrame(const char * name);
|
||||
virtual void RenderFrame(FTexture * skin, int frame, int cm, int translation=0);
|
||||
virtual void RenderFrameInterpolated(FTexture * skin, int frame, int frame2, double inter, int cm, int translation=0);
|
||||
virtual void RenderFrame(FTexture * skin, int frame, int translation=0);
|
||||
virtual void RenderFrameInterpolated(FTexture * skin, int frame, int frame2, double inter, int translation=0);
|
||||
|
||||
};
|
||||
|
||||
|
@ -228,8 +228,8 @@ public:
|
|||
|
||||
virtual bool Load(const char * fn, int lumpnum, const char * buffer, int length);
|
||||
virtual int FindFrame(const char * name);
|
||||
virtual void RenderFrame(FTexture * skin, int frame, int cm, int translation=0);
|
||||
virtual void RenderFrameInterpolated(FTexture * skin, int frame, int frame2, double inter, int cm, int translation=0);
|
||||
virtual void RenderFrame(FTexture * skin, int frame, int translation=0);
|
||||
virtual void RenderFrameInterpolated(FTexture * skin, int frame, int frame2, double inter, int translation=0);
|
||||
};
|
||||
|
||||
class FVoxelVertexBuffer;
|
||||
|
@ -291,8 +291,8 @@ public:
|
|||
void MakeGLData();
|
||||
void CleanGLData();
|
||||
virtual int FindFrame(const char * name);
|
||||
virtual void RenderFrame(FTexture * skin, int frame, int cm, int translation=0);
|
||||
virtual void RenderFrameInterpolated(FTexture * skin, int frame, int frame2, double inter, int cm, int translation=0);
|
||||
virtual void RenderFrame(FTexture * skin, int frame, int translation=0);
|
||||
virtual void RenderFrameInterpolated(FTexture * skin, int frame, int frame2, double inter, int translation=0);
|
||||
FTexture *GetPaletteTexture() const { return mPalette; }
|
||||
};
|
||||
|
||||
|
@ -344,9 +344,9 @@ class GLSprite;
|
|||
void gl_InitModels();
|
||||
FSpriteModelFrame * gl_FindModelFrame(const PClass * ti, int sprite, int frame, bool dropped);
|
||||
|
||||
void gl_RenderModel(GLSprite * spr, int cm);
|
||||
void gl_RenderModel(GLSprite * spr);
|
||||
// [BB] HUD weapon model rendering functions.
|
||||
void gl_RenderHUDModel(pspdef_t *psp, fixed_t ofsx, fixed_t ofsy, int cm);
|
||||
void gl_RenderHUDModel(pspdef_t *psp, fixed_t ofsx, fixed_t ofsy);
|
||||
bool gl_IsHUDModelForPlayerAvailable (player_t * player);
|
||||
void gl_CleanModelData();
|
||||
|
||||
|
|
|
@ -293,7 +293,7 @@ void FDMDModel::RenderGLCommands(void *glCommands, unsigned int numVertices,FMod
|
|||
}
|
||||
|
||||
|
||||
void FDMDModel::RenderFrame(FTexture * skin, int frameno, int cm, int translation)
|
||||
void FDMDModel::RenderFrame(FTexture * skin, int frameno, int translation)
|
||||
{
|
||||
int activeLod;
|
||||
|
||||
|
@ -311,7 +311,7 @@ void FDMDModel::RenderFrame(FTexture * skin, int frameno, int cm, int translatio
|
|||
|
||||
FMaterial * tex = FMaterial::ValidateTexture(skin);
|
||||
|
||||
tex->Bind(cm, 0, translation);
|
||||
tex->Bind(0, translation);
|
||||
|
||||
int numVerts = info.numVertices;
|
||||
|
||||
|
@ -337,7 +337,7 @@ void FDMDModel::RenderFrame(FTexture * skin, int frameno, int cm, int translatio
|
|||
RenderGLCommands(lods[activeLod].glCommands, numVerts, frame->vertices/*, modelColors, NULL*/);
|
||||
}
|
||||
|
||||
void FDMDModel::RenderFrameInterpolated(FTexture * skin, int frameno, int frameno2, double inter, int cm, int translation)
|
||||
void FDMDModel::RenderFrameInterpolated(FTexture * skin, int frameno, int frameno2, double inter, int translation)
|
||||
{
|
||||
int activeLod = 0;
|
||||
|
||||
|
@ -355,7 +355,7 @@ void FDMDModel::RenderFrameInterpolated(FTexture * skin, int frameno, int framen
|
|||
|
||||
FMaterial * tex = FMaterial::ValidateTexture(skin);
|
||||
|
||||
tex->Bind(cm, 0, translation);
|
||||
tex->Bind(0, translation);
|
||||
|
||||
int numVerts = info.numVertices;
|
||||
|
||||
|
|
|
@ -232,7 +232,7 @@ void FMD3Model::RenderTriangles(MD3Surface * surf, MD3Vertex * vert)
|
|||
glEnd();
|
||||
}
|
||||
|
||||
void FMD3Model::RenderFrame(FTexture * skin, int frameno, int cm, int translation)
|
||||
void FMD3Model::RenderFrame(FTexture * skin, int frameno, int translation)
|
||||
{
|
||||
if (frameno>=numFrames) return;
|
||||
|
||||
|
@ -258,12 +258,12 @@ void FMD3Model::RenderFrame(FTexture * skin, int frameno, int cm, int translatio
|
|||
|
||||
FMaterial * tex = FMaterial::ValidateTexture(surfaceSkin);
|
||||
|
||||
tex->Bind(cm, 0, translation);
|
||||
tex->Bind(0, translation);
|
||||
RenderTriangles(surf, surf->vertices + frameno * surf->numVertices);
|
||||
}
|
||||
}
|
||||
|
||||
void FMD3Model::RenderFrameInterpolated(FTexture * skin, int frameno, int frameno2, double inter, int cm, int translation)
|
||||
void FMD3Model::RenderFrameInterpolated(FTexture * skin, int frameno, int frameno2, double inter, int translation)
|
||||
{
|
||||
if (frameno>=numFrames || frameno2>=numFrames) return;
|
||||
|
||||
|
@ -283,7 +283,7 @@ void FMD3Model::RenderFrameInterpolated(FTexture * skin, int frameno, int framen
|
|||
|
||||
FMaterial * tex = FMaterial::ValidateTexture(surfaceSkin);
|
||||
|
||||
tex->Bind(cm, 0, translation);
|
||||
tex->Bind(0, translation);
|
||||
|
||||
MD3Vertex* verticesInterpolated = new MD3Vertex[surfaces[i].numVertices];
|
||||
MD3Vertex* vertices1 = surf->vertices + frameno * surf->numVertices;
|
||||
|
|
|
@ -502,10 +502,10 @@ int FVoxelModel::FindFrame(const char * name)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void FVoxelModel::RenderFrame(FTexture * skin, int frame, int cm, int translation)
|
||||
void FVoxelModel::RenderFrame(FTexture * skin, int frame, int translation)
|
||||
{
|
||||
FMaterial * tex = FMaterial::ValidateTexture(skin);
|
||||
tex->Bind(cm, 0, translation);
|
||||
tex->Bind(0, translation);
|
||||
|
||||
if (mVBO == NULL) MakeGLData();
|
||||
if (mVBO != NULL)
|
||||
|
@ -535,8 +535,8 @@ void FVoxelModel::RenderFrame(FTexture * skin, int frame, int cm, int translatio
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void FVoxelModel::RenderFrameInterpolated(FTexture * skin, int frame, int frame2, double inter, int cm, int translation)
|
||||
void FVoxelModel::RenderFrameInterpolated(FTexture * skin, int frame, int frame2, double inter, int translation)
|
||||
{
|
||||
RenderFrame(skin, frame, cm, translation);
|
||||
RenderFrame(skin, frame, translation);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ enum EColorManipulation
|
|||
// These are not to be passed to the texture manager
|
||||
CM_LITE = 0x20000000, // special values to handle these items without excessive hacking
|
||||
CM_TORCH= 0x20000010, // These are not real color manipulations
|
||||
CM_FOGLAYER= 0x20000020, // Sprite shaped fog layer - this is only used as a parameter to FMaterial::BindPatch
|
||||
CM_FOGLAYER= 0x20000020, // Sprite shaped fog layer
|
||||
};
|
||||
|
||||
#define CM_MAXCOLORMAP int(CM_FIRSTSPECIALCOLORMAP + SpecialColormaps.Size())
|
||||
|
|
|
@ -333,13 +333,13 @@ void FGLRenderer::DrawTexture(FTexture *img, DCanvas::DrawParms &parms)
|
|||
GLTranslationPalette * pal = static_cast<GLTranslationPalette*>(parms.remap->GetNative());
|
||||
if (pal) translation = -pal->GetIndex();
|
||||
}
|
||||
gltex->BindPatch(CM_DEFAULT, translation);
|
||||
gltex->BindPatch(translation);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is an alpha texture
|
||||
gl_RenderState.SetTextureMode(TM_REDTOALPHA);
|
||||
gltex->BindPatch(CM_SHADE, 0);
|
||||
gltex->BindPatch(0);
|
||||
}
|
||||
|
||||
u1 = gltex->GetUL();
|
||||
|
@ -349,7 +349,7 @@ void FGLRenderer::DrawTexture(FTexture *img, DCanvas::DrawParms &parms)
|
|||
}
|
||||
else
|
||||
{
|
||||
gltex->Bind(CM_DEFAULT, 0, 0);
|
||||
gltex->Bind(0, 0);
|
||||
u2=1.f;
|
||||
v2=-1.f;
|
||||
u1 = v1 = 0.f;
|
||||
|
@ -519,7 +519,7 @@ void FGLRenderer::FlatFill (int left, int top, int right, int bottom, FTexture *
|
|||
|
||||
if (!gltexture) return;
|
||||
|
||||
gltexture->Bind(CM_DEFAULT, 0, 0);
|
||||
gltexture->Bind(0, 0);
|
||||
|
||||
// scaling is not used here.
|
||||
if (!local_origin)
|
||||
|
@ -613,7 +613,7 @@ void FGLRenderer::FillSimplePoly(FTexture *texture, FVector2 *points, int npoint
|
|||
PalEntry pe = gl_CalcLightColor(lightlevel, cm.LightColor, cm.blendfactor, true);
|
||||
glColor3ub(pe.r, pe.g, pe.b);
|
||||
|
||||
gltexture->Bind(cm.colormap);
|
||||
gltexture->Bind();
|
||||
|
||||
int i;
|
||||
float rot = float(rotation * M_PI / float(1u << 31));
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
void DrawScene(bool toscreen = false);
|
||||
void DrawBlend(sector_t * viewsector);
|
||||
|
||||
void DrawPSprite (player_t * player,pspdef_t *psp,fixed_t sx, fixed_t sy, int cm_index, bool hudModelStep, int OverrideShader);
|
||||
void DrawPSprite (player_t * player,pspdef_t *psp,fixed_t sx, fixed_t sy, bool hudModelStep, int OverrideShader);
|
||||
void DrawPlayerSprites(sector_t * viewsector, bool hudModelStep);
|
||||
void DrawTargeterSprites();
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@ void FRenderState::Reset()
|
|||
glBlendEquation = -1;
|
||||
m2D = true;
|
||||
mVertexBuffer = mCurrentVertexBuffer = NULL;
|
||||
mColormapState = CM_DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,33 +92,18 @@ void FRenderState::Reset()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int FRenderState::SetupShader(bool cameratexture, int &shaderindex, int &cm, float warptime)
|
||||
int FRenderState::SetupShader(bool cameratexture, int &shaderindex, float warptime)
|
||||
{
|
||||
int softwarewarp = 0;
|
||||
|
||||
|
||||
if (gl.hasGLSL())
|
||||
{
|
||||
if (shaderindex == 3)
|
||||
{
|
||||
// Brightmap should not be used.
|
||||
if (!mBrightmapEnabled || cm >= CM_FIRSTSPECIALCOLORMAP)
|
||||
{
|
||||
shaderindex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
mColormapState = cm;
|
||||
if (cm > CM_DEFAULT && cm < CM_MAXCOLORMAP && mTextureMode != TM_MASK)
|
||||
{
|
||||
cm = CM_DEFAULT;
|
||||
}
|
||||
mEffectState = shaderindex;
|
||||
mWarpTime = warptime;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cm != CM_SHADE) cm = CM_DEFAULT;
|
||||
softwarewarp = shaderindex > 0 && shaderindex < 3? shaderindex : 0;
|
||||
shaderindex = 0;
|
||||
}
|
||||
|
@ -134,30 +120,21 @@ int FRenderState::SetupShader(bool cameratexture, int &shaderindex, int &cm, flo
|
|||
|
||||
bool FRenderState::ApplyShader()
|
||||
{
|
||||
bool useshaders = false;
|
||||
FShader *activeShader = NULL;
|
||||
|
||||
if (mSpecialEffect > 0 && gl.hasGLSL())
|
||||
if (gl.hasGLSL())
|
||||
{
|
||||
FShader *activeShader;
|
||||
if (mSpecialEffect > 0)
|
||||
{
|
||||
activeShader = GLRenderer->mShaderManager->BindEffect(mSpecialEffect);
|
||||
}
|
||||
else if (gl.hasGLSL())
|
||||
{
|
||||
useshaders = (!m2D || mEffectState != 0 || mColormapState); // all 3D rendering and 2D with texture effects.
|
||||
if (useshaders)
|
||||
{
|
||||
FShaderContainer *shd = GLRenderer->mShaderManager->Get(mTextureEnabled ? mEffectState : 4);
|
||||
|
||||
if (shd != NULL)
|
||||
{
|
||||
activeShader = shd->Bind(mColormapState, mGlowEnabled, mWarpTime, mLightEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (activeShader)
|
||||
{
|
||||
int fogset = 0;
|
||||
//glColor4fv(mColor.vec);
|
||||
if (mFogEnabled)
|
||||
|
|
|
@ -143,7 +143,7 @@ public:
|
|||
|
||||
void Reset();
|
||||
|
||||
int SetupShader(bool cameratexture, int &shaderindex, int &cm, float warptime);
|
||||
int SetupShader(bool cameratexture, int &shaderindex, float warptime);
|
||||
void Apply(bool forcenoshader = false);
|
||||
|
||||
void SetVertexBuffer(FVertexBuffer *vb)
|
||||
|
|
|
@ -329,7 +329,7 @@ void GLWall::DrawDecal(DBaseDecal *decal)
|
|||
|
||||
|
||||
gl_SetRenderStyle(decal->RenderStyle, false, false);
|
||||
tex->BindPatch(p.colormap, decal->Translation);
|
||||
tex->BindPatch(decal->Translation);
|
||||
|
||||
|
||||
// If srcalpha is one it looks better with a higher alpha threshold
|
||||
|
|
|
@ -1068,7 +1068,7 @@ void FDrawInfo::DrawFloodedPlane(wallseg * ws, float planez, sector_t * sec, boo
|
|||
int rel = getExtraLight();
|
||||
gl_SetColor(lightlevel, rel, &Colormap, 1.0f);
|
||||
gl_SetFog(lightlevel, rel, &Colormap, false);
|
||||
gltexture->Bind(Colormap.colormap);
|
||||
gltexture->Bind();
|
||||
|
||||
float fviewx = FIXED2FLOAT(viewx);
|
||||
float fviewy = FIXED2FLOAT(viewy);
|
||||
|
|
|
@ -407,7 +407,7 @@ void GLFlat::Draw(int pass)
|
|||
// fall through
|
||||
case GLPASS_TEXTURE:
|
||||
{
|
||||
gltexture->Bind(Colormap.colormap);
|
||||
gltexture->Bind();
|
||||
bool pushed = gl_SetPlaneTextureRotation(&plane, gltexture);
|
||||
DrawSubsectors(pass, false);
|
||||
if (pushed)
|
||||
|
@ -471,7 +471,7 @@ void GLFlat::Draw(int pass)
|
|||
else
|
||||
{
|
||||
if (foggy) gl_RenderState.EnableBrightmap(false);
|
||||
gltexture->Bind(Colormap.colormap);
|
||||
gltexture->Bind();
|
||||
bool pushed = gl_SetPlaneTextureRotation(&plane, gltexture);
|
||||
DrawSubsectors(pass, true);
|
||||
gl_RenderState.EnableBrightmap(true);
|
||||
|
@ -515,7 +515,7 @@ inline void GLFlat::PutFlat(bool fog)
|
|||
{ { GLDL_LIGHT, GLDL_LIGHTFOG }, { GLDL_LIGHTMASKED, GLDL_LIGHTFOGMASKED } }
|
||||
};
|
||||
|
||||
bool light = gl_forcemultipass;
|
||||
bool light = false;
|
||||
bool masked = gltexture->isMasked() && ((renderflags&SSRF_RENDER3DPLANES) || stack);
|
||||
|
||||
if (!gl_fixedcolormap)
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
#include "gl/dynlights/gl_glow.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
|
@ -187,7 +188,7 @@ bool GLPortal::Start(bool usestencil, bool doquery)
|
|||
glStencilOp(GL_KEEP,GL_KEEP,GL_INCR); // increment stencil of valid pixels
|
||||
glColorMask(0,0,0,0); // don't write to the graphics buffer
|
||||
gl_RenderState.EnableTexture(false);
|
||||
glColor3f(1,1,1);
|
||||
gl_RenderState.ResetColor();
|
||||
glDepthFunc(GL_LESS);
|
||||
gl_RenderState.Apply();
|
||||
|
||||
|
@ -345,9 +346,8 @@ void GLPortal::End(bool usestencil)
|
|||
in_area=savedviewarea;
|
||||
GLRenderer->SetupView(viewx, viewy, viewz, viewangle, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
|
||||
|
||||
glColor4f(1,1,1,1);
|
||||
glColorMask(0,0,0,0); // no graphics
|
||||
glColor3f(1,1,1);
|
||||
gl_RenderState.ResetColor();
|
||||
gl_RenderState.EnableTexture(false);
|
||||
gl_RenderState.Apply();
|
||||
|
||||
|
@ -404,7 +404,7 @@ void GLPortal::End(bool usestencil)
|
|||
// This draws a valid z-buffer into the stencil's contents to ensure it
|
||||
// doesn't get overwritten by the level's geometry.
|
||||
|
||||
glColor4f(1,1,1,1);
|
||||
gl_RenderState.ResetColor();
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
glDepthRange(0,1);
|
||||
glColorMask(0,0,0,0); // no graphics
|
||||
|
@ -604,7 +604,7 @@ void GLSkyboxPortal::DrawContents()
|
|||
|
||||
PlaneMirrorMode=0;
|
||||
|
||||
glDisable(GL_DEPTH_CLAMP_NV);
|
||||
glDisable(GL_DEPTH_CLAMP);
|
||||
|
||||
viewx = origin->PrevX + FixedMul(r_TicFrac, origin->x - origin->PrevX);
|
||||
viewy = origin->PrevY + FixedMul(r_TicFrac, origin->y - origin->PrevY);
|
||||
|
@ -634,7 +634,7 @@ void GLSkyboxPortal::DrawContents()
|
|||
GLRenderer->DrawScene();
|
||||
origin->flags&=~MF_JUSTHIT;
|
||||
inskybox=false;
|
||||
glEnable(GL_DEPTH_CLAMP_NV);
|
||||
glEnable(GL_DEPTH_CLAMP);
|
||||
skyboxrecursion--;
|
||||
|
||||
PlaneMirrorMode=old_pm;
|
||||
|
@ -844,12 +844,12 @@ void GLMirrorPortal::DrawContents()
|
|||
// any mirror--use floats to avoid integer overflow.
|
||||
// Use doubles to avoid losing precision which is very important here.
|
||||
|
||||
double dx = FIXED2FLOAT(v2->x - v1->x);
|
||||
double dy = FIXED2FLOAT(v2->y - v1->y);
|
||||
double x1 = FIXED2FLOAT(v1->x);
|
||||
double y1 = FIXED2FLOAT(v1->y);
|
||||
double x = FIXED2FLOAT(startx);
|
||||
double y = FIXED2FLOAT(starty);
|
||||
double dx = FIXED2DBL(v2->x - v1->x);
|
||||
double dy = FIXED2DBL(v2->y - v1->y);
|
||||
double x1 = FIXED2DBL(v1->x);
|
||||
double y1 = FIXED2DBL(v1->y);
|
||||
double x = FIXED2DBL(startx);
|
||||
double y = FIXED2DBL(starty);
|
||||
|
||||
// the above two cases catch len == 0
|
||||
double r = ((x - x1)*dx + (y - y1)*dy) / (dx*dx + dy*dy);
|
||||
|
@ -962,7 +962,7 @@ void GLHorizonPortal::DrawContents()
|
|||
if (gltexture && gltexture->tex->isFullbright())
|
||||
{
|
||||
// glowing textures are always drawn full bright without color
|
||||
gl_SetColor(255, 0, NULL, 1.f);
|
||||
gl_SetColor(255, 0, &origin->colormap, 1.f);
|
||||
gl_SetFog(255, 0, &origin->colormap, false);
|
||||
}
|
||||
else
|
||||
|
@ -973,7 +973,7 @@ void GLHorizonPortal::DrawContents()
|
|||
}
|
||||
|
||||
|
||||
gltexture->Bind(origin->colormap.colormap);
|
||||
gltexture->Bind();
|
||||
|
||||
gl_RenderState.EnableAlphaTest(false);
|
||||
gl_RenderState.BlendFunc(GL_ONE,GL_ZERO);
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/dynlights/gl_glow.h"
|
||||
#include "gl/dynlights/gl_lightbuffer.h"
|
||||
#include "gl/scene/gl_drawinfo.h"
|
||||
#include "gl/scene/gl_portal.h"
|
||||
#include "gl/utility/gl_clock.h"
|
||||
|
|
|
@ -85,7 +85,6 @@ CVAR(Bool, gl_texture, true, 0)
|
|||
CVAR(Bool, gl_no_skyclear, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
CVAR(Float, gl_mask_threshold, 0.5f,CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
CVAR(Float, gl_mask_sprite_threshold, 0.5f,CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
CVAR(Bool, gl_forcemultipass, false, 0)
|
||||
|
||||
EXTERN_CVAR (Int, screenblocks)
|
||||
EXTERN_CVAR (Bool, cl_capfps)
|
||||
|
@ -845,6 +844,7 @@ void FGLRenderer::EndDrawScene(sector_t * viewsector)
|
|||
{
|
||||
DrawPlayerSprites (viewsector, false);
|
||||
}
|
||||
gl_RenderState.SetFixedColormap(CM_DEFAULT);
|
||||
DrawTargeterSprites();
|
||||
DrawBlend(viewsector);
|
||||
|
||||
|
@ -918,6 +918,7 @@ void FGLRenderer::SetFixedColormap (player_t *player)
|
|||
}
|
||||
}
|
||||
}
|
||||
gl_RenderState.SetFixedColormap(gl_fixedcolormap);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -1060,6 +1061,7 @@ void FGLRenderer::WriteSavePic (player_t *player, FILE *file, int width, int hei
|
|||
sector_t *viewsector = RenderViewpoint(players[consoleplayer].camera, &bounds,
|
||||
FieldOfView * 360.0f / FINEANGLES, 1.6f, 1.6f, true, false);
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
gl_RenderState.SetFixedColormap(CM_DEFAULT);
|
||||
screen->Begin2D(false);
|
||||
DrawBlend(viewsector);
|
||||
glFlush();
|
||||
|
@ -1235,6 +1237,7 @@ void FGLInterface::RenderTextureView (FCanvasTexture *tex, AActor *Viewpoint, in
|
|||
int height = gltex->TextureHeight(GLUSE_TEXTURE);
|
||||
|
||||
gl_fixedcolormap=CM_DEFAULT;
|
||||
gl_RenderState.SetFixedColormap(CM_DEFAULT);
|
||||
|
||||
bool usefb;
|
||||
|
||||
|
@ -1279,7 +1282,7 @@ void FGLInterface::RenderTextureView (FCanvasTexture *tex, AActor *Viewpoint, in
|
|||
if (!usefb)
|
||||
{
|
||||
glFlush();
|
||||
gltex->Bind(CM_DEFAULT, 0, 0);
|
||||
gltex->Bind(0, 0);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, bounds.width, bounds.height);
|
||||
}
|
||||
else
|
||||
|
@ -1287,7 +1290,7 @@ void FGLInterface::RenderTextureView (FCanvasTexture *tex, AActor *Viewpoint, in
|
|||
GLRenderer->EndOffscreen();
|
||||
}
|
||||
|
||||
gltex->Bind(CM_DEFAULT, 0, 0);
|
||||
gltex->Bind(0, 0);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[gl_texture_filter].magfilter);
|
||||
tex->SetUpdated();
|
||||
}
|
||||
|
|
|
@ -78,12 +78,10 @@ static int texw;
|
|||
static float yAdd;
|
||||
static bool foglayer;
|
||||
static bool secondlayer;
|
||||
static float R,G,B;
|
||||
static bool skymirror;
|
||||
|
||||
#define SKYHEMI_UPPER 0x1
|
||||
#define SKYHEMI_LOWER 0x2
|
||||
#define SKYHEMI_JUST_CAP 0x4 // Just draw the top or bottom cap.
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -111,7 +109,8 @@ static void SkyVertex(int r, int c)
|
|||
|
||||
if (!foglayer)
|
||||
{
|
||||
gl_SetColor(255, 0, NULL, r==0? 0.0f : 1.0f);
|
||||
// this cannot use the renderstate because it's inside a primitive.
|
||||
glColor4f(1.f, 1.f, 1.f, r==0? 0.0f : 1.0f);
|
||||
|
||||
// And the texture coordinates.
|
||||
if(!yflip) // Flipped Y is for the lower hemisphere.
|
||||
|
@ -165,30 +164,24 @@ static void RenderSkyHemisphere(int hemi, bool mirror)
|
|||
// two rows because the first one is always faded.
|
||||
rows = 4;
|
||||
|
||||
if (hemi & SKYHEMI_JUST_CAP)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Draw the cap as one solid color polygon
|
||||
if (!foglayer)
|
||||
{
|
||||
columns = 4 * (gl_sky_detail > 0 ? gl_sky_detail : 1);
|
||||
foglayer=true;
|
||||
gl_RenderState.EnableTexture(false);
|
||||
gl_RenderState.Apply(true);
|
||||
gl_RenderState.Apply();
|
||||
|
||||
|
||||
if (!secondlayer)
|
||||
{
|
||||
glColor3f(R, G ,B);
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
for(c = 0; c < columns; c++)
|
||||
{
|
||||
SkyVertex(1, c);
|
||||
}
|
||||
glEnd();
|
||||
gl_RenderState.SetObjectColor(0xffffffff); // unset the cap's color
|
||||
}
|
||||
|
||||
gl_RenderState.EnableTexture(true);
|
||||
|
@ -197,7 +190,7 @@ static void RenderSkyHemisphere(int hemi, bool mirror)
|
|||
}
|
||||
else
|
||||
{
|
||||
gl_RenderState.Apply(true);
|
||||
gl_RenderState.Apply();
|
||||
columns=4; // no need to do more!
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
for(c = 0; c < columns; c++)
|
||||
|
@ -246,7 +239,7 @@ static void RenderSkyHemisphere(int hemi, bool mirror)
|
|||
//-----------------------------------------------------------------------------
|
||||
CVAR(Float, skyoffset, 0, 0) // for testing
|
||||
|
||||
static void RenderDome(FTextureID texno, FMaterial * tex, float x_offset, float y_offset, bool mirror, int CM_Index)
|
||||
static void RenderDome(FTextureID texno, FMaterial * tex, float x_offset, float y_offset, bool mirror)
|
||||
{
|
||||
int texh = 0;
|
||||
bool texscale = false;
|
||||
|
@ -257,7 +250,7 @@ static void RenderDome(FTextureID texno, FMaterial * tex, float x_offset, float
|
|||
if (tex)
|
||||
{
|
||||
glPushMatrix();
|
||||
tex->Bind(CM_Index, 0, 0);
|
||||
tex->Bind(0, 0);
|
||||
texw = tex->TextureWidth(GLUSE_TEXTURE);
|
||||
texh = tex->TextureHeight(GLUSE_TEXTURE);
|
||||
|
||||
|
@ -290,20 +283,7 @@ static void RenderDome(FTextureID texno, FMaterial * tex, float x_offset, float
|
|||
if (tex && !secondlayer)
|
||||
{
|
||||
PalEntry pe = tex->tex->GetSkyCapColor(false);
|
||||
|
||||
R=pe.r/255.0f;
|
||||
G=pe.g/255.0f;
|
||||
B=pe.b/255.0f;
|
||||
|
||||
if (gl_fixedcolormap)
|
||||
{
|
||||
float rr, gg, bb;
|
||||
|
||||
gl_GetLightColor(255, 0, NULL, &rr, &gg, &bb);
|
||||
R*=rr;
|
||||
G*=gg;
|
||||
B*=bb;
|
||||
}
|
||||
gl_RenderState.SetObjectColor(pe);
|
||||
}
|
||||
|
||||
RenderSkyHemisphere(SKYHEMI_UPPER, mirror);
|
||||
|
@ -311,19 +291,7 @@ static void RenderDome(FTextureID texno, FMaterial * tex, float x_offset, float
|
|||
if (tex && !secondlayer)
|
||||
{
|
||||
PalEntry pe = tex->tex->GetSkyCapColor(true);
|
||||
R=pe.r/255.0f;
|
||||
G=pe.g/255.0f;
|
||||
B=pe.b/255.0f;
|
||||
|
||||
if (gl_fixedcolormap != CM_DEFAULT)
|
||||
{
|
||||
float rr,gg,bb;
|
||||
|
||||
gl_GetLightColor(255, 0, NULL, &rr, &gg, &bb);
|
||||
R*=rr;
|
||||
G*=gg;
|
||||
B*=bb;
|
||||
}
|
||||
gl_RenderState.SetObjectColor(pe);
|
||||
}
|
||||
|
||||
RenderSkyHemisphere(SKYHEMI_LOWER, mirror);
|
||||
|
@ -344,7 +312,7 @@ static void RenderDome(FTextureID texno, FMaterial * tex, float x_offset, float
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static void RenderBox(FTextureID texno, FMaterial * gltex, float x_offset, int CM_Index, bool sky2)
|
||||
static void RenderBox(FTextureID texno, FMaterial * gltex, float x_offset, bool sky2)
|
||||
{
|
||||
FSkyBox * sb = static_cast<FSkyBox*>(gltex->tex);
|
||||
int faces;
|
||||
|
@ -355,15 +323,13 @@ static void RenderBox(FTextureID texno, FMaterial * gltex, float x_offset, int C
|
|||
else
|
||||
glRotatef(-180.0f+x_offset, glset.skyrotatevector2.X, glset.skyrotatevector2.Z, glset.skyrotatevector2.Y);
|
||||
|
||||
glColor3f(R, G ,B);
|
||||
|
||||
if (sb->faces[5])
|
||||
{
|
||||
faces=4;
|
||||
|
||||
// north
|
||||
tex = FMaterial::ValidateTexture(sb->faces[0]);
|
||||
tex->Bind(CM_Index, GLT_CLAMPX|GLT_CLAMPY, 0);
|
||||
tex->Bind(GLT_CLAMPX|GLT_CLAMPY, 0);
|
||||
gl_RenderState.Apply();
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glTexCoord2f(0, 0);
|
||||
|
@ -378,7 +344,7 @@ static void RenderBox(FTextureID texno, FMaterial * gltex, float x_offset, int C
|
|||
|
||||
// east
|
||||
tex = FMaterial::ValidateTexture(sb->faces[1]);
|
||||
tex->Bind(CM_Index, GLT_CLAMPX|GLT_CLAMPY, 0);
|
||||
tex->Bind(GLT_CLAMPX|GLT_CLAMPY, 0);
|
||||
gl_RenderState.Apply();
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glTexCoord2f(0, 0);
|
||||
|
@ -393,7 +359,7 @@ static void RenderBox(FTextureID texno, FMaterial * gltex, float x_offset, int C
|
|||
|
||||
// south
|
||||
tex = FMaterial::ValidateTexture(sb->faces[2]);
|
||||
tex->Bind(CM_Index, GLT_CLAMPX|GLT_CLAMPY, 0);
|
||||
tex->Bind(GLT_CLAMPX|GLT_CLAMPY, 0);
|
||||
gl_RenderState.Apply();
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glTexCoord2f(0, 0);
|
||||
|
@ -408,7 +374,7 @@ static void RenderBox(FTextureID texno, FMaterial * gltex, float x_offset, int C
|
|||
|
||||
// west
|
||||
tex = FMaterial::ValidateTexture(sb->faces[3]);
|
||||
tex->Bind(CM_Index, GLT_CLAMPX|GLT_CLAMPY, 0);
|
||||
tex->Bind(GLT_CLAMPX|GLT_CLAMPY, 0);
|
||||
gl_RenderState.Apply();
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glTexCoord2f(0, 0);
|
||||
|
@ -426,7 +392,7 @@ static void RenderBox(FTextureID texno, FMaterial * gltex, float x_offset, int C
|
|||
faces=1;
|
||||
// all 4 sides
|
||||
tex = FMaterial::ValidateTexture(sb->faces[0]);
|
||||
tex->Bind(CM_Index, GLT_CLAMPX|GLT_CLAMPY, 0);
|
||||
tex->Bind(GLT_CLAMPX|GLT_CLAMPY, 0);
|
||||
|
||||
gl_RenderState.Apply();
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
|
@ -479,7 +445,7 @@ static void RenderBox(FTextureID texno, FMaterial * gltex, float x_offset, int C
|
|||
|
||||
// top
|
||||
tex = FMaterial::ValidateTexture(sb->faces[faces]);
|
||||
tex->Bind(CM_Index, GLT_CLAMPX|GLT_CLAMPY, 0);
|
||||
tex->Bind(GLT_CLAMPX|GLT_CLAMPY, 0);
|
||||
gl_RenderState.Apply();
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
if (!sb->fliptop)
|
||||
|
@ -509,7 +475,7 @@ static void RenderBox(FTextureID texno, FMaterial * gltex, float x_offset, int C
|
|||
|
||||
// bottom
|
||||
tex = FMaterial::ValidateTexture(sb->faces[faces+1]);
|
||||
tex->Bind(CM_Index, GLT_CLAMPX|GLT_CLAMPY, 0);
|
||||
tex->Bind(GLT_CLAMPX|GLT_CLAMPY, 0);
|
||||
gl_RenderState.Apply();
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glTexCoord2f(0, 0);
|
||||
|
@ -533,7 +499,6 @@ static void RenderBox(FTextureID texno, FMaterial * gltex, float x_offset, int C
|
|||
void GLSkyPortal::DrawContents()
|
||||
{
|
||||
bool drawBoth = false;
|
||||
int CM_Index;
|
||||
PalEntry FadeColor(0,0,0,0);
|
||||
|
||||
// We have no use for Doom lighting special handling here, so disable it for this function.
|
||||
|
@ -541,16 +506,12 @@ void GLSkyPortal::DrawContents()
|
|||
if (glset.lightmode == 8) glset.lightmode = 2;
|
||||
|
||||
|
||||
if (gl_fixedcolormap)
|
||||
if (!gl_fixedcolormap)
|
||||
{
|
||||
CM_Index=gl_fixedcolormap<CM_FIRSTSPECIALCOLORMAP + SpecialColormaps.Size()? gl_fixedcolormap:CM_DEFAULT;
|
||||
}
|
||||
else
|
||||
{
|
||||
CM_Index=CM_DEFAULT;
|
||||
FadeColor=origin->fadecolor;
|
||||
FadeColor = origin->fadecolor;
|
||||
}
|
||||
|
||||
gl_RenderState.SetColor(0xffffffff);
|
||||
gl_RenderState.EnableFog(false);
|
||||
gl_RenderState.EnableAlphaTest(false);
|
||||
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
@ -561,18 +522,7 @@ void GLSkyPortal::DrawContents()
|
|||
|
||||
if (origin->texture[0] && origin->texture[0]->tex->gl_info.bSkybox)
|
||||
{
|
||||
if (gl_fixedcolormap != CM_DEFAULT)
|
||||
{
|
||||
float rr,gg,bb;
|
||||
|
||||
gl_GetLightColor(255, 0, NULL, &rr, &gg, &bb);
|
||||
R=rr;
|
||||
G=gg;
|
||||
B=bb;
|
||||
}
|
||||
else R=G=B=1.f;
|
||||
|
||||
RenderBox(origin->skytexno1, origin->texture[0], origin->x_offset[0], CM_Index, origin->sky2);
|
||||
RenderBox(origin->skytexno1, origin->texture[0], origin->x_offset[0], origin->sky2);
|
||||
gl_RenderState.EnableAlphaTest(true);
|
||||
}
|
||||
else
|
||||
|
@ -582,7 +532,7 @@ void GLSkyPortal::DrawContents()
|
|||
if (origin->texture[0])
|
||||
{
|
||||
gl_RenderState.SetTextureMode(TM_OPAQUE);
|
||||
RenderDome(origin->skytexno1, origin->texture[0], origin->x_offset[0], origin->y_offset, origin->mirrored, CM_Index);
|
||||
RenderDome(origin->skytexno1, origin->texture[0], origin->x_offset[0], origin->y_offset, origin->mirrored);
|
||||
gl_RenderState.SetTextureMode(TM_MODULATE);
|
||||
}
|
||||
|
||||
|
@ -592,7 +542,7 @@ void GLSkyPortal::DrawContents()
|
|||
if (origin->doublesky && origin->texture[1])
|
||||
{
|
||||
secondlayer=true;
|
||||
RenderDome(FNullTextureID(), origin->texture[1], origin->x_offset[1], origin->y_offset, false, CM_Index);
|
||||
RenderDome(FNullTextureID(), origin->texture[1], origin->x_offset[1], origin->y_offset, false);
|
||||
secondlayer=false;
|
||||
}
|
||||
|
||||
|
@ -601,7 +551,7 @@ void GLSkyPortal::DrawContents()
|
|||
gl_RenderState.EnableTexture(false);
|
||||
foglayer=true;
|
||||
gl_RenderState.SetColorAlpha(FadeColor, skyfog / 255.0f);
|
||||
RenderDome(FNullTextureID(), NULL, 0, 0, false, CM_DEFAULT);
|
||||
RenderDome(FNullTextureID(), NULL, 0, 0, false);
|
||||
gl_RenderState.EnableTexture(true);
|
||||
foglayer=false;
|
||||
}
|
||||
|
|
|
@ -179,24 +179,12 @@ void GLSprite::Draw(int pass)
|
|||
}
|
||||
if (RenderStyle.BlendOp!=STYLEOP_Shadow)
|
||||
{
|
||||
if (actor)
|
||||
if (gl_lights && GLRenderer->mLightCount && !gl_fixedcolormap)
|
||||
{
|
||||
lightlevel = gl_SetSpriteLighting(RenderStyle, actor, lightlevel, rel, &Colormap, 0xffffffff, trans,
|
||||
fullbright || gl_fixedcolormap >= CM_FIRSTSPECIALCOLORMAP, false);
|
||||
gl_SetDynSpriteLight(gl_light_sprites ? actor : NULL, gl_light_particles ? particle : NULL);
|
||||
}
|
||||
else if (particle)
|
||||
{
|
||||
if (gl_light_particles)
|
||||
{
|
||||
lightlevel = gl_SetSpriteLight(particle, lightlevel, rel, &Colormap, trans, 0xffffffff);
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_SetColor(lightlevel, rel, &Colormap, trans);
|
||||
}
|
||||
}
|
||||
else return;
|
||||
}
|
||||
gl_RenderState.SetObjectColor(ThingColor);
|
||||
|
||||
if (gl_isBlack(Colormap.FadeColor)) foglevel=lightlevel;
|
||||
|
@ -207,11 +195,6 @@ void GLSprite::Draw(int pass)
|
|||
additivefog = true;
|
||||
}
|
||||
|
||||
if (RenderStyle.Flags & STYLEF_InvertOverlay)
|
||||
{
|
||||
Colormap.FadeColor = Colormap.FadeColor.InverseColor();
|
||||
additivefog=false;
|
||||
}
|
||||
if (RenderStyle.BlendOp == STYLEOP_RevSub || RenderStyle.BlendOp == STYLEOP_Sub)
|
||||
{
|
||||
if (!modelframe)
|
||||
|
@ -243,7 +226,7 @@ void GLSprite::Draw(int pass)
|
|||
gl_RenderState.SetFog(0, 0);
|
||||
}
|
||||
|
||||
if (gltexture) gltexture->BindPatch(Colormap.colormap, translation, OverrideShader);
|
||||
if (gltexture) gltexture->BindPatch(translation, OverrideShader);
|
||||
else if (!modelframe) gl_RenderState.EnableTexture(false);
|
||||
|
||||
if (!modelframe)
|
||||
|
@ -309,7 +292,7 @@ void GLSprite::Draw(int pass)
|
|||
{
|
||||
// If we get here we know that we have colored fog and no fixed colormap.
|
||||
gl_SetFog(foglevel, rel, &Colormap, additivefog);
|
||||
gl_RenderState.SetFixedColormap(CM_FOGLAYER);
|
||||
//gl_RenderState.SetFixedColormap(CM_FOGLAYER); fixme: does not work yet.
|
||||
gl_RenderState.BlendEquation(GL_FUNC_ADD);
|
||||
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl_RenderState.Apply();
|
||||
|
@ -335,7 +318,7 @@ void GLSprite::Draw(int pass)
|
|||
}
|
||||
else
|
||||
{
|
||||
gl_RenderModel(this, Colormap.colormap);
|
||||
gl_RenderModel(this);
|
||||
}
|
||||
|
||||
if (pass==GLPASS_TRANSLUCENT)
|
||||
|
@ -361,6 +344,7 @@ void GLSprite::Draw(int pass)
|
|||
Colormap.FadeColor = backupfade;
|
||||
|
||||
gl_RenderState.EnableTexture(true);
|
||||
gl_RenderState.SetObjectColor(0xffffffff);
|
||||
gl_RenderState.SetDynLight(0,0,0);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,248 +127,3 @@ void gl_SetDynSpriteLight(AActor *thing, particle_t *particle)
|
|||
gl_SetDynSpriteLight(NULL, particle->x, particle->y, particle->z, particle->subsector);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Gets the light for a sprite - takes dynamic lights into account
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
bool gl_GetSpriteLight(AActor *self, fixed_t x, fixed_t y, fixed_t z, subsector_t * subsec, int desaturation, float * out, line_t *line, int side)
|
||||
{
|
||||
ADynamicLight *light;
|
||||
float frac, lr, lg, lb;
|
||||
float radius;
|
||||
bool changed = false;
|
||||
|
||||
out[0]=out[1]=out[2]=0;
|
||||
|
||||
for(int j=0;j<2;j++)
|
||||
{
|
||||
// Go through both light lists
|
||||
FLightNode * node = subsec->lighthead[j];
|
||||
while (node)
|
||||
{
|
||||
light=node->lightsource;
|
||||
if (!light->owned || light->target == NULL || light->target->IsVisibleToPlayer())
|
||||
{
|
||||
if (!(light->flags2&MF2_DORMANT) &&
|
||||
(!(light->flags4&MF4_DONTLIGHTSELF) || light->target != self))
|
||||
{
|
||||
float dist = FVector3(FIXED2FLOAT(x - light->x), FIXED2FLOAT(y - light->y), FIXED2FLOAT(z - light->z)).Length();
|
||||
radius = light->GetRadius() * gl_lights_size;
|
||||
|
||||
if (dist < radius)
|
||||
{
|
||||
frac = 1.0f - (dist / radius);
|
||||
|
||||
if (frac > 0)
|
||||
{
|
||||
if (line != NULL)
|
||||
{
|
||||
if (P_PointOnLineSide(light->x, light->y, line) != side)
|
||||
{
|
||||
node = node->nextLight;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
lr = light->GetRed() / 255.0f * gl_lights_intensity;
|
||||
lg = light->GetGreen() / 255.0f * gl_lights_intensity;
|
||||
lb = light->GetBlue() / 255.0f * gl_lights_intensity;
|
||||
if (light->IsSubtractive())
|
||||
{
|
||||
float bright = FVector3(lr, lg, lb).Length();
|
||||
FVector3 lightColor(lr, lg, lb);
|
||||
lr = (bright - lr) * -1;
|
||||
lg = (bright - lg) * -1;
|
||||
lb = (bright - lb) * -1;
|
||||
}
|
||||
|
||||
out[0] += lr * frac;
|
||||
out[1] += lg * frac;
|
||||
out[2] += lb * frac;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
node = node->nextLight;
|
||||
}
|
||||
}
|
||||
|
||||
// Desaturate dynamic lighting if applicable
|
||||
if (desaturation>0 && desaturation<=CM_DESAT31)
|
||||
{
|
||||
float gray=(out[0]*77 + out[1]*143 + out[2]*37)/257;
|
||||
|
||||
out[0]= (out[0]*(31-desaturation)+ gray*desaturation)/31;
|
||||
out[1]= (out[1]*(31-desaturation)+ gray*desaturation)/31;
|
||||
out[2]= (out[2]*(31-desaturation)+ gray*desaturation)/31;
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Sets the light for a sprite - takes dynamic lights into account
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
static int gl_SetSpriteLight(AActor *self, fixed_t x, fixed_t y, fixed_t z, subsector_t * subsec,
|
||||
int lightlevel, int rellight, FColormap * cm, float alpha,
|
||||
PalEntry ThingColor, bool weapon)
|
||||
{
|
||||
float r,g,b;
|
||||
float result[4]; // Korshun.
|
||||
|
||||
gl_GetLightColor(lightlevel, rellight, cm, &r, &g, &b, weapon);
|
||||
bool res = gl_GetSpriteLight(self, x, y, z, subsec, cm? cm->colormap : 0, result);
|
||||
if (!res || glset.lightmode == 8)
|
||||
{
|
||||
r *= ThingColor.r/255.f;
|
||||
g *= ThingColor.g/255.f;
|
||||
b *= ThingColor.b/255.f;
|
||||
glColor4f(r, g, b, alpha);
|
||||
if (glset.lightmode == 8)
|
||||
{
|
||||
glVertexAttrib1f(VATTR_LIGHTLEVEL, gl_CalcLightLevel(lightlevel, rellight, weapon) / 255.0f); // Korshun.
|
||||
gl_RenderState.SetDynLight(result[0], result[1], result[2]);
|
||||
}
|
||||
return lightlevel;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Note: Due to subtractive lights the values can easily become negative so we have to clamp both
|
||||
// at the low and top end of the range!
|
||||
r = clamp<float>(result[0]+r, 0, 1.0f);
|
||||
g = clamp<float>(result[1]+g, 0, 1.0f);
|
||||
b = clamp<float>(result[2]+b, 0, 1.0f);
|
||||
|
||||
float dlightlevel = r*77 + g*143 + b*35;
|
||||
|
||||
r *= ThingColor.r/255.f;
|
||||
g *= ThingColor.g/255.f;
|
||||
b *= ThingColor.b/255.f;
|
||||
|
||||
glColor4f(r, g, b, alpha);
|
||||
|
||||
if (dlightlevel == 0) return 0;
|
||||
|
||||
if (glset.lightmode&2 && dlightlevel<192.f)
|
||||
{
|
||||
return xs_CRoundToInt(192.f - (192.f - dlightlevel) / 1.95f);
|
||||
}
|
||||
else
|
||||
{
|
||||
return xs_CRoundToInt(dlightlevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int gl_SetSpriteLight(AActor * thing, int lightlevel, int rellight, FColormap * cm,
|
||||
float alpha, PalEntry ThingColor, bool weapon)
|
||||
{
|
||||
subsector_t * subsec = thing->subsector;
|
||||
return gl_SetSpriteLight(thing, thing->x, thing->y, thing->z+(thing->height>>1), subsec,
|
||||
lightlevel, rellight, cm, alpha, ThingColor, weapon);
|
||||
}
|
||||
|
||||
int gl_SetSpriteLight(particle_t * thing, int lightlevel, int rellight, FColormap *cm, float alpha, PalEntry ThingColor)
|
||||
{
|
||||
return gl_SetSpriteLight(NULL, thing->x, thing->y, thing->z, thing->subsector, lightlevel, rellight,
|
||||
cm, alpha, ThingColor, false);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Modifies the color values depending on the render style
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void gl_GetSpriteLighting(FRenderStyle style, AActor *thing, FColormap *cm, PalEntry &ThingColor)
|
||||
{
|
||||
if (style.Flags & STYLEF_RedIsAlpha)
|
||||
{
|
||||
cm->colormap = CM_SHADE;
|
||||
}
|
||||
if (style.Flags & STYLEF_ColorIsFixed)
|
||||
{
|
||||
if (style.Flags & STYLEF_InvertSource)
|
||||
{
|
||||
ThingColor = PalEntry(thing->fillcolor).InverseColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
ThingColor = thing->fillcolor;
|
||||
}
|
||||
}
|
||||
|
||||
// This doesn't work like in the software renderer.
|
||||
if (style.Flags & STYLEF_InvertSource)
|
||||
{
|
||||
int gray = (cm->LightColor.r*77 + cm->LightColor.r*143 + cm->LightColor.r*36)>>8;
|
||||
cm->LightColor.r = cm->LightColor.g = cm->LightColor.b = gray;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Sets render state to draw the given render style
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
int gl_SetSpriteLighting(FRenderStyle style, AActor *thing, int lightlevel, int rellight, FColormap *cm,
|
||||
PalEntry ThingColor, float alpha, bool fullbright, bool weapon)
|
||||
{
|
||||
FColormap internal_cm;
|
||||
|
||||
if (style.Flags & STYLEF_RedIsAlpha)
|
||||
{
|
||||
cm->colormap = CM_SHADE;
|
||||
}
|
||||
if (style.Flags & STYLEF_ColorIsFixed)
|
||||
{
|
||||
if (style.Flags & STYLEF_InvertSource)
|
||||
{
|
||||
ThingColor = PalEntry(thing->fillcolor).InverseColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
ThingColor = thing->fillcolor;
|
||||
}
|
||||
gl_ModifyColor(ThingColor.r, ThingColor.g, ThingColor.b, cm->colormap);
|
||||
}
|
||||
|
||||
// This doesn't work like in the software renderer.
|
||||
if (style.Flags & STYLEF_InvertSource)
|
||||
{
|
||||
internal_cm = *cm;
|
||||
cm = &internal_cm;
|
||||
|
||||
int gray = (internal_cm.LightColor.r*77 + internal_cm.LightColor.r*143 + internal_cm.LightColor.r*36)>>8;
|
||||
cm->LightColor.r = cm->LightColor.g = cm->LightColor.b = gray;
|
||||
}
|
||||
|
||||
if (style.BlendOp == STYLEOP_Shadow)
|
||||
{
|
||||
glColor4f(0.2f * ThingColor.r / 255.f, 0.2f * ThingColor.g / 255.f,
|
||||
0.2f * ThingColor.b / 255.f, (alpha = 0.33f));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gl_light_sprites && gl_lights && GLRenderer->mLightCount && !fullbright)
|
||||
{
|
||||
lightlevel = gl_SetSpriteLight(thing, lightlevel, rellight, cm, alpha, ThingColor, weapon);
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_SetColor(lightlevel, rellight, cm, alpha, weapon);
|
||||
}
|
||||
}
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL,alpha*gl_mask_sprite_threshold);
|
||||
return lightlevel;
|
||||
}
|
||||
|
||||
|
|
|
@ -354,21 +354,4 @@ inline float Dist2(float x1,float y1,float x2,float y2)
|
|||
void gl_SetDynSpriteLight(AActor *self, fixed_t x, fixed_t y, fixed_t z, subsector_t *subsec);
|
||||
void gl_SetDynSpriteLight(AActor *actor, particle_t *particle);
|
||||
|
||||
|
||||
bool gl_GetSpriteLight(AActor *Self, fixed_t x, fixed_t y, fixed_t z, subsector_t * subsec, int desaturation, float * out, line_t *line = NULL, int side = 0);
|
||||
int gl_SetSpriteLight(AActor * thing, int lightlevel, int rellight, FColormap * cm, float alpha, PalEntry ThingColor = 0xffffff, bool weapon=false);
|
||||
|
||||
void gl_GetSpriteLight(AActor * thing, int lightlevel, int rellight, FColormap * cm,
|
||||
float *red, float *green, float *blue,
|
||||
PalEntry ThingColor, bool weapon);
|
||||
|
||||
int gl_SetSpriteLighting(FRenderStyle style, AActor *thing, int lightlevel, int rellight, FColormap *cm,
|
||||
PalEntry ThingColor, float alpha, bool fullbright, bool weapon);
|
||||
|
||||
int gl_SetSpriteLight(particle_t * thing, int lightlevel, int rellight, FColormap *cm, float alpha, PalEntry ThingColor = 0xffffff);
|
||||
void gl_GetLightForThing(AActor * thing, float upper, float lower, float & r, float & g, float & b);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -152,7 +152,7 @@ void GLWall::PutWall(bool translucent)
|
|||
};
|
||||
|
||||
bool masked;
|
||||
bool light = gl_forcemultipass;
|
||||
bool light = false;
|
||||
|
||||
if (!gl_fixedcolormap)
|
||||
{
|
||||
|
|
|
@ -412,7 +412,7 @@ void GLWall::RenderMirrorSurface()
|
|||
gl_SetFog(lightlevel, getExtraLight(), &Colormap, true);
|
||||
|
||||
FMaterial * pat=FMaterial::ValidateTexture(GLRenderer->mirrortexture);
|
||||
pat->BindPatch(Colormap.colormap, 0);
|
||||
pat->BindPatch(0);
|
||||
|
||||
flags &= ~GLWF_GLOW;
|
||||
//flags |= GLWF_NOSHADER;
|
||||
|
@ -465,7 +465,7 @@ void GLWall::RenderTranslucentWall()
|
|||
{
|
||||
if (flags&GLWF_FOGGY) gl_RenderState.EnableBrightmap(false);
|
||||
gl_RenderState.EnableGlow(!!(flags & GLWF_GLOW));
|
||||
gltexture->Bind(Colormap.colormap, flags, 0);
|
||||
gltexture->Bind(flags, 0);
|
||||
extra = getExtraLight();
|
||||
}
|
||||
else
|
||||
|
@ -532,7 +532,7 @@ void GLWall::Draw(int pass)
|
|||
else gl_SetFog(255, 0, NULL, false);
|
||||
|
||||
gl_RenderState.EnableGlow(!!(flags & GLWF_GLOW));
|
||||
gltexture->Bind(Colormap.colormap, flags, 0);
|
||||
gltexture->Bind(flags, 0);
|
||||
RenderWall(3, NULL);
|
||||
gl_RenderState.EnableGlow(false);
|
||||
gl_RenderState.EnableLight(false);
|
||||
|
@ -552,7 +552,7 @@ void GLWall::Draw(int pass)
|
|||
|
||||
if (pass != GLPASS_BASE)
|
||||
{
|
||||
gltexture->Bind(Colormap.colormap, flags, 0);
|
||||
gltexture->Bind(flags, 0);
|
||||
}
|
||||
RenderWall(pass == GLPASS_BASE? 2:3, NULL);
|
||||
gl_RenderState.EnableGlow(false);
|
||||
|
@ -560,7 +560,7 @@ void GLWall::Draw(int pass)
|
|||
break;
|
||||
|
||||
case GLPASS_TEXTURE: // modulated texture
|
||||
gltexture->Bind(Colormap.colormap, flags, 0);
|
||||
gltexture->Bind(flags, 0);
|
||||
RenderWall(1, NULL);
|
||||
break;
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ EXTERN_CVAR(Int, gl_fuzztype)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FGLRenderer::DrawPSprite (player_t * player,pspdef_t *psp,fixed_t sx, fixed_t sy, int cm_index, bool hudModelStep, int OverrideShader)
|
||||
void FGLRenderer::DrawPSprite (player_t * player,pspdef_t *psp,fixed_t sx, fixed_t sy, bool hudModelStep, int OverrideShader)
|
||||
{
|
||||
float fU1,fV1;
|
||||
float fU2,fV2;
|
||||
|
@ -83,7 +83,7 @@ void FGLRenderer::DrawPSprite (player_t * player,pspdef_t *psp,fixed_t sx, fixed
|
|||
// [BB] In the HUD model step we just render the model and break out.
|
||||
if ( hudModelStep )
|
||||
{
|
||||
gl_RenderHUDModel( psp, sx, sy, cm_index );
|
||||
gl_RenderHUDModel( psp, sx, sy);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ void FGLRenderer::DrawPSprite (player_t * player,pspdef_t *psp,fixed_t sx, fixed
|
|||
FMaterial * tex = FMaterial::ValidateTexture(lump, false);
|
||||
if (!tex) return;
|
||||
|
||||
tex->BindPatch(cm_index, 0, OverrideShader);
|
||||
tex->BindPatch(0, OverrideShader);
|
||||
|
||||
int vw = viewwidth;
|
||||
int vh = viewheight;
|
||||
|
@ -192,17 +192,13 @@ void FGLRenderer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
|
|||
(players[consoleplayer].cheats & CF_CHASECAM))
|
||||
return;
|
||||
|
||||
/*
|
||||
if(!player || playermo->renderflags&RF_INVISIBLE || !r_drawplayersprites ||
|
||||
mViewActor!=playermo || playermo->RenderStyle.BlendOp == STYLEOP_None) return;
|
||||
*/
|
||||
|
||||
P_BobWeapon (player, &player->psprites[ps_weapon], &ofsx, &ofsy);
|
||||
|
||||
// check for fullbright
|
||||
if (player->fixedcolormap==NOFIXEDCOLORMAP)
|
||||
{
|
||||
for (i=0, psp=player->psprites; i<=ps_flash; i++,psp++)
|
||||
for (i = 0, psp = player->psprites; i <= ps_flash; i++, psp++)
|
||||
{
|
||||
if (psp->state != NULL)
|
||||
{
|
||||
bool disablefullbright = false;
|
||||
|
@ -215,7 +211,7 @@ void FGLRenderer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
|
|||
}
|
||||
statebright[i] = !!psp->state->GetFullbright() && !disablefullbright;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (gl_fixedcolormap)
|
||||
|
@ -300,8 +296,8 @@ void FGLRenderer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
|
|||
vis.colormap < SpecialColormaps[SpecialColormaps.Size()].Colormap &&
|
||||
cm.colormap == CM_DEFAULT)
|
||||
{
|
||||
ptrdiff_t specialmap = (vis.colormap - SpecialColormaps[0].Colormap) / sizeof(FSpecialColormap);
|
||||
cm.colormap = int(CM_FIRSTSPECIALCOLORMAP + specialmap);
|
||||
// this only happens for Strife's inverted weapon sprite
|
||||
vis.RenderStyle.Flags |= STYLEF_InvertSource;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -380,10 +376,17 @@ void FGLRenderer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
|
|||
cmc.LightColor.b = (3*cmc.LightColor.b + 0xff)/4;
|
||||
}
|
||||
}
|
||||
// set the lighting parameters (only calls glColor and glAlphaFunc)
|
||||
gl_SetSpriteLighting(vis.RenderStyle, playermo, statebright[i]? 255 : lightlevel,
|
||||
0, &cmc, 0xffffff, trans, statebright[i], true);
|
||||
DrawPSprite (player,psp,psp->sx+ofsx, psp->sy+ofsy, cm.colormap, hudModelStep, OverrideShader);
|
||||
// set the lighting parameters
|
||||
if (vis.RenderStyle.BlendOp == STYLEOP_Shadow)
|
||||
{
|
||||
gl_RenderState.SetColor(0.2f, 0.2f, 0.2f, 0.33f);// 0x55333333, cmc.desaturation);
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_SetDynSpriteLight(playermo, NULL);
|
||||
gl_SetColor(statebright[i] ? 255 : lightlevel, 0, &cmc, trans, true);
|
||||
}
|
||||
DrawPSprite (player,psp,psp->sx+ofsx, psp->sy+ofsy, hudModelStep, OverrideShader);
|
||||
}
|
||||
}
|
||||
gl_RenderState.SetObjectColor(0xffffffff);
|
||||
|
@ -417,5 +420,5 @@ void FGLRenderer::DrawTargeterSprites()
|
|||
|
||||
// The Targeter's sprites are always drawn normally.
|
||||
for (i=ps_targetcenter, psp = &player->psprites[ps_targetcenter]; i<NUMPSPRITES; i++,psp++)
|
||||
if (psp->state) DrawPSprite (player,psp,psp->sx, psp->sy, CM_DEFAULT, false, 0);
|
||||
if (psp->state) DrawPSprite (player,psp,psp->sx, psp->sy, false, 0);
|
||||
}
|
|
@ -10,12 +10,6 @@
|
|||
#pragma warning(disable:4244)
|
||||
#endif
|
||||
|
||||
EXTERN_CVAR(Bool, gl_warp_shader)
|
||||
EXTERN_CVAR(Bool, gl_fog_shader)
|
||||
EXTERN_CVAR(Bool, gl_colormap_shader)
|
||||
EXTERN_CVAR(Bool, gl_brightmap_shader)
|
||||
EXTERN_CVAR(Bool, gl_glow_shader)
|
||||
|
||||
EXTERN_CVAR(Bool,gl_enhanced_nightvision)
|
||||
EXTERN_CVAR(Int, screenblocks);
|
||||
EXTERN_CVAR(Bool, gl_texture)
|
||||
|
@ -27,8 +21,6 @@ EXTERN_CVAR(Bool, gl_usefb)
|
|||
|
||||
EXTERN_CVAR(Int, gl_weaponlight)
|
||||
|
||||
EXTERN_CVAR(Bool, gl_forcemultipass)
|
||||
|
||||
EXTERN_CVAR (Bool, gl_lights);
|
||||
EXTERN_CVAR (Bool, gl_attachedlights);
|
||||
EXTERN_CVAR (Bool, gl_lights_checkside);
|
||||
|
|
|
@ -179,10 +179,10 @@ void gl_PrintStartupLog()
|
|||
Printf ("Max. vertex uniforms: %d\n", v);
|
||||
glGetIntegerv(GL_MAX_VARYING_FLOATS, &v);
|
||||
Printf ("Max. varying: %d\n", v);
|
||||
glGetIntegerv(GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS, &v);
|
||||
Printf ("Max. combined uniforms: %d\n", v);
|
||||
glGetIntegerv(GL_MAX_COMBINED_UNIFORM_BLOCKS, &v);
|
||||
Printf ("Max. combined uniform blocks: %d\n", v);
|
||||
glGetIntegerv(GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS, &v);
|
||||
Printf("Max. combined shader storage blocks: %d\n", v);
|
||||
glGetIntegerv(GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS, &v);
|
||||
Printf("Max. vertex shader storage blocks: %d\n", v);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -279,9 +279,9 @@ bool OpenGLFrameBuffer::Wiper_Crossfade::Run(int ticks, OpenGLFrameBuffer *fb)
|
|||
|
||||
gl_RenderState.SetTextureMode(TM_OPAQUE);
|
||||
gl_RenderState.EnableAlphaTest(false);
|
||||
gl_RenderState.ResetColor();
|
||||
gl_RenderState.Apply();
|
||||
fb->wipestartscreen->Bind(0);
|
||||
glColor4f(1.f, 1.f, 1.f, 1.f);
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glTexCoord2f(0, vb);
|
||||
glVertex2i(0, 0);
|
||||
|
@ -294,7 +294,8 @@ bool OpenGLFrameBuffer::Wiper_Crossfade::Run(int ticks, OpenGLFrameBuffer *fb)
|
|||
glEnd();
|
||||
|
||||
fb->wipeendscreen->Bind(0);
|
||||
glColor4f(1.f, 1.f, 1.f, clamp(Clock/32.f, 0.f, 1.f));
|
||||
gl_RenderState.SetColorAlpha(0xffffff, clamp(Clock/32.f, 0.f, 1.f));
|
||||
gl_RenderState.Apply();
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glTexCoord2f(0, vb);
|
||||
glVertex2i(0, 0);
|
||||
|
@ -346,9 +347,9 @@ bool OpenGLFrameBuffer::Wiper_Melt::Run(int ticks, OpenGLFrameBuffer *fb)
|
|||
|
||||
// Draw the new screen on the bottom.
|
||||
gl_RenderState.SetTextureMode(TM_OPAQUE);
|
||||
gl_RenderState.ResetColor();
|
||||
gl_RenderState.Apply();
|
||||
fb->wipeendscreen->Bind(0);
|
||||
glColor4f(1.f, 1.f, 1.f, 1.f);
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glTexCoord2f(0, vb);
|
||||
glVertex2i(0, 0);
|
||||
|
@ -398,7 +399,6 @@ bool OpenGLFrameBuffer::Wiper_Melt::Run(int ticks, OpenGLFrameBuffer *fb)
|
|||
float th = (float)FHardwareTexture::GetTexDimension(fb->Height);
|
||||
rect.bottom = fb->Height - rect.bottom;
|
||||
rect.top = fb->Height - rect.top;
|
||||
glColor4f(1.f, 1.f, 1.f, 1.f);
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glTexCoord2f(rect.left / tw, rect.top / th);
|
||||
glVertex2i(rect.left, rect.bottom);
|
||||
|
@ -491,9 +491,9 @@ bool OpenGLFrameBuffer::Wiper_Burn::Run(int ticks, OpenGLFrameBuffer *fb)
|
|||
// Put the initial screen back to the buffer.
|
||||
gl_RenderState.SetTextureMode(TM_OPAQUE);
|
||||
gl_RenderState.EnableAlphaTest(false);
|
||||
gl_RenderState.ResetColor();
|
||||
gl_RenderState.Apply();
|
||||
fb->wipestartscreen->Bind(0);
|
||||
glColor4f(1.f, 1.f, 1.f, 1.f);
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glTexCoord2f(0, vb);
|
||||
glVertex2i(0, 0);
|
||||
|
@ -522,7 +522,6 @@ bool OpenGLFrameBuffer::Wiper_Burn::Run(int ticks, OpenGLFrameBuffer *fb)
|
|||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
// Burn the new screen on top of it.
|
||||
glColor4f(1.f, 1.f, 1.f, 1.f);
|
||||
fb->wipeendscreen->Bind(1);
|
||||
//BurnTexture->Bind(0, CM_DEFAULT);
|
||||
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
#ifndef __GLTEXTURE_H
|
||||
#define __GLTEXTURE_H
|
||||
|
||||
#ifdef LoadImage
|
||||
#undef LoadImage
|
||||
#endif
|
||||
|
||||
#define SHADED_TEXTURE -1
|
||||
#define DIRECT_PALETTE -2
|
||||
|
||||
|
|
|
@ -835,14 +835,14 @@ outl:
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void FMaterial::Bind(int cm, int clampmode, int translation, int overrideshader)
|
||||
void FMaterial::Bind(int clampmode, int translation, int overrideshader)
|
||||
{
|
||||
int usebright = false;
|
||||
int shaderindex = overrideshader > 0? overrideshader : mShaderIndex;
|
||||
int maxbound = 0;
|
||||
bool allowhires = tex->xScale == FRACUNIT && tex->yScale == FRACUNIT;
|
||||
|
||||
int softwarewarp = gl_RenderState.SetupShader(tex->bHasCanvas, shaderindex, cm, tex->gl_info.shaderspeed);
|
||||
int softwarewarp = gl_RenderState.SetupShader(tex->bHasCanvas, shaderindex, tex->gl_info.shaderspeed);
|
||||
|
||||
if (tex->bHasCanvas || tex->bWarped) clampmode = 0;
|
||||
else if (clampmode != -1) clampmode &= 3;
|
||||
|
@ -883,13 +883,13 @@ void FMaterial::Bind(int cm, int clampmode, int translation, int overrideshader)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void FMaterial::BindPatch(int cm, int translation, int overrideshader)
|
||||
void FMaterial::BindPatch(int translation, int overrideshader)
|
||||
{
|
||||
int usebright = false;
|
||||
int shaderindex = overrideshader > 0? overrideshader : mShaderIndex;
|
||||
int maxbound = 0;
|
||||
|
||||
int softwarewarp = gl_RenderState.SetupShader(tex->bHasCanvas, shaderindex, cm, tex->gl_info.shaderspeed);
|
||||
int softwarewarp = gl_RenderState.SetupShader(tex->bHasCanvas, shaderindex, tex->gl_info.shaderspeed);
|
||||
|
||||
const FHardwareTexture *glpatch = mBaseLayer->BindPatch(0, translation, softwarewarp, gl.needAlphaTexture);
|
||||
// The only multitexture effect usable on sprites is the brightmap.
|
||||
|
@ -916,7 +916,7 @@ void FMaterial::Precache()
|
|||
{
|
||||
if (tex->UseType==FTexture::TEX_Sprite)
|
||||
{
|
||||
BindPatch(CM_DEFAULT, 0);
|
||||
BindPatch(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -925,10 +925,10 @@ void FMaterial::Precache()
|
|||
{
|
||||
if (mBaseLayer->gltexture[i] != 0)
|
||||
{
|
||||
Bind (CM_DEFAULT, i, 0);
|
||||
Bind (i, 0);
|
||||
cached++;
|
||||
}
|
||||
if (cached == 0) Bind(CM_DEFAULT, -1, 0);
|
||||
if (cached == 0) Bind(-1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,7 +120,6 @@ class FMaterial
|
|||
float SpriteU[2], SpriteV[2];
|
||||
float spriteright, spritebottom;
|
||||
|
||||
void SetupShader(int shaderindex, int &cm);
|
||||
FGLTexture * ValidateSysTexture(FTexture * tex, bool expand);
|
||||
bool TrimBorders(int *rect);
|
||||
|
||||
|
@ -135,8 +134,8 @@ public:
|
|||
return !!mBaseLayer->tex->bMasked;
|
||||
}
|
||||
|
||||
void Bind(int cm, int clamp = 0, int translation = 0, int overrideshader = 0);
|
||||
void BindPatch(int cm, int translation = 0, int overrideshader = 0);
|
||||
void Bind(int clamp = 0, int translation = 0, int overrideshader = 0);
|
||||
void BindPatch(int translation = 0, int overrideshader = 0);
|
||||
|
||||
unsigned char * CreateTexBuffer(int translation, int & w, int & h, bool expand = false, bool allowhires=true) const
|
||||
{
|
||||
|
|
|
@ -210,7 +210,7 @@ PalEntry averageColor(const DWORD *data, int size, fixed_t maxout_factor)
|
|||
g = Scale(g, maxout_factor, maxv);
|
||||
b = Scale(b, maxout_factor, maxv);
|
||||
}
|
||||
return PalEntry(r,g,b);
|
||||
return PalEntry(255,r,g,b);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue