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.

79 lines
3.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef VEHICLE_VIEWBLEND_SHARED_H
  7. #define VEHICLE_VIEWBLEND_SHARED_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. // Definition for how to calculate a point on the remap curve
  12. enum RemapAngleRange_CurvePart_t
  13. {
  14. RemapAngleRange_CurvePart_Zero = 0,
  15. RemapAngleRange_CurvePart_Spline,
  16. RemapAngleRange_CurvePart_Linear,
  17. };
  18. // If we enter the linear part of the remap for curve for any degree of freedom, we can lock
  19. // that DOF (stop remapping). This is useful for making flips feel less spastic as we oscillate
  20. // randomly between different parts of the remapping curve.
  21. struct ViewLockData_t
  22. {
  23. float flLockInterval; // The duration to lock the view when we lock it for this degree of freedom.
  24. // 0 = never lock this degree of freedom.
  25. bool bLocked; // True if this DOF was locked because of the above condition.
  26. float flUnlockTime; // If this DOF is locked, the time when we will unlock it.
  27. float flUnlockBlendInterval; // If this DOF is locked, how long to spend blending out of the locked view when we unlock.
  28. };
  29. // This is separate from the base vehicle implementation so that any class
  30. // that derives from IClientVehicle can use it. To use it, contain one of the
  31. // following structs, fill out the first section, and then call VehicleViewSmoothing()
  32. // inside your GetVehicleViewPosition() function.
  33. struct ViewSmoothingData_t
  34. {
  35. DECLARE_SIMPLE_DATADESC();
  36. // Fill these out in your vehicle
  37. CBaseAnimating *pVehicle;
  38. bool bClampEyeAngles; // Perform eye Z clamping
  39. float flPitchCurveZero; // Pitch values below this are clamped to zero.
  40. float flPitchCurveLinear; // Pitch values above this are mapped directly.
  41. // Spline in between.
  42. float flRollCurveZero; // Pitch values below this are clamped to zero.
  43. float flRollCurveLinear; // Roll values above this are mapped directly.
  44. // Spline in between.
  45. float flFOV; // FOV when in the vehicle.
  46. ViewLockData_t pitchLockData;
  47. ViewLockData_t rollLockData;
  48. bool bDampenEyePosition; // Only set to true for C_PropVehicleDriveable derived vehicles
  49. // Don't change these, they're used by VehicleViewSmoothing()
  50. bool bRunningEnterExit;
  51. bool bWasRunningAnim;
  52. float flEnterExitStartTime; // Time we began our animation at
  53. float flEnterExitDuration; // Duration of the animation
  54. QAngle vecAnglesSaved;
  55. Vector vecOriginSaved;
  56. QAngle vecAngleDiffSaved; // The original angular error between the entry/exit anim and player's view when we started playing the anim.
  57. QAngle vecAngleDiffMin; // Tracks the minimum angular error achieved so we can converge on the anim's angles.
  58. };
  59. // TEMP: Shared vehicle view smoothing
  60. void SharedVehicleViewSmoothing(CBasePlayer *pPlayer,
  61. Vector *pAbsOrigin, QAngle *pAbsAngles,
  62. bool bEnterAnimOn, bool bExitAnimOn,
  63. const Vector &vecEyeExitEndpoint,
  64. ViewSmoothingData_t *pData,
  65. float *pFOV );
  66. #endif // VEHICLE_VIEWBLEND_SHARED_H