@@ -1283,33 +1283,13 @@ class CTriAPICommand
12831283 int RenderMode{ };
12841284 int DrawRenderMode{ };
12851285 GLuint hVAO{};
1286+ std::shared_ptr<CSpriteModelRenderData> pSpriteRenderData;
12861287};
12871288
12881289CTriAPICommand gTriAPICommand ;
12891290IPMBRingBuffer* g_TriAPIVertexBuffer{};
12901291IPMBRingBuffer* g_TriAPIIndexBuffer{};
12911292
1292- void triapi_Shutdown ()
1293- {
1294- if (g_TriAPIVertexBuffer)
1295- {
1296- g_TriAPIVertexBuffer->Destroy ();
1297- g_TriAPIVertexBuffer = nullptr ;
1298- }
1299-
1300- if (g_TriAPIIndexBuffer)
1301- {
1302- g_TriAPIIndexBuffer->Destroy ();
1303- g_TriAPIIndexBuffer = nullptr ;
1304- }
1305-
1306- if (gTriAPICommand .hVAO )
1307- {
1308- GL_DeleteVAO (gTriAPICommand .hVAO );
1309- gTriAPICommand .hVAO = 0 ;
1310- }
1311- }
1312-
13131293void triapi_RenderMode (int mode)
13141294{
13151295 gTriAPICommand .RenderMode = mode;
@@ -1345,6 +1325,29 @@ void triapi_EndClear()
13451325 gTriAPICommand .Indices .clear ();
13461326}
13471327
1328+ void triapi_Shutdown ()
1329+ {
1330+ if (g_TriAPIVertexBuffer)
1331+ {
1332+ g_TriAPIVertexBuffer->Destroy ();
1333+ g_TriAPIVertexBuffer = nullptr ;
1334+ }
1335+
1336+ if (g_TriAPIIndexBuffer)
1337+ {
1338+ g_TriAPIIndexBuffer->Destroy ();
1339+ g_TriAPIIndexBuffer = nullptr ;
1340+ }
1341+
1342+ if (gTriAPICommand .hVAO )
1343+ {
1344+ GL_DeleteVAO (gTriAPICommand .hVAO );
1345+ gTriAPICommand .hVAO = 0 ;
1346+ }
1347+
1348+ gTriAPICommand .pSpriteRenderData .reset ();
1349+ }
1350+
13481351void triapi_End ()
13491352{
13501353 size_t n = gTriAPICommand .Vertices .size ();
@@ -1752,6 +1755,34 @@ void triapi_End()
17521755 }
17531756 }
17541757
1758+ if (gTriAPICommand .pSpriteRenderData )
1759+ {
1760+ if (r_draw_opaque)
1761+ {
1762+ int iStencilRef = 0 ;
1763+
1764+ if ((gTriAPICommand .pSpriteRenderData ->flags & FMODEL_NOBLOOM))
1765+ {
1766+ iStencilRef |= STENCIL_MASK_NO_BLOOM;
1767+
1768+ // has stencil write-in
1769+ GL_BeginStencilWrite (iStencilRef, STENCIL_MASK_ALL);
1770+ }
1771+ }
1772+ else
1773+ {
1774+ int iStencilRef = 0 ;
1775+
1776+ if ((gTriAPICommand .pSpriteRenderData ->flags & FMODEL_NOBLOOM))
1777+ {
1778+ iStencilRef |= STENCIL_MASK_NO_BLOOM;
1779+
1780+ // has stencil write-in
1781+ GL_BeginStencilWrite (iStencilRef, STENCIL_MASK_NO_BLOOM);
1782+ }
1783+ }
1784+ }
1785+
17551786 triapi_program_t prog{};
17561787 R_UseTriAPIProgram (ProgramState, &prog);
17571788
@@ -1769,6 +1800,7 @@ void triapi_End()
17691800 // Restore pipeline state
17701801 glDisable (GL_BLEND);
17711802 glDepthMask (GL_TRUE);
1803+ GL_EndStencil ();
17721804
17731805 GL_BindVAO (0 );
17741806
@@ -1913,6 +1945,13 @@ void triapi_FogParams(float flDensity, qboolean bFogAffectsSkybox)
19131945 gPrivateFuncs .triapi_FogParams (flDensity, bFogAffectsSkybox);
19141946}
19151947
1948+ qboolean triapi_SpriteTexture (model_t * pSpriteModel, int frame)
1949+ {
1950+ gTriAPICommand .pSpriteRenderData = R_GetSpriteRenderDataFromModel (pSpriteModel);
1951+
1952+ return gPrivateFuncs .triapi_SpriteTexture (pSpriteModel, frame);
1953+ }
1954+
19161955void __stdcall triapi_glBegin (int GLPrimitiveCode)
19171956{
19181957 gTriAPICommand .GLPrimitiveCode = GLPrimitiveCode;
0 commit comments