IDisplayDevice.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #ifndef _IDISPLAYDEVICE_H_
  23. #define _IDISPLAYDEVICE_H_
  24. #include "console/consoleTypes.h"
  25. class GameConnection;
  26. class GuiCanvas;
  27. // Defines a custom display device that requires particular rendering settings
  28. // in order for a scene to display correctly.
  29. /// Defines the basic display pose common to most display devices
  30. typedef struct DisplayPose
  31. {
  32. QuatF orientation; /// Direction device is facing
  33. Point3F position; /// Relative position of device in view space
  34. Point3F velocity;
  35. Point3F angularVelocity;
  36. #ifdef DEBUG_DISPLAY_POSE
  37. MatrixF actualMatrix;
  38. MatrixF originalMatrix;
  39. #endif
  40. U32 state; /// Generic state
  41. bool valid; /// Pose set
  42. bool connected; /// Device connected
  43. } IDevicePose;
  44. class IDisplayDevice
  45. {
  46. public:
  47. virtual bool providesFrameEyePose() const = 0;
  48. /// Get a display pose for the specified eye, or the HMD if eyeId is -1.
  49. virtual void getFrameEyePose(IDevicePose *pose, S32 eyeId) const = 0;
  50. virtual bool providesEyeOffsets() const = 0;
  51. /// Returns eye offset not taking into account any position tracking info
  52. virtual void getEyeOffsets(Point3F *dest) const = 0;
  53. virtual bool providesFovPorts() const = 0;
  54. virtual void getFovPorts(FovPort *out) const = 0;
  55. virtual void getStereoViewports(RectI *out) const = 0;
  56. virtual void getStereoTargets(GFXTextureTarget **out) const = 0;
  57. virtual void setDrawCanvas(GuiCanvas *canvas) = 0;
  58. virtual void setDrawMode(GFXDevice::GFXDeviceRenderStyles style) = 0;
  59. virtual void setCurrentConnection(GameConnection *connection) = 0;
  60. virtual GameConnection* getCurrentConnection() = 0;
  61. virtual void onStartFrame() = 0;
  62. /// Returns a texture handle representing a preview of the composited VR view
  63. virtual GFXTexHandle getPreviewTexture() = 0;
  64. };
  65. #endif // _IDISPLAYDEVICE_H_