mirror of
https://github.com/DrBeef/QuestZDoom.git
synced 2025-04-24 18:22:02 +00:00
Prevent weapon model clipping through walls/objects
This commit is contained in:
parent
802543ab30
commit
528a5dcf06
1 changed files with 8 additions and 0 deletions
|
@ -55,6 +55,7 @@
|
|||
CVAR(Bool, gl_light_models, true, CVAR_ARCHIVE)
|
||||
|
||||
extern int modellightindex;
|
||||
float gldepthmin, gldepthmax;
|
||||
|
||||
VSMatrix FGLModelRenderer::GetViewToWorldMatrix()
|
||||
{
|
||||
|
@ -94,6 +95,11 @@ void FGLModelRenderer::BeginDrawHUDModel(AActor *actor, const VSMatrix &objectTo
|
|||
{
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
|
||||
/* hack the depth range to prevent view model from poking into walls */
|
||||
gldepthmin = 0;
|
||||
gldepthmax = 1;
|
||||
glDepthRangef(gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin));
|
||||
|
||||
// [BB] In case the model should be rendered translucent, do back face culling.
|
||||
// This solves a few of the problems caused by the lack of depth sorting.
|
||||
// TO-DO: Implement proper depth sorting.
|
||||
|
@ -114,6 +120,8 @@ void FGLModelRenderer::EndDrawHUDModel(AActor *actor)
|
|||
glDepthFunc(GL_LESS);
|
||||
if (!(actor->RenderStyle == LegacyRenderStyles[STYLE_Normal]))
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
glDepthRangef(gldepthmin, gldepthmax);
|
||||
}
|
||||
|
||||
IModelVertexBuffer *FGLModelRenderer::CreateVertexBuffer(bool needindex, bool singleframe)
|
||||
|
|
Loading…
Reference in a new issue