mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-29 07:22:07 +00:00
- no, we do not want to use global variables to pass parameters around...
This commit is contained in:
parent
60aebff4a1
commit
5d94af913a
6 changed files with 14 additions and 14 deletions
|
@ -54,8 +54,6 @@
|
|||
|
||||
CVAR(Bool, gl_light_models, true, CVAR_ARCHIVE)
|
||||
|
||||
extern int modellightindex;
|
||||
|
||||
VSMatrix FGLModelRenderer::GetViewToWorldMatrix()
|
||||
{
|
||||
VSMatrix objectToWorldMatrix;
|
||||
|
@ -359,9 +357,9 @@ void FModelVertexBuffer::SetupFrame(FModelRenderer *renderer, unsigned int frame
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void gl_RenderModel(GLSprite * spr)
|
||||
void gl_RenderModel(GLSprite * spr, int mli)
|
||||
{
|
||||
FGLModelRenderer renderer;
|
||||
FGLModelRenderer renderer(mli);
|
||||
renderer.RenderModel(spr->x, spr->y, spr->z, spr->modelframe, spr->actor);
|
||||
}
|
||||
|
||||
|
@ -371,8 +369,8 @@ void gl_RenderModel(GLSprite * spr)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void gl_RenderHUDModel(DPSprite *psp, float ofsX, float ofsY)
|
||||
void gl_RenderHUDModel(DPSprite *psp, float ofsX, float ofsY, int mli)
|
||||
{
|
||||
FGLModelRenderer renderer;
|
||||
FGLModelRenderer renderer(mli);
|
||||
renderer.RenderHUDModel(psp, ofsX, ofsY);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,10 @@ class GLSprite;
|
|||
|
||||
class FGLModelRenderer : public FModelRenderer
|
||||
{
|
||||
int modellightindex = -1;
|
||||
public:
|
||||
FGLModelRenderer(int mli) : modellightindex(mli)
|
||||
{}
|
||||
void BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, const VSMatrix &objectToWorldMatrix) override;
|
||||
void EndDrawModel(AActor *actor, FSpriteModelFrame *smf) override;
|
||||
IModelVertexBuffer *CreateVertexBuffer(bool needindex, bool singleframe) override;
|
||||
|
@ -48,5 +51,5 @@ public:
|
|||
double GetTimeFloat() override;
|
||||
};
|
||||
|
||||
void gl_RenderModel(GLSprite * spr);
|
||||
void gl_RenderHUDModel(DPSprite *psp, float ofsx, float ofsy);
|
||||
void gl_RenderModel(GLSprite * spr, int mli);
|
||||
void gl_RenderHUDModel(DPSprite *psp, float ofsx, float ofsy, int mli);
|
||||
|
|
|
@ -79,7 +79,6 @@ EXTERN_CVAR (Bool, r_debug_disable_vis_filter)
|
|||
extern TArray<spritedef_t> sprites;
|
||||
extern TArray<spriteframe_t> SpriteFrames;
|
||||
extern uint32_t r_renderercaps;
|
||||
extern int modellightindex;
|
||||
|
||||
enum HWRenderStyle
|
||||
{
|
||||
|
@ -474,7 +473,7 @@ void GLSprite::Draw(int pass)
|
|||
}
|
||||
else
|
||||
{
|
||||
gl_RenderModel(this);
|
||||
gl_RenderModel(this, dynlightindex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,8 +44,6 @@
|
|||
#include "gl/textures/gl_material.h"
|
||||
#include "gl/dynlights/gl_lightbuffer.h"
|
||||
|
||||
FDynLightData modellightdata;
|
||||
int modellightindex = -1;
|
||||
|
||||
template<class T>
|
||||
T smoothstep(const T edge0, const T edge1, const T x)
|
||||
|
@ -198,6 +196,8 @@ void BSPWalkCircle(float x, float y, float radiusSquared, const Callback &callba
|
|||
|
||||
int gl_SetDynModelLight(AActor *self, int dynlightindex)
|
||||
{
|
||||
static FDynLightData modellightdata; // If this ever gets multithreaded, this variable must either be made non-static or thread_local.
|
||||
|
||||
// For deferred light mode this function gets called twice. First time for list upload, and second for draw.
|
||||
if (gl.lightmethod == LM_DEFERRED && dynlightindex != -1)
|
||||
{
|
||||
|
|
|
@ -73,7 +73,7 @@ void GLSceneDrawer::DrawPSprite (player_t * player,DPSprite *psp, float sx, floa
|
|||
// [BB] In the HUD model step we just render the model and break out.
|
||||
if ( hudModelStep )
|
||||
{
|
||||
gl_RenderHUDModel(psp, sx, sy);
|
||||
gl_RenderHUDModel(psp, sx, sy, weapondynlightindex[psp]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -314,7 +314,7 @@ void gl_PrecacheTexture(uint8_t *texhitlist, TMap<PClassActor*, bool> &actorhitl
|
|||
}
|
||||
|
||||
// cache all used models
|
||||
FGLModelRenderer renderer;
|
||||
FGLModelRenderer renderer(-1);
|
||||
for (unsigned i = 0; i < Models.Size(); i++)
|
||||
{
|
||||
if (modellist[i])
|
||||
|
|
Loading…
Reference in a new issue