camera.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. class Camera extends Entity
  2. {
  3. /**
  4. \brief Returns active Camera instance (note: player's camera is not Camera instance - thus it return null)
  5. \return Camera \p active Camera instance
  6. */
  7. static proto native Camera GetCurrentCamera();
  8. /**
  9. \brief Returns FOV of current camera object
  10. \return float \p FOV of current camera object
  11. */
  12. static proto native float GetCurrentFOV();
  13. /**
  14. \brief Interpolation between camera instances (current camera becomes targetCamera at the end of interpolation)
  15. \param targetCamera \p to which camera we want to interpolate
  16. \param time \p true interpolation time
  17. \param type \p
  18. 0 = without dynamics
  19. 1 = first half - acceleration, second half deceleration
  20. 2 = first third - acceleration, second third - linear movement, last third - deceleration
  21. */
  22. static proto native void InterpolateTo(Camera targetCamera, float time, int type);
  23. /**
  24. Checks if the current interpolation reached it's end
  25. */
  26. static proto native bool IsInterpolationComplete();
  27. /*!
  28. set near plane of camera
  29. \param nearPlane clamped internally to 0.01m
  30. */
  31. proto native void SetNearPlane(float nearPlane);
  32. /*!
  33. get near plane of camera
  34. */
  35. proto native float GetNearPlane();
  36. /**
  37. \brief Sets this camera as active
  38. */
  39. proto native void SetActive(bool active);
  40. /**
  41. \brief Enables the smoothing in interpolation
  42. */
  43. proto native void EnableSmooth(bool enable);
  44. /**
  45. Performs cleanup. Important to call when interpolation run is finished.
  46. */
  47. proto native void StopInterpolation();
  48. /**
  49. \brief Is this camera active?
  50. \return bool \p true if this camera is active
  51. */
  52. proto native bool IsActive();
  53. /**
  54. \brief Field of View settings
  55. \param fov \p FOV angle in radians
  56. */
  57. proto native void SetFOV(float fov);
  58. /**
  59. \brief Depth of Field settings
  60. \param distance \p DOF distance parameter
  61. \param blur \p DOF blur parameter
  62. */
  63. proto native void SetFocus(float distance, float blur);
  64. /**
  65. \brief Orientation change by lookAt point
  66. \param targetPos \p where to look at
  67. */
  68. proto native void LookAt(vector targetPos);
  69. };
  70. //-----------------------------------------------------------------------------
  71. class FreeDebugCamera extends Camera
  72. {
  73. /**
  74. \brief Returns reference to FreeDebugCamera (it's singleton, thus only one instance is present)
  75. \return FreeDebugCamera \p reference to FreeDebugCamera instance
  76. */
  77. static proto native FreeDebugCamera GetInstance();
  78. /**
  79. \brief Sets cameras freeze state
  80. \param freezed \p true = don't allow camera movement
  81. */
  82. proto native void SetFreezed(bool freezed);
  83. /**
  84. \brief Returns if camera is freezed (you can't move it)
  85. \return bool \p true if camera is freezed
  86. */
  87. proto native bool IsFreezed();
  88. /**
  89. \brief Gets object that free camera is currently pointing at
  90. \return Object \p reference to Object that FreeDebugCamera is pointing to
  91. */
  92. proto native Object GetCrosshairObject();
  93. };