Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

703 lines
19 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=====================================================================================//
  6. #include "quakedef.h"
  7. #include "gl_model_private.h"
  8. #include "console.h"
  9. #include "cdll_engine_int.h"
  10. #include "gl_cvars.h"
  11. #include "ivrenderview.h"
  12. #include "gl_matsysiface.h"
  13. #include "gl_drawlights.h"
  14. #include "gl_rsurf.h"
  15. #include "r_local.h"
  16. #include "debugoverlay.h"
  17. #include "vgui_baseui_interface.h"
  18. #include "materialsystem/imaterialsystemhardwareconfig.h"
  19. #include "demo.h"
  20. #include "istudiorender.h"
  21. #include "materialsystem/imesh.h"
  22. #include "tier0/vprof.h"
  23. #include "host.h"
  24. #include "view.h"
  25. #include "client.h"
  26. #include "sys.h"
  27. #include "cl_main.h"
  28. #include "l_studio.h"
  29. #include "IOcclusionSystem.h"
  30. #include "cl_demouipanel.h"
  31. #include "mod_vis.h"
  32. #include "ivideomode.h"
  33. #include "gl_shader.h"
  34. #include "gl_rmain.h"
  35. #include "engine/view_sharedv1.h"
  36. #include "ispatialpartitioninternal.h"
  37. #include "toolframework/itoolframework.h"
  38. #include "tier1/callqueue.h"
  39. #include "filesystem/IQueuedLoader.h"
  40. #include "r_decal.h"
  41. #ifdef _PS3
  42. #include "tls_ps3.h"
  43. #endif
  44. #if defined( INCLUDE_SCALEFORM )
  45. #include "scaleformui/scaleformui.h"
  46. #endif
  47. // memdbgon must be the last include file in a .cpp file!!!
  48. #include "tier0/memdbgon.h"
  49. class IClientEntity;
  50. float r_blend;
  51. float r_colormod[3] = { 1, 1, 1 };
  52. bool g_bIsBlendingOrModulating = false;
  53. bool g_bIsRenderingVGuiOnly = false;
  54. colorVec R_LightPoint (Vector& p);
  55. void R_DrawLightmaps( IWorldRenderList *pList, int pageId );
  56. void R_DrawIdentityBrushModel( IWorldRenderList *pRenderList, model_t *model );
  57. static ConVar r_brush_queue_mode( "r_brush_queue_mode", "0", FCVAR_CHEAT );
  58. /*
  59. The view is allowed to move slightly from it's true position for bobbing,
  60. but if it exceeds 8 pixels linear distance (spherical, not box), the list of
  61. entities sent from the server may not include everything in the pvs, especially
  62. when crossing a water boudnary.
  63. */
  64. extern ConVar r_avglightmap;
  65. /*
  66. =================
  67. V_CheckGamma
  68. FIXME: Define this as a change function to the ConVar's below rather than polling it
  69. every frame. Note, still need to make sure it gets called very first time through frame loop.
  70. =================
  71. */
  72. bool V_CheckGamma( void )
  73. {
  74. if ( IsX360() )
  75. return false;
  76. static int lastLightmap = -1;
  77. extern void GL_RebuildLightmaps( void );
  78. // Refresh all lightmaps if r_avglightmap changes
  79. if ( r_avglightmap.GetInt() != lastLightmap )
  80. {
  81. lastLightmap = r_avglightmap.GetInt();
  82. GL_RebuildLightmaps();
  83. }
  84. return true;
  85. }
  86. //-----------------------------------------------------------------------------
  87. // Purpose: Initializes the view renderer
  88. // Output : void V_Init
  89. //-----------------------------------------------------------------------------
  90. void V_Init( void )
  91. {
  92. BuildGammaTable( 2.2f, 2.2f, 0.0f, 2 );
  93. }
  94. //-----------------------------------------------------------------------------
  95. // Purpose:
  96. //-----------------------------------------------------------------------------
  97. void V_Shutdown( void )
  98. {
  99. // TODO, cleanup
  100. }
  101. //-----------------------------------------------------------------------------
  102. // Purpose:
  103. // Input : -
  104. //-----------------------------------------------------------------------------
  105. void V_RenderVGuiOnly_NoSwap()
  106. {
  107. // Need to clear the screen in this case, cause we're not drawing
  108. // the loading screen.
  109. UpdateMaterialSystemConfig();
  110. CMatRenderContextPtr pRenderContext( materials );
  111. pRenderContext->AntiAliasingHint( AA_HINT_MENU ); // would be better to do "Disable MLAA" here
  112. pRenderContext->ClearBuffers( true, true );
  113. #if defined( INCLUDE_SCALEFORM )
  114. // Render scaleform before vgui
  115. pRenderContext->AdvanceAndRenderScaleformSlot( SF_FULL_SCREEN_SLOT );
  116. #endif
  117. EngineVGui()->Paint( PAINT_UIPANELS );
  118. #if defined( INCLUDE_SCALEFORM )
  119. // Render cursor after vgui
  120. pRenderContext->AdvanceAndRenderScaleformCursor();
  121. #endif
  122. }
  123. //-----------------------------------------------------------------------------
  124. // Purpose: Renders only vgui (for loading progress) including buffer swapping and vgui simulation
  125. //-----------------------------------------------------------------------------
  126. bool s_bTriggeredHostError = false;
  127. void V_RenderVGuiOnly( void )
  128. {
  129. materials->BeginFrame( host_frametime );
  130. CMatRenderContextPtr pRenderContext;
  131. pRenderContext.GetFrom( materials );
  132. pRenderContext->RenderScaleformSlot(SF_RESERVED_BEGINFRAME_SLOT);
  133. pRenderContext.SafeRelease();
  134. EngineVGui()->Simulate();
  135. g_EngineRenderer->FrameBegin();
  136. toolframework->RenderFrameBegin();
  137. V_RenderVGuiOnly_NoSwap();
  138. toolframework->RenderFrameEnd();
  139. g_EngineRenderer->FrameEnd( );
  140. pRenderContext.GetFrom( materials );
  141. pRenderContext->RenderScaleformSlot(SF_RESERVED_ENDFRAME_SLOT);
  142. pRenderContext.SafeRelease();
  143. materials->EndFrame();
  144. Shader_SwapBuffers();
  145. #ifdef _PS3
  146. if ( GetTLSGlobals()->bNormalQuitRequested )
  147. {
  148. // hack to prevent PS/3 deadlock on queued loader render mutex when quitting during loading a map
  149. uint nUnlockedQueuedRenderer = g_pQueuedLoader ? g_pQueuedLoader->UnlockProgressBarMutex() : 0;
  150. if ( !s_bTriggeredHostError )
  151. {
  152. Assert( ThreadInMainThread() );
  153. s_bTriggeredHostError = true;
  154. Host_Error( "SystemQuitRequest" );
  155. }
  156. // hack to prevent PS/3 deadlock on queued loader render mutex when quitting during loading a map
  157. if( g_pQueuedLoader )
  158. {
  159. g_pQueuedLoader->LockProgressBarMutex( nUnlockedQueuedRenderer );
  160. }
  161. }
  162. #endif
  163. }
  164. //-----------------------------------------------------------------------------
  165. // Purpose: Render the world
  166. //-----------------------------------------------------------------------------
  167. void V_RenderView( void )
  168. {
  169. VPROF( "V_RenderView" );
  170. MDLCACHE_COARSE_LOCK_(g_pMDLCache);
  171. bool bCanRenderWorld = ( host_state.worldmodel != NULL ) && GetBaseLocalClient().IsActive();
  172. bCanRenderWorld = bCanRenderWorld && !EngineVGui()->IsPlayingFullScreenVideo();
  173. bCanRenderWorld = bCanRenderWorld && toolframework->ShouldGameRenderView();
  174. if ( IsPC() && bCanRenderWorld && g_bTextMode )
  175. {
  176. // Sleep to let the other textmode clients get some cycles.
  177. Sys_Sleep( 15 );
  178. bCanRenderWorld = false;
  179. }
  180. // Update stereo layer
  181. if ( !g_LostVideoMemory )
  182. {
  183. if ( materials && materials->IsStereoSupported() )
  184. {
  185. materials->NVStereoUpdate();
  186. }
  187. }
  188. if ( !bCanRenderWorld )
  189. {
  190. // Because we now do a lot of downloading before spawning map, don't render anything world related
  191. // until we are an active client.
  192. V_RenderVGuiOnly_NoSwap();
  193. }
  194. else if ( !g_LostVideoMemory )
  195. {
  196. // since we know we're going to render the world, check for lightmap updates while it is easy
  197. // to tear down and rebuild
  198. R_CheckForLightingConfigChanges();
  199. R_CheckForPaintmapChanges();
  200. // Pass game time to shader api
  201. {
  202. CMatRenderContextPtr pRenderContext( g_pMaterialSystem );
  203. pRenderContext->UpdateGameTime( g_ClientGlobalVariables.curtime );
  204. }
  205. // We can get into situations where some other material system app
  206. // is trying to start up; in those cases, we shouldn't render...
  207. vrect_t scr_vrect = videomode->GetClientViewRect();
  208. g_ClientDLL->View_Render( &scr_vrect );
  209. // Cleanup all of the immediate cleanup decals here, after we've rendered the views.
  210. R_DecalFlushDestroyList( true );
  211. }
  212. }
  213. void Linefile_Draw( void );
  214. //-----------------------------------------------------------------------------
  215. // Purpose: Expose rendering interface to client .dll
  216. //-----------------------------------------------------------------------------
  217. class CVRenderView : public IVRenderView, public ISpatialLeafEnumerator
  218. {
  219. public:
  220. void TouchLight( dlight_t *light )
  221. {
  222. int i;
  223. i = light - cl_dlights;
  224. if (i >= 0 && i < MAX_DLIGHTS)
  225. {
  226. r_dlightchanged |= (1 << i);
  227. }
  228. }
  229. void DrawBrushModel(
  230. IClientEntity *baseentity,
  231. model_t *model,
  232. const Vector& origin,
  233. const QAngle& angles,
  234. bool bUnused )
  235. {
  236. R_DrawBrushModel( baseentity, model, origin, angles, DEPTH_MODE_NORMAL, true, true );
  237. }
  238. virtual void DrawBrushModelEx( IClientEntity *baseentity, model_t *model, const Vector& origin, const QAngle& angles, DrawBrushModelMode_t mode )
  239. {
  240. bool bDrawOpaque = ( mode != DBM_DRAW_TRANSLUCENT_ONLY );
  241. bool bDrawTranslucent = ( mode != DBM_DRAW_OPAQUE_ONLY );
  242. R_DrawBrushModel( baseentity, model, origin, angles, DEPTH_MODE_NORMAL, bDrawOpaque, bDrawTranslucent );
  243. }
  244. virtual void DrawBrushModelArray( IMatRenderContext* pRenderContext, int nCount,
  245. const BrushArrayInstanceData_t *pInstanceData, int nModelTypeFlags )
  246. {
  247. #ifdef _DEBUG
  248. for ( int i = 0; i < nCount; ++i )
  249. {
  250. Assert( pRenderContext->IsRenderData( pInstanceData[i].m_pBrushToWorld ) );
  251. }
  252. #endif
  253. ICallQueue *pCallQueue = pRenderContext->GetCallQueue();
  254. if ( !pCallQueue || r_brush_queue_mode.GetInt() == 0 )
  255. {
  256. R_DrawBrushModelArray( pRenderContext, nCount, pInstanceData, nModelTypeFlags );
  257. }
  258. else
  259. {
  260. CMatRenderData< BrushArrayInstanceData_t > brushArrayData( pRenderContext );
  261. if ( !pRenderContext->IsRenderData( pInstanceData ) )
  262. {
  263. pInstanceData = brushArrayData.Lock( nCount, pInstanceData );
  264. }
  265. pCallQueue->QueueCall( R_DrawBrushModelArray, nCount, pInstanceData, nModelTypeFlags );
  266. }
  267. }
  268. // Draw brush model shadow
  269. void DrawBrushModelShadow( IClientRenderable *pRenderable )
  270. {
  271. R_DrawBrushModelShadow( pRenderable );
  272. }
  273. void DrawIdentityBrushModel( IWorldRenderList *pList, model_t *model )
  274. {
  275. R_DrawIdentityBrushModel( pList, model );
  276. }
  277. void Draw3DDebugOverlays( void )
  278. {
  279. DrawSavedModelDebugOverlays();
  280. if ( g_pDemoUI )
  281. {
  282. g_pDemoUI->DrawDebuggingInfo();
  283. }
  284. //if ( g_pDemoUI2 )
  285. //{
  286. // g_pDemoUI2->DrawDebuggingInfo();
  287. //}
  288. SpatialPartition()->DrawDebugOverlays();
  289. CDebugOverlay::Draw3DOverlays();
  290. // Render occlusion debugging info
  291. OcclusionSystem()->DrawDebugOverlays();
  292. }
  293. FORCEINLINE void CheckBlend( void )
  294. {
  295. g_bIsBlendingOrModulating = ( r_blend != 1.0 ) ||
  296. ( r_colormod[0] != 1.0 ) || ( r_colormod[1] != 1.0 ) || ( r_colormod[2] != 1.0 );
  297. }
  298. void SetBlend( float blend )
  299. {
  300. r_blend = blend;
  301. CheckBlend();
  302. }
  303. float GetBlend( void )
  304. {
  305. return r_blend;
  306. }
  307. void SetColorModulation( float const* blend )
  308. {
  309. VectorCopy( blend, r_colormod );
  310. CheckBlend();
  311. }
  312. void GetColorModulation( float* blend )
  313. {
  314. VectorCopy( r_colormod, blend );
  315. }
  316. void SceneBegin( void )
  317. {
  318. g_EngineRenderer->DrawSceneBegin();
  319. }
  320. void SceneEnd( void )
  321. {
  322. g_EngineRenderer->DrawSceneEnd();
  323. }
  324. void GetVisibleFogVolume( const Vector& vEyePoint, const VisOverrideData_t *pVisOverrideData, VisibleFogVolumeInfo_t *pInfo )
  325. {
  326. R_GetVisibleFogVolume( vEyePoint, pVisOverrideData, pInfo );
  327. }
  328. IWorldRenderList * CreateWorldList()
  329. {
  330. return g_EngineRenderer->CreateWorldList();
  331. }
  332. #if defined(_PS3)
  333. IWorldRenderList * CreateWorldList_PS3( int viewID )
  334. {
  335. return g_EngineRenderer->CreateWorldList_PS3( viewID );
  336. }
  337. void BuildWorldLists_PS3_Epilogue( IWorldRenderList *pList, WorldListInfo_t* pInfo, bool bShadowDepth )
  338. {
  339. g_EngineRenderer->BuildWorldLists_PS3_Epilogue( pList, pInfo, bShadowDepth );
  340. }
  341. #else
  342. void BuildWorldLists_Epilogue( IWorldRenderList *pList, WorldListInfo_t* pInfo, bool bShadowDepth )
  343. {
  344. g_EngineRenderer->BuildWorldLists_Epilogue( pList, pInfo, bShadowDepth );
  345. }
  346. #endif
  347. void BuildWorldLists( IWorldRenderList *pList, WorldListInfo_t* pInfo, int iForceFViewLeaf, const VisOverrideData_t* pVisData, bool bShadowDepth, float *pReflectionWaterHeight )
  348. {
  349. g_EngineRenderer->BuildWorldLists( pList, pInfo, iForceFViewLeaf, pVisData, bShadowDepth, pReflectionWaterHeight );
  350. }
  351. void DrawWorldLists( IMatRenderContext *pRenderContext, IWorldRenderList *pList, unsigned long flags, float waterZAdjust )
  352. {
  353. g_EngineRenderer->DrawWorldLists( pRenderContext, pList, flags, waterZAdjust );
  354. }
  355. void GetWorldListIndicesInfo( WorldListIndicesInfo_t * pIndicesInfoOut, IWorldRenderList *pList, unsigned long nFlags )
  356. {
  357. return R_GetWorldListIndicesInfo( pIndicesInfoOut, pList, nFlags );
  358. }
  359. // Optimization for top view
  360. void DrawTopView( bool enable )
  361. {
  362. R_DrawTopView( enable );
  363. }
  364. void TopViewNoBackfaceCulling( bool bDisable )
  365. {
  366. R_TopViewNoBackfaceCulling( bDisable );
  367. }
  368. void TopViewNoVisCheck( bool bDisable )
  369. {
  370. R_TopViewNoVisCheck( bDisable );
  371. }
  372. void TopViewBounds( Vector2D const& mins, Vector2D const& maxs )
  373. {
  374. R_TopViewBounds( mins, maxs );
  375. }
  376. void SetTopViewVolumeCuller( const CVolumeCuller *pVolumeCuller )
  377. {
  378. R_SetTopViewVolumeCuller( pVolumeCuller );
  379. }
  380. void DrawLights( void )
  381. {
  382. DrawLightSprites();
  383. #ifdef USE_CONVARS
  384. DrawLightDebuggingInfo();
  385. #endif
  386. }
  387. void DrawMaskEntities( void )
  388. {
  389. // UNDONE: Don't do this with masked brush models, they should probably be in a separate list
  390. // R_DrawMaskEntities()
  391. }
  392. void DrawTranslucentSurfaces( IMatRenderContext *pRenderContext, IWorldRenderList *pList, int *pSortList, int sortCount, unsigned long flags )
  393. {
  394. Shader_DrawTranslucentSurfaces( pRenderContext, pList, pSortList, sortCount, flags );
  395. }
  396. bool LeafContainsTranslucentSurfaces( IWorldRenderList *pList, int sortIndex, unsigned long flags )
  397. {
  398. return Shader_LeafContainsTranslucentSurfaces( pList, sortIndex, flags );
  399. }
  400. void DrawLineFile( void )
  401. {
  402. Linefile_Draw();
  403. }
  404. void DrawLightmaps( IWorldRenderList *pList, int pageId )
  405. {
  406. R_DrawLightmaps( pList, pageId );
  407. }
  408. void ViewSetupVis( bool novis, int numorigins, const Vector origin[] )
  409. {
  410. g_EngineRenderer->ViewSetupVis( novis, numorigins, origin );
  411. }
  412. void ViewSetupVisEx( bool novis, int numorigins, const Vector origin[], unsigned int &returnFlags )
  413. {
  414. g_EngineRenderer->ViewSetupVisEx( novis, numorigins, origin, returnFlags );
  415. }
  416. bool AreAnyLeavesVisible( int *leafList, int nLeaves )
  417. {
  418. return Map_AreAnyLeavesVisible( *host_state.worldbrush, leafList, nLeaves );
  419. }
  420. // For backward compatibility only!!!
  421. void VguiPaint( void )
  422. {
  423. EngineVGui()->BackwardCompatibility_Paint();
  424. }
  425. void VGui_Paint( int mode )
  426. {
  427. EngineVGui()->Paint( (PaintMode_t)mode );
  428. }
  429. void ViewDrawFade( byte *color, IMaterial* pFadeMaterial, bool mapFullTextureToScreen )
  430. {
  431. VPROF_BUDGET( "ViewDrawFade", VPROF_BUDGETGROUP_WORLD_RENDERING );
  432. g_EngineRenderer->ViewDrawFade( color, pFadeMaterial, mapFullTextureToScreen );
  433. }
  434. void OLD_SetProjectionMatrix( float fov, float zNear, float zFar )
  435. {
  436. // Here to preserve backwards compat
  437. }
  438. void OLD_SetOffCenterProjectionMatrix( float fov, float zNear, float zFar, float flAspectRatio,
  439. float flBottom, float flTop, float flLeft, float flRight )
  440. {
  441. // Here to preserve backwards compat
  442. }
  443. void OLD_SetProjectionMatrixOrtho( float left, float top, float right, float bottom, float zNear, float zFar )
  444. {
  445. // Here to preserve backwards compat
  446. }
  447. colorVec GetLightAtPoint( Vector& pos )
  448. {
  449. return R_LightPoint( pos );
  450. }
  451. int GetViewEntity( void )
  452. {
  453. return GetLocalClient().GetViewEntity();
  454. }
  455. bool IsViewEntity( int entindex )
  456. {
  457. FOR_EACH_VALID_SPLITSCREEN_PLAYER( i )
  458. {
  459. if ( GetLocalClient( i ).GetViewEntity() == entindex )
  460. return true;
  461. }
  462. return false;
  463. }
  464. float GetFieldOfView( void )
  465. {
  466. return g_EngineRenderer->GetFov();
  467. }
  468. unsigned char **GetAreaBits( void )
  469. {
  470. return GetBaseLocalClient().GetAreaBits_BackwardCompatibility();
  471. }
  472. virtual void SetAreaState(
  473. unsigned char chAreaBits[MAX_AREA_STATE_BYTES],
  474. unsigned char chAreaPortalBits[MAX_AREA_PORTAL_STATE_BYTES] )
  475. {
  476. *GetBaseLocalClient().GetAreaBits_BackwardCompatibility() = 0; // Clear the b/w compatibiltiy thing.
  477. memcpy( GetBaseLocalClient().m_chAreaBits, chAreaBits, MAX_AREA_STATE_BYTES );
  478. memcpy( GetBaseLocalClient().m_chAreaPortalBits, chAreaPortalBits, MAX_AREA_PORTAL_STATE_BYTES );
  479. GetBaseLocalClient().m_bAreaBitsValid = true;
  480. }
  481. // World fog for world rendering
  482. void SetFogVolumeState( int fogVolume, bool useHeightFog )
  483. {
  484. R_SetFogVolumeState(fogVolume, useHeightFog );
  485. }
  486. virtual void InstallBrushSurfaceRenderer( IBrushRenderer* pBrushRenderer )
  487. {
  488. R_InstallBrushRenderOverride( pBrushRenderer );
  489. }
  490. struct BoxIntersectWaterContext_t
  491. {
  492. bool m_bFoundWaterLeaf;
  493. int m_nLeafWaterDataID;
  494. };
  495. bool EnumerateLeaf( int leaf, intp context )
  496. {
  497. BoxIntersectWaterContext_t *pSearchContext = ( BoxIntersectWaterContext_t * )context;
  498. mleaf_t *pLeaf = &host_state.worldmodel->brush.pShared->leafs[leaf];
  499. if( pLeaf->leafWaterDataID == pSearchContext->m_nLeafWaterDataID )
  500. {
  501. pSearchContext->m_bFoundWaterLeaf = true;
  502. // found it . . stop enumeration
  503. return false;
  504. }
  505. return true;
  506. }
  507. bool DoesBoxIntersectWaterVolume( const Vector &mins, const Vector &maxs, int leafWaterDataID )
  508. {
  509. BoxIntersectWaterContext_t context;
  510. context.m_bFoundWaterLeaf = false;
  511. context.m_nLeafWaterDataID = leafWaterDataID;
  512. g_pToolBSPTree->EnumerateLeavesInBox( mins, maxs, this, ( intp )&context );
  513. return context.m_bFoundWaterLeaf;
  514. }
  515. // Push, pop views
  516. virtual void Push3DView( IMatRenderContext *pRenderContext, const CViewSetup &view, int nFlags, ITexture* pRenderTarget, Frustum frustumPlanes )
  517. {
  518. g_EngineRenderer->Push3DView( pRenderContext, view, nFlags, pRenderTarget, frustumPlanes, NULL );
  519. }
  520. virtual void Push2DView( IMatRenderContext *pRenderContext, const CViewSetup &view, int nFlags, ITexture* pRenderTarget, Frustum frustumPlanes )
  521. {
  522. g_EngineRenderer->Push2DView( pRenderContext, view, nFlags, pRenderTarget, frustumPlanes );
  523. }
  524. virtual void PopView( IMatRenderContext *pRenderContext, Frustum frustumPlanes )
  525. {
  526. g_EngineRenderer->PopView( pRenderContext, frustumPlanes );
  527. }
  528. virtual void SetMainView( const Vector &vecOrigin, const QAngle &angles )
  529. {
  530. g_EngineRenderer->SetMainView( vecOrigin, angles );
  531. }
  532. void OverrideViewFrustum( Frustum custom )
  533. {
  534. g_EngineRenderer->OverrideViewFrustum( custom );
  535. }
  536. void DrawBrushModelShadowDepth(
  537. IClientEntity *baseentity,
  538. model_t *model,
  539. const Vector& origin,
  540. const QAngle& angles,
  541. ERenderDepthMode_t DepthMode )
  542. {
  543. R_DrawBrushModel( baseentity, model, origin, angles, DEPTH_MODE_SHADOW, true, true );
  544. }
  545. void UpdateBrushModelLightmap( model_t *model, IClientRenderable *pRenderable )
  546. {
  547. g_EngineRenderer->UpdateBrushModelLightmap( model, pRenderable );
  548. }
  549. void BeginUpdateLightmaps( void )
  550. {
  551. g_EngineRenderer->BeginUpdateLightmaps();
  552. }
  553. void EndUpdateLightmaps()
  554. {
  555. g_EngineRenderer->EndUpdateLightmaps();
  556. }
  557. virtual void Push3DView( IMatRenderContext *pRenderContext, const CViewSetup &view, int nFlags, ITexture* pRenderTarget, Frustum frustumPlanes, ITexture* pDepthTexture )
  558. {
  559. g_EngineRenderer->Push3DView( pRenderContext, view, nFlags, pRenderTarget, frustumPlanes, pDepthTexture );
  560. }
  561. void GetMatricesForView( const CViewSetup &view, VMatrix *pWorldToView, VMatrix *pViewToProjection, VMatrix *pWorldToProjection, VMatrix *pWorldToPixels )
  562. {
  563. view.ComputeViewMatrices( pWorldToView, pViewToProjection, pWorldToProjection );
  564. ComputeWorldToScreenMatrix( pWorldToPixels, *pWorldToProjection, view );
  565. }
  566. virtual bool DoesBrushModelNeedPowerOf2Framebuffer( const model_t *model )
  567. {
  568. return !!( model->flags & MODELFLAG_FRAMEBUFFER_TEXTURE );
  569. }
  570. };
  571. static CVRenderView s_RenderView;
  572. EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CVRenderView, IVRenderView, VENGINE_RENDERVIEW_INTERFACE_VERSION, s_RenderView );