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.

78 lines
1.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //-----------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //=============================================================================//
  13. #ifndef GIZMO_H
  14. #define GIZMO_H
  15. #pragma once
  16. #include "MapAtom.h"
  17. #define GIZMO_AXIS_X 0x10
  18. #define GIZMO_AXIS_Y 0x20
  19. #define GIZMO_AXIS_Z 0x40
  20. #define GIZMO_HANDLE_SCALE 0x01
  21. #define GIZMO_HANDLE_ROTATE 0x02
  22. #define GIZMO_HANDLE_TRANSLATE 0x04
  23. #define GIZMO_HANDLE_UNIFORM_SCALE 0x08
  24. class CGizmo : public CMapAtom
  25. {
  26. public:
  27. CGizmo(void);
  28. CGizmo(float x, float y, float z);
  29. void Initialize(void);
  30. void Render(CRender3D *pRender);
  31. inline void SetAxisLength(float fLength);
  32. inline void SetPosition(float x, float y, float z);
  33. void DrawGizmoAxis(CRender3D *pRender, Vector& Origin, Vector& EndPoint, int red, int green, int blue, unsigned int uAxisHandle);
  34. protected:
  35. Vector m_Position;
  36. float m_fAxisLength;
  37. };
  38. //-----------------------------------------------------------------------------
  39. // Purpose: Sets the length of the gizmo's axes.
  40. // Input : fLength - Axis length in world units.
  41. //-----------------------------------------------------------------------------
  42. void CGizmo::SetAxisLength(float fLength)
  43. {
  44. m_fAxisLength = fLength;
  45. }
  46. //-----------------------------------------------------------------------------
  47. // Purpose: Sets the gizmo's position.
  48. // Input : x -
  49. // y -
  50. // z -
  51. //-----------------------------------------------------------------------------
  52. void CGizmo::SetPosition(float x, float y, float z)
  53. {
  54. m_Position[0] = x;
  55. m_Position[1] = y;
  56. m_Position[2] = z;
  57. }
  58. #endif // GIZMO_H