Team Fortress 2 Source Code as on 22/4/2020
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.

49 lines
1.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "cbase.h"
  8. #include "particlesphererenderer.h"
  9. #include "materialsystem/imaterialvar.h"
  10. // memdbgon must be the last include file in a .cpp file!!!
  11. #include "tier0/memdbgon.h"
  12. CParticleSphereRenderer::CParticleSphereRenderer()
  13. {
  14. m_vBaseColor.Init();
  15. memset( &m_AmbientLight, 0, sizeof( m_AmbientLight ) );
  16. memset( &m_DirectionalLight, 0, sizeof( m_DirectionalLight ) );
  17. m_bUsingPixelShaders = false;
  18. m_iLastTickStartRenderCalled = -1;
  19. m_pParticleMgr = NULL;
  20. }
  21. void CParticleSphereRenderer::Init( CParticleMgr *pParticleMgr, IMaterial *pMaterial )
  22. {
  23. m_pParticleMgr = pParticleMgr;
  24. // Figure out how we need to draw.
  25. bool bFound = false;
  26. IMaterialVar *pVar = pMaterial->FindVar( "$USINGPIXELSHADER", &bFound, false );
  27. if( bFound && pVar && pVar->GetIntValue() )
  28. m_bUsingPixelShaders = true;
  29. else
  30. m_bUsingPixelShaders = false;
  31. }
  32. void CParticleSphereRenderer::StartRender( VMatrix &effectMatrix )
  33. {
  34. // We're about to be rendered.. set our directional lighting parameters for this particle system.
  35. if ( m_pParticleMgr )
  36. {
  37. m_pParticleMgr->SetDirectionalLightInfo( m_DirectionalLight );
  38. }
  39. m_iLastTickStartRenderCalled = gpGlobals->tickcount;
  40. }