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.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef PHYSICS_SHADOW_H
  8. #define PHYSICS_SHADOW_H
  9. #pragma once
  10. class CPhysicsObject;
  11. class IPhysicsShadowController;
  12. class IPhysicsPlayerController;
  13. extern IPhysicsShadowController *CreateShadowController( CPhysicsObject *pObject, bool allowTranslation, bool allowRotation );
  14. extern IPhysicsPlayerController *CreatePlayerController( CPhysicsObject *pObject );
  15. extern void DestroyPlayerController( IPhysicsPlayerController *pController );
  16. extern void ComputeController( IVP_U_Float_Point &currentSpeed, const IVP_U_Float_Point &delta, const IVP_U_Float_Point &maxSpeed, float scaleDelta, float damping );
  17. #include "ivp_physics.hxx"
  18. struct shadowcontrol_params_t
  19. {
  20. shadowcontrol_params_t()
  21. {
  22. lastPosition.set_to_zero();
  23. lastImpulse.set_to_zero();
  24. }
  25. IVP_U_Point targetPosition;
  26. IVP_U_Quat targetRotation;
  27. IVP_U_Point lastPosition; // estimate for where the object should be, used to compute error for teleport
  28. IVP_U_Float_Point lastImpulse; // Impulse applied last frame
  29. float maxAngular;
  30. float maxDampAngular;
  31. float maxSpeed;
  32. float maxDampSpeed;
  33. float dampFactor;
  34. float teleportDistance;
  35. };
  36. float ComputeShadowControllerHL( CPhysicsObject *pObject, const hlshadowcontrol_params_t &params, float secondsToArrival, float dt );
  37. float ComputeShadowControllerIVP( IVP_Real_Object *pivp, shadowcontrol_params_t &params, float secondsToArrival, float dt );
  38. #endif // PHYSICS_SHADOW_H