From 3bd646d4ed2df0fd1b6d6e365496b081613e37ca Mon Sep 17 00:00:00 2001 From: Justin Marshall Date: Thu, 28 May 2026 22:29:54 -0700 Subject: [PATCH] Fixed RR sets motion ids correctly. --- neo/engine/opengl/opengl.h | 1 + neo/engine/renderer/draw_common.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/neo/engine/opengl/opengl.h b/neo/engine/opengl/opengl.h index 308d824e..5e66ab73 100644 --- a/neo/engine/opengl/opengl.h +++ b/neo/engine/opengl/opengl.h @@ -1576,6 +1576,7 @@ enum GeometryFlag_t }; void APIENTRY glGeometryFlagf(GLfloat flag); +void APIENTRY glMotionObjectIdui(GLuint objectId); #endif diff --git a/neo/engine/renderer/draw_common.cpp b/neo/engine/renderer/draw_common.cpp index 260dc722..4ee7e230 100644 --- a/neo/engine/renderer/draw_common.cpp +++ b/neo/engine/renderer/draw_common.cpp @@ -118,6 +118,19 @@ static float RB_EstimatePathTraceSpecularStrength( const idMaterial *shader, con return idMath::ClampFloat( 0.5f, 2.4f, strength ); } +static GLuint RB_PathTraceMotionObjectId( const drawSurf_t *surf ) { + if ( !surf || !surf->space || !surf->space->entityDef ) { + return 1; + } + + const int entityIndex = surf->space->entityDef->index; + if ( entityIndex < 0 ) { + return 1; + } + + return (GLuint)( entityIndex + 2 ); +} + static idDrawVert *RB_BindAmbientBuffer( const srfTriangles_t *tri ) { if ( tri->ambientVbo ) { glBindBufferARB( GL_ARRAY_BUFFER_ARB, tri->ambientVbo ); @@ -654,6 +667,7 @@ void RB_T_FillDepthBuffer(const drawSurf_t* surf) { else { glGeometryFlagf(GEOMETRY_FLAG_SKELETAL); } + glMotionObjectIdui( RB_PathTraceMotionObjectId( surf ) ); // set texture matrix and texGens. The Quake 4 path needs to know this is a depth fill. RB_PrepareStageTexturing(pStage, surf, ac); @@ -683,6 +697,7 @@ void RB_T_FillDepthBuffer(const drawSurf_t* surf) { GL_SelectTexture(0); globalImages->BindNull(); + glMotionObjectIdui(0); if (alphaTestWasEnabled) { glDisable(GL_ALPHA_TEST); glEnable(GL_BLEND);