Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
hzqst committed Feb 23, 2024
1 parent bfc4a5a commit 48000d0
Show file tree
Hide file tree
Showing 12 changed files with 126 additions and 171 deletions.
14 changes: 14 additions & 0 deletions Plugins/Renderer/gl_draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,20 @@ void GL_BindVAO(GLuint VAO)
glBindVertexArray(VAO);
}

void GL_UploadSubDataToUBO(GLuint UBO, size_t offset, size_t size, const void* data)
{
if (glNamedBufferSubData)
{
glNamedBufferSubData(UBO, offset, size, data);
}
else
{
glBindBuffer(GL_UNIFORM_BUFFER, UBO);
glBufferSubData(GL_UNIFORM_BUFFER, offset, size, data);
glBindBuffer(GL_UNIFORM_BUFFER, 0);
}
}

void GL_UploadDataToVBOStaticDraw(GLuint VBO, size_t size, const void* data)
{
glBindBuffer(GL_ARRAY_BUFFER, VBO);
Expand Down
13 changes: 5 additions & 8 deletions Plugins/Renderer/gl_hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,6 @@ void GL_BlitFrameFufferToScreen(FBO_Container_t *src)
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glBindFramebuffer(GL_READ_FRAMEBUFFER, src->s_hBackBufferFBO);

glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);

glBlitFramebuffer(0, 0, src->iWidth, src->iHeight, 0, 0, glwidth, glheight, GL_COLOR_BUFFER_BIT, GL_LINEAR);
}

Expand Down Expand Up @@ -781,13 +778,13 @@ bool R_IsGammaBlendEnabled()
{
if (r_gamma_blend->value > 0)
{
if (r_draw_shadowcaster)
if ((*r_refdef.onlyClientDraws))
return false;

if (r_draw_reflectview)
if (R_IsRenderingShadowView())
return false;

if ((*r_refdef.onlyClientDraws))
if (R_IsRenderingWaterView())
return false;

if (R_IsRenderingPortal())
Expand Down Expand Up @@ -907,10 +904,10 @@ bool R_IsAmbientOcclusionEnabled(void)
if ((*r_refdef.onlyClientDraws))
return false;

if (r_draw_shadowcaster)
if (R_IsRenderingShadowView())
return false;

if (r_draw_reflectview)
if (R_IsRenderingWaterView())
return false;

if (R_IsRenderingPortal())
Expand Down
8 changes: 6 additions & 2 deletions Plugins/Renderer/gl_light.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,14 @@ bool R_IsDeferredRenderingEnabled(void)
if (!r_light_dynamic->value)
return false;

if (r_draw_shadowcaster)
//TODO: really?
if ((*r_refdef.onlyClientDraws))
return false;

if (r_draw_reflectview)
if (R_IsRenderingShadowView())
return false;

if (R_IsRenderingWaterView())
return false;

if (R_IsRenderingPortal())
Expand Down
7 changes: 6 additions & 1 deletion Plugins/Renderer/gl_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ extern cvar_t *r_shadows;
extern cvar_t *r_mirroralpha;
extern cvar_t *r_wateralpha;
extern cvar_t *r_dynamic;
extern cvar_t* r_novis;
extern cvar_t *r_mmx;
extern cvar_t *r_traceglow;
extern cvar_t *r_wadtextures;
Expand Down Expand Up @@ -334,7 +335,6 @@ void V_RenderView(void);
void R_RenderView(void);
void R_RenderScene(void);
void R_RenderView_SvEngine(int a1);
bool R_IsRenderingPortal(void);
qboolean R_CullBox(vec3_t mins, vec3_t maxs);
qboolean Host_IsSinglePlayerGame();
bool AllowCheats();
Expand Down Expand Up @@ -390,6 +390,7 @@ void GL_DeleteTexture(GLuint tex);
void GL_DeleteBuffer(GLuint buf);
void GL_DeleteVAO(GLuint VAO);
void GL_BindVAO(GLuint VAO);
void GL_UploadSubDataToUBO(GLuint UBO, size_t offset, size_t size, const void* data);
void GL_UploadDataToVBOStaticDraw(GLuint VBO, size_t size, const void* data);
void GL_UploadDataToVBODynamicDraw(GLuint VBO, size_t size, const void* data);
void GL_UploadSubDataToVBODynamicDraw(GLuint VBO, size_t offset, size_t size, const void* data);
Expand Down Expand Up @@ -496,6 +497,9 @@ void GL_PushFrameBuffer(void);
void GL_PopFrameBuffer(void);

bool R_IsRenderingGBuffer();
bool R_IsRenderingShadowView(void);
bool R_IsRenderingWaterView(void);
bool R_IsRenderingPortal(void);

//Fog
bool R_IsRenderingFog();
Expand Down Expand Up @@ -587,6 +591,7 @@ extern bool r_draw_oitblend;
extern bool r_draw_gammablend;
extern bool r_draw_legacysprite;
extern bool r_draw_reflectview;
extern bool r_draw_refractview;
extern bool r_draw_portalview;

extern int r_renderview_pass;
Expand Down
Loading

0 comments on commit 48000d0

Please sign in to comment.