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.

56 lines
1.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "baseanimatedtextureproxy.h"
  8. // memdbgon must be the last include file in a .cpp file!!!
  9. #include "tier0/memdbgon.h"
  10. class CAnimatedOffsetTextureProxy : public CBaseAnimatedTextureProxy
  11. {
  12. public:
  13. CAnimatedOffsetTextureProxy() : m_flFrameOffset( 0.0f ) {}
  14. virtual ~CAnimatedOffsetTextureProxy() {}
  15. virtual float GetAnimationStartTime( void* pBaseEntity );
  16. virtual void OnBind( void *pBaseEntity );
  17. protected:
  18. float m_flFrameOffset;
  19. };
  20. EXPOSE_INTERFACE( CAnimatedOffsetTextureProxy, IMaterialProxy, "AnimatedOffsetTexture" IMATERIAL_PROXY_INTERFACE_VERSION );
  21. //-----------------------------------------------------------------------------
  22. // Purpose:
  23. // Input : pArg -
  24. // Output : float
  25. //-----------------------------------------------------------------------------
  26. float CAnimatedOffsetTextureProxy::GetAnimationStartTime( void* pArg )
  27. {
  28. return m_flFrameOffset;
  29. }
  30. //-----------------------------------------------------------------------------
  31. // Purpose:
  32. // Input : *pBaseEntity -
  33. //-----------------------------------------------------------------------------
  34. void CAnimatedOffsetTextureProxy::OnBind( void *pBaseEntity )
  35. {
  36. C_BaseEntity* pEntity = (C_BaseEntity*)pBaseEntity;
  37. if ( pEntity )
  38. {
  39. m_flFrameOffset = pEntity->GetTextureAnimationStartTime();
  40. }
  41. // Call into the base class
  42. CBaseAnimatedTextureProxy::OnBind( pBaseEntity );
  43. }