OSVR-Core
Display.h
Go to the documentation of this file.
1 
11 // Copyright 2015 Sensics, Inc.
12 //
13 // Licensed under the Apache License, Version 2.0 (the "License");
14 // you may not use this file except in compliance with the License.
15 // You may obtain a copy of the License at
16 //
17 // http://www.apache.org/licenses/LICENSE-2.0
18 //
19 // Unless required by applicable law or agreed to in writing, software
20 // distributed under the License is distributed on an "AS IS" BASIS,
21 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 // See the License for the specific language governing permissions and
23 // limitations under the License.
24 
25 #ifndef INCLUDED_Display_h_GUID_E15D0209_6784_4CBF_4F89_788E7A4B440C
26 #define INCLUDED_Display_h_GUID_E15D0209_6784_4CBF_4F89_788E7A4B440C
27 
28 // Internal Includes
30 #include <osvr/ClientKit/CppAPI.h>
31 #include <osvr/ClientKit/Context.h>
32 #include <osvr/Util/SharedPtr.h>
33 
34 // Library/third-party includes
35 // - none
36 
37 // Standard includes
38 // - none
39 
42 inline OSVR_ReturnCode osvrClientGetNumViewers(OSVR_DisplayConfig disp,
43  OSVR_ViewerCount &viewers) {
44  return osvrClientGetNumViewers(disp, &viewers);
45 }
46 
47 inline OSVR_ReturnCode osvrClientGetNumEyesForViewer(OSVR_DisplayConfig disp,
48  OSVR_ViewerCount viewer,
49  OSVR_EyeCount &eyes) {
50  return osvrClientGetNumEyesForViewer(disp, viewer, &eyes);
51 }
52 
53 inline OSVR_ReturnCode
54 osvrClientGetNumSurfacesForViewerEye(OSVR_DisplayConfig disp,
55  OSVR_ViewerCount viewer, OSVR_EyeCount eye,
56  OSVR_SurfaceCount &surfaces) {
57  return osvrClientGetNumSurfacesForViewerEye(disp, viewer, eye, &surfaces);
58 }
59 
60 inline OSVR_ReturnCode osvrClientGetRelativeViewportForViewerEyeSurface(
64  OSVR_ViewportDimension &height) {
65  return osvrClientGetRelativeViewportForViewerEyeSurface(
66  disp, viewer, eye, surface, &left, &bottom, &width, &height);
67 }
68 
71 
72 namespace osvr {
73 namespace clientkit {
77 #ifndef OSVR_CLIENTKIT_CUSTOM_DISPLAY_ERROR_HANDLER
78  static inline void handleDisplayError(const char msg[]) {
79  throw std::runtime_error(msg);
80  }
81 #endif
82 
85  typedef shared_ptr<OSVR_DisplayConfigObject> UnderlyingDisplayConfigPtr;
86 
89  inline UnderlyingDisplayConfigPtr getDisplay(ClientContext &ctx) {
90  OSVR_DisplayConfig cfg = NULL;
91  osvrClientGetDisplay(ctx.get(), &cfg);
92  UnderlyingDisplayConfigPtr ret(cfg, &::osvrClientFreeDisplay);
93  return ret;
94  }
95 
100  OSVR_ViewportDimension height;
101  };
102 
104  double left;
105  double right;
106  double top;
107  double bottom;
108  };
109 
111  OSVR_DisplayDimension width;
112  OSVR_DisplayDimension height;
113  };
114 
117  class Surface {
118  public:
120  OSVR_EyeCount eye, OSVR_SurfaceCount surface)
121  : m_disp(disp), m_viewer(viewer), m_eye(eye), m_surface(surface) {}
122 
128  RelativeViewport viewport;
129  OSVR_ReturnCode ret =
130  osvrClientGetRelativeViewportForViewerEyeSurface(
131  m_disp, m_viewer, m_eye, m_surface, viewport.left,
132  viewport.bottom, viewport.width, viewport.height);
133  if (OSVR_RETURN_SUCCESS != ret) {
134  handleDisplayError(
135  "Could not access relative viewport for surface!");
136  }
137  return viewport;
138  }
139 
143  void getProjectionMatrix(double near, double far,
145  double matrix[OSVR_MATRIX_SIZE]) const {
146  OSVR_ReturnCode ret =
148  m_disp, m_viewer, m_eye, m_surface, near, far, flags,
149  matrix);
150  if (OSVR_RETURN_SUCCESS != ret) {
151  handleDisplayError(
152  "Could not access projection matrix for surface!");
153  }
154  }
155 
157  void getProjectionMatrix(float near, float far,
159  float matrix[OSVR_MATRIX_SIZE]) const {
160  OSVR_ReturnCode ret =
162  m_disp, m_viewer, m_eye, m_surface, near, far, flags,
163  matrix);
164  if (OSVR_RETURN_SUCCESS != ret) {
165  handleDisplayError(
166  "Could not access projection matrix for surface!");
167  }
168  }
169 
174  ProjectionClippingPlanes clippingPlanes;
175  OSVR_ReturnCode ret =
177  m_disp, m_viewer, m_eye, m_surface, &clippingPlanes.left,
178  &clippingPlanes.right, &clippingPlanes.bottom, &clippingPlanes.top);
179  if (OSVR_RETURN_SUCCESS != ret) {
180  handleDisplayError(
181  "Could not access projection clipping planes for surface!");
182  }
183  return clippingPlanes;
184  }
185 
190  bool isDistortionRequested() const {
191  OSVR_CBool distort;
192  OSVR_ReturnCode ret = osvrClientDoesViewerEyeSurfaceWantDistortion(
193  m_disp, m_viewer, m_eye, m_surface, &distort);
194  if (OSVR_RETURN_SUCCESS != ret) {
195  handleDisplayError(
196  "Could not get distortion request for surface!");
197  }
198  return (distort == OSVR_TRUE);
199  }
200 
210  OSVR_ReturnCode ret =
212  m_disp, m_viewer, m_eye, m_surface, &prio);
213 
214  return prio;
215  }
216 
224  OSVR_ReturnCode ret = osvrClientGetViewerEyeSurfaceRadialDistortion(
225  m_disp, m_viewer, m_eye, m_surface, &params);
226  if (OSVR_RETURN_SUCCESS != ret) {
227  handleDisplayError(
228  "Could not get radial distortion params for surface!");
229  }
230  return params;
231  }
234  OSVR_DisplayConfig getDisplayConfig() const { return m_disp; }
235  OSVR_ViewerCount getViewerID() const { return m_viewer; }
236  OSVR_EyeCount getEyeID() const { return m_eye; }
237  OSVR_SurfaceCount getSurfaceID() const { return m_surface; }
239  private:
240  OSVR_DisplayConfig m_disp;
241  OSVR_ViewerCount m_viewer;
242  OSVR_EyeCount m_eye;
243  OSVR_SurfaceCount m_surface;
244  };
245 
248  class Eye {
249  public:
251  : m_disp(disp), m_viewer(viewer), m_eye(eye) {
252  if (!m_disp) {
253  handleDisplayError("Can't interact with an eye using a "
254  "null/invalid display config");
255  }
256  }
257 
260  OSVR_SurfaceCount getNumSurfaces() const {
261  OSVR_SurfaceCount surfaces;
262  OSVR_ReturnCode ret = osvrClientGetNumSurfacesForViewerEye(
263  m_disp, m_viewer, m_eye, &surfaces);
264  if (ret != OSVR_RETURN_SUCCESS) {
265  handleDisplayError("Couldn't get number of surfaces in this "
266  "display for the given viewer and eye!");
267  }
268  return surfaces;
269  }
270 
271  Surface getSurface(OSVR_SurfaceCount surface) const {
272  return Surface(m_disp, m_viewer, m_eye, surface);
273  }
275 
280  bool getPose(OSVR_Pose3 &pose) {
281  OSVR_ReturnCode ret =
282  osvrClientGetViewerEyePose(m_disp, m_viewer, m_eye, &pose);
283  return (ret == OSVR_RETURN_SUCCESS);
284  }
285 
291  double mat[OSVR_MATRIX_SIZE]) {
292  OSVR_ReturnCode ret = osvrClientGetViewerEyeViewMatrixd(
293  m_disp, m_viewer, m_eye, flags, mat);
294  return (ret == OSVR_RETURN_SUCCESS);
295  }
296 
299  float mat[OSVR_MATRIX_SIZE]) {
300  OSVR_ReturnCode ret = osvrClientGetViewerEyeViewMatrixf(
301  m_disp, m_viewer, m_eye, flags, mat);
302  return (ret == OSVR_RETURN_SUCCESS);
303  }
304 
307  template <typename F>
311  OSVR_SurfaceCount surfaces = getNumSurfaces();
312  for (OSVR_SurfaceCount surface = 0; surface < surfaces; ++surface) {
313  functor(getSurface(surface));
314  }
315  }
317 
320  OSVR_DisplayConfig getDisplayConfig() const { return m_disp; }
321  OSVR_ViewerCount getViewerID() const { return m_viewer; }
322  OSVR_EyeCount getEyeID() const { return m_eye; }
324  private:
325  OSVR_DisplayConfig m_disp;
326  OSVR_ViewerCount m_viewer;
327  OSVR_EyeCount m_eye;
328  };
329 
332  class Viewer {
333  public:
335  : m_disp(disp), m_viewer(viewer) {
336  if (!m_disp) {
337  handleDisplayError("Can't interact with a viewer using a "
338  "null/invalid display config");
339  }
340  }
341 
344  OSVR_EyeCount getNumEyes() const {
345  OSVR_EyeCount eyes;
346  OSVR_ReturnCode ret =
347  osvrClientGetNumEyesForViewer(m_disp, m_viewer, &eyes);
348  if (ret != OSVR_RETURN_SUCCESS) {
349  handleDisplayError("Couldn't get number of eyes in this "
350  "display for the given viewer!");
351  }
352  return eyes;
353  }
354 
355  Eye getEye(OSVR_EyeCount eye) const {
356  return Eye(m_disp, m_viewer, eye);
357  }
358  Surface getSurface(OSVR_EyeCount eye, OSVR_SurfaceCount surface) const {
359  return Surface(m_disp, m_viewer, eye, surface);
360  }
362 
372  bool getPose(OSVR_Pose3 &pose) {
373  OSVR_ReturnCode ret =
374  osvrClientGetViewerPose(m_disp, m_viewer, &pose);
375  return (ret == OSVR_RETURN_SUCCESS);
376  }
377 
380  template <typename F>
383  OSVR_EyeCount eyes = getNumEyes();
384  for (OSVR_EyeCount eye = 0; eye < eyes; ++eye) {
385  functor(getEye(eye));
386  }
387  }
388  template <typename F> void forEachSurface(F functor) {
390  OSVR_EyeCount eyes = getNumEyes();
391  for (OSVR_EyeCount eye = 0; eye < eyes; ++eye) {
392  getEye(eye).forEachSurface(functor);
393  }
394  }
396 
399  OSVR_DisplayConfig getDisplayConfig() const { return m_disp; }
400  OSVR_ViewerCount getViewerID() const { return m_viewer; }
402  private:
403  OSVR_DisplayConfig m_disp;
404  OSVR_ViewerCount m_viewer;
405  };
406 
410  public:
413  DisplayConfig() : m_disp(NULL) {}
414 
418  : m_disp(NULL), m_owningDisp(osvr::clientkit::getDisplay(ctx)) {
419  if (m_owningDisp) {
420  m_disp = m_owningDisp.get();
421  }
422  }
423 
426  explicit DisplayConfig(UnderlyingDisplayConfigPtr const &ptr)
427  : m_disp(NULL), m_owningDisp(ptr) {
428  if (m_owningDisp) {
429  m_disp = m_owningDisp.get();
430  }
431  }
432 
435  explicit DisplayConfig(OSVR_DisplayConfig disp) : m_disp(disp) {}
436 
438  bool valid() const { return m_disp != NULL; }
439 
440  DisplayConfig &ensureValid() {
441  if (!valid()) {
442  handleDisplayError(
443  "Can't operate on an invalid DisplayConfig!");
444  }
445  return *this;
446  }
447  DisplayConfig const &ensureValid() const {
448  if (!valid()) {
449  handleDisplayError(
450  "Can't operate on an invalid DisplayConfig!");
451  }
452  return *this;
453  }
454 
458  bool checkStartup() const {
459  ensureValid();
461  }
462 
467  ensureValid();
468  OSVR_DisplayInputCount inputs;
469  OSVR_ReturnCode ret = osvrClientGetNumDisplayInputs(m_disp, &inputs);
470  if (ret != OSVR_RETURN_SUCCESS) {
471  handleDisplayError("Couldn't get number of display inputs!");
472  }
473  return inputs;
474  }
475 
480  ensureValid();
481  DisplayDimensions dimensions;
482  OSVR_ReturnCode ret = osvrClientGetDisplayDimensions(m_disp, displayInputIndex, &dimensions.width, &dimensions.height);
483  if (ret != OSVR_RETURN_SUCCESS) {
484  handleDisplayError("Couldn't get dimensions of this "
485  "display!");
486  }
487  return dimensions;
488  }
489 
492  OSVR_ViewerCount getNumViewers() const {
493  ensureValid();
494  OSVR_ViewerCount viewers;
495  OSVR_ReturnCode ret = osvrClientGetNumViewers(m_disp, &viewers);
496  if (ret != OSVR_RETURN_SUCCESS) {
497  handleDisplayError("Couldn't get number of viewers in this "
498  "display!");
499  }
500  return viewers;
501  }
502 
503  Viewer getViewer(OSVR_ViewerCount viewer) const {
504  ensureValid();
505  return Viewer(m_disp, viewer);
506  }
507 
508  Eye getEye(OSVR_ViewerCount viewer, OSVR_EyeCount eye) const {
509  ensureValid();
510  return Eye(m_disp, viewer, eye);
511  }
512 
513  Surface getSurface(OSVR_ViewerCount viewer, OSVR_EyeCount eye,
514  OSVR_SurfaceCount surface) const {
515  ensureValid();
516  return Surface(m_disp, viewer, eye, surface);
517  }
518 
520 
523  template <typename F>
526  OSVR_ViewerCount viewers = getNumViewers();
527  for (OSVR_ViewerCount viewer = 0; viewer < viewers; ++viewer) {
528  functor(getViewer(viewer));
529  }
530  }
531 
532  template <typename F>
535  OSVR_ViewerCount viewers = getNumViewers();
536  for (OSVR_ViewerCount viewer = 0; viewer < viewers; ++viewer) {
537  getViewer(viewer).forEachEye(functor);
538  };
539  }
540 
541  template <typename F>
544  OSVR_ViewerCount viewers = getNumViewers();
545  for (OSVR_ViewerCount viewer = 0; viewer < viewers; ++viewer) {
546  getViewer(viewer).forEachSurface(functor);
547  };
548  }
549 
551 
554 
556  OSVR_DisplayConfig getDisplayConfig() const { return m_disp; }
557 
560  UnderlyingDisplayConfigPtr getOwningPtr() const { return m_owningDisp; }
561 
563  private:
564  OSVR_DisplayConfig m_disp;
565  UnderlyingDisplayConfigPtr m_owningDisp;
566  };
567 
570  inline bool operator==(Surface const &lhs, Surface const &rhs) {
571  return (lhs.getSurfaceID() == rhs.getSurfaceID()) &&
572  (lhs.getEyeID() == rhs.getEyeID()) &&
573  (lhs.getViewerID() == rhs.getViewerID()) &&
574  (lhs.getDisplayConfig() == rhs.getDisplayConfig());
575  }
576 
579  inline bool operator!=(Surface const &lhs, Surface const &rhs) {
580  return (lhs.getSurfaceID() != rhs.getSurfaceID()) ||
581  (lhs.getEyeID() != rhs.getEyeID()) ||
582  (lhs.getViewerID() != rhs.getViewerID()) ||
583  (lhs.getDisplayConfig() != rhs.getDisplayConfig());
584  }
585 
588  inline bool operator==(Eye const &lhs, Eye const &rhs) {
589  return (lhs.getEyeID() == rhs.getEyeID()) &&
590  (lhs.getViewerID() == rhs.getViewerID()) &&
591  (lhs.getDisplayConfig() == rhs.getDisplayConfig());
592  }
593 
596  inline bool operator!=(Eye const &lhs, Eye const &rhs) {
597  return (lhs.getEyeID() != rhs.getEyeID()) ||
598  (lhs.getViewerID() != rhs.getViewerID()) ||
599  (lhs.getDisplayConfig() != rhs.getDisplayConfig());
600  }
601 
604  inline bool operator==(Viewer const &lhs, Viewer const &rhs) {
605  return (lhs.getViewerID() == rhs.getViewerID()) &&
606  (lhs.getDisplayConfig() == rhs.getDisplayConfig());
607  }
608 
611  inline bool operator!=(Viewer const &lhs, Viewer const &rhs) {
612  return (lhs.getViewerID() != rhs.getViewerID()) ||
613  (lhs.getDisplayConfig() != rhs.getDisplayConfig());
614  }
615 
619  inline bool operator==(DisplayConfig const &lhs, DisplayConfig const &rhs) {
620  return lhs.getDisplayConfig() == rhs.getDisplayConfig();
621  }
622 
625  inline bool operator==(DisplayConfig const &lhs, OSVR_DisplayConfig rhs) {
626  return lhs.getDisplayConfig() == rhs;
627  }
628 
631  inline bool operator==(OSVR_DisplayConfig lhs, DisplayConfig const &rhs) {
632  return lhs == rhs.getDisplayConfig();
633  }
634 
638  inline bool operator!=(DisplayConfig const &lhs, DisplayConfig const &rhs) {
639  return lhs.getDisplayConfig() != rhs.getDisplayConfig();
640  }
641 
644  inline bool operator!=(DisplayConfig const &lhs, OSVR_DisplayConfig rhs) {
645  return lhs.getDisplayConfig() != rhs;
646  }
647 
650  inline bool operator!=(OSVR_DisplayConfig lhs, DisplayConfig const &rhs) {
651  return lhs != rhs.getDisplayConfig();
652  }
653 
655  // end of group
656 
657 } // namespace clientkit
658 } // namespace osvr
659 #endif // INCLUDED_Display_h_GUID_E15D0209_6784_4CBF_4F89_788E7A4B440C
bool operator!=(Surface const &lhs, Surface const &rhs)
Inequality operator for clientkit::Surface.
Definition: Display.h:579
uint8_t OSVR_CBool
A pre-C99-safe bool type.
Definition: BoolC.h:50
void forEachSurface(F OSVR_CLIENTKIT_FUNCTOR_REF functor)
Definition: Display.h:308
Parameters for a per-color-component radial distortion shader.
Definition: RadialDistortionParametersC.h:51
bool operator==(Surface const &lhs, Surface const &rhs)
Equality operator for clientkit::Surface.
Definition: Display.h:570
Constant for the number of elements in the matrices we use - 4x4.
Definition: MatrixConventionsC.h:127
Client context object: Create and keep one in your application.
Definition: Context_decl.h:57
void forEachSurface(F OSVR_CLIENTKIT_FUNCTOR_REF functor)
Definition: Display.h:542
bool getViewMatrix(OSVR_MatrixConventions flags, float mat[OSVR_MATRIX_SIZE])
Definition: Display.h:298
uint32_t OSVR_SurfaceCount
The integer type specifying the number of surfaces seen by a viewer&#39;s eye.
Definition: RenderingTypesC.h:108
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientGetViewerEyeSurfaceProjectionMatrixd(OSVR_DisplayConfig disp, OSVR_ViewerCount viewer, OSVR_EyeCount eye, OSVR_SurfaceCount surface, double near, double far, OSVR_MatrixConventions flags, double *matrix)
Get the projection matrix for a surface seen by an eye of a viewer in a display config.
Definition: DisplayC.cpp:350
DisplayConfig()
Empty constructor - constructs a config where valid() is false.
Definition: Display.h:413
DisplayConfig(ClientContext &ctx)
Retrieve a display config, owning it and managing its lifetime.
Definition: Display.h:417
void getProjectionMatrix(double near, double far, OSVR_MatrixConventions flags, double matrix[OSVR_MATRIX_SIZE]) const
Gets the projection matrix.
Definition: Display.h:143
bool checkStartup() const
Checks if the display is fully configured and ready, including first pose.
Definition: Display.h:458
bool getPose(OSVR_Pose3 &pose)
Attempt to get the eye pose.
Definition: Display.h:280
Definition: DisplayC.cpp:43
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
#define OSVR_CLIENTKIT_FUNCTOR_REF
Define if your compiler supports && in a type-deduced context.
Definition: CppAPI.h:50
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientCheckDisplayStartup(OSVR_DisplayConfig disp)
Checks to see if a display is fully configured and ready, including having received its first pose up...
Definition: DisplayC.cpp:137
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientGetDisplay(OSVR_ClientContext ctx, OSVR_DisplayConfig *disp)
Allocates a display configuration object populated with data from the OSVR system.
Definition: DisplayC.cpp:65
int32_t OSVR_DistortionPriority
The integer type used to indicate relative priorities of a display distortion strategy.
Definition: RenderingTypesC.h:121
DisplayConfig(OSVR_DisplayConfig disp)
Construct from a (presumably-externally-managed) raw display config, not affecting lifetime...
Definition: Display.h:435
void forEachSurface(F functor)
Definition: Display.h:388
Header.
UnderlyingDisplayConfigPtr getOwningPtr() const
Gets a copy of the owning pointer, if we hold shared ownership over this DisplayConfig.
Definition: Display.h:560
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientGetNumDisplayInputs(OSVR_DisplayConfig disp, OSVR_DisplayInputCount *numDisplayInputs)
A display config can have one or more display inputs to pass pixels over (HDMI/DVI connections...
Definition: DisplayC.cpp:144
Wrapper for a viewer, eye, and surface bound to a display config.
Definition: Display.h:117
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientGetViewerEyeSurfaceProjectionClippingPlanes(OSVR_DisplayConfig disp, OSVR_ViewerCount viewer, OSVR_EyeCount eye, OSVR_SurfaceCount surface, double *left, double *right, double *bottom, double *top)
Get the clipping planes (positions at unit distance) for a surface seen by an eye of a viewer in a di...
Definition: DisplayC.cpp:366
bool isDistortionRequested() const
Determines if the description of the surface requests any distortion to be performed.
Definition: Display.h:190
void getProjectionMatrix(float near, float far, OSVR_MatrixConventions flags, float matrix[OSVR_MATRIX_SIZE]) const
Definition: Display.h:157
Header.
bool getViewMatrix(OSVR_MatrixConventions flags, double mat[OSVR_MATRIX_SIZE])
Attempt to get the view matrix.
Definition: Display.h:290
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientGetViewerEyeViewMatrixf(OSVR_DisplayConfig disp, OSVR_ViewerCount viewer, OSVR_EyeCount eye, OSVR_MatrixConventions flags, float *mat)
Get the view matrix (inverse of pose) for the given eye of a viewer in a display config - matrix of f...
Definition: DisplayC.cpp:262
#define OSVR_TRUE
Canonical "true" value for OSVR_CBool.
Definition: BoolC.h:52
bool operator==(DisplayConfig const &lhs, DisplayConfig const &rhs)
Equality operator for clientkit::DisplayConfig - does not consider the ownership status in the compar...
Definition: Display.h:619
Header to bring shared_ptr into the osvr namespace.
DisplayConfig(UnderlyingDisplayConfigPtr const &ptr)
Construct from a shared pointer to the underlying display config, taking shared ownership.
Definition: Display.h:426
bool getPose(OSVR_Pose3 &pose)
Attempt to get the viewer pose.
Definition: Display.h:372
bool operator==(DisplayConfig const &lhs, OSVR_DisplayConfig rhs)
Equality operator for clientkit::DisplayConfig.
Definition: Display.h:625
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientGetDisplayDimensions(OSVR_DisplayConfig disp, OSVR_DisplayInputCount displayInputIndex, OSVR_DisplayDimension *width, OSVR_DisplayDimension *height)
Retrieve the pixel dimensions of a given display input for a display config.
Definition: DisplayC.cpp:153
void forEachEye(F OSVR_CLIENTKIT_FUNCTOR_REF functor)
Definition: Display.h:533
uint16_t OSVR_MatrixConventions
Type for passing matrix convention flags.
Definition: MatrixConventionsC.h:54
bool operator==(Viewer const &lhs, Viewer const &rhs)
Equality operator for clientkit::Viewer.
Definition: Display.h:604
OSVR_DisplayInputCount getNumDisplayInputs() const
Returns number of inputs for this display.
Definition: Display.h:466
bool operator==(Eye const &lhs, Eye const &rhs)
Equality operator for clientkit::Eye.
Definition: Display.h:588
Definition: Display.h:110
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientDoesViewerEyeSurfaceWantDistortion(OSVR_DisplayConfig disp, OSVR_ViewerCount viewer, OSVR_EyeCount eye, OSVR_SurfaceCount surface, OSVR_CBool *distortionRequested)
Determines if a surface seen by an eye of a viewer in a display config requests some distortion to be...
Definition: DisplayC.cpp:385
Wrapper for a viewer and eye bound to a display config.
Definition: Display.h:248
bool operator!=(DisplayConfig const &lhs, DisplayConfig const &rhs)
Inequality operator for clientkit::DisplayConfig - does not consider the ownership status in the comp...
Definition: Display.h:638
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientGetViewerEyeSurfaceRadialDistortion(OSVR_DisplayConfig disp, OSVR_ViewerCount viewer, OSVR_EyeCount eye, OSVR_SurfaceCount surface, OSVR_RadialDistortionParameters *params)
Returns the radial distortion parameters, if known/requested, for a surface seen by an eye of a viewe...
Definition: DisplayC.cpp:413
#define OSVR_RETURN_SUCCESS
The "success" value for an OSVR_ReturnCode.
Definition: ReturnCodesC.h:45
uint32_t OSVR_ViewerCount
The integer type specifying a number of viewers in a system.
Definition: RenderingTypesC.h:72
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientGetViewerEyeSurfaceProjectionMatrixf(OSVR_DisplayConfig disp, OSVR_ViewerCount viewer, OSVR_EyeCount eye, OSVR_SurfaceCount surface, float near, float far, OSVR_MatrixConventions flags, float *matrix)
Get the projection matrix for a surface seen by an eye of a viewer in a display config.
Definition: DisplayC.cpp:358
OSVR_ClientContext get()
Gets the bare OSVR_ClientContext.
Definition: Context.h:114
bool operator!=(DisplayConfig const &lhs, OSVR_DisplayConfig rhs)
Inequality operator for clientkit::DisplayConfig.
Definition: Display.h:644
bool valid() const
Checks the validity of the contained pointer.
Definition: Display.h:438
OSVR_RadialDistortionParameters getRadialDistortion()
Get the radial distortion parameters.
Definition: Display.h:222
OSVR_DistortionPriority getRadialDistortionPriority()
Get the priority/availability of radial distortion parameters for this surface.
Definition: Display.h:208
bool operator!=(Eye const &lhs, Eye const &rhs)
Inequality operator for clientkit::Eye.
Definition: Display.h:596
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientFreeDisplay(OSVR_DisplayConfig disp)
Frees a display configuration object.
Definition: DisplayC.cpp:124
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientGetViewerEyePose(OSVR_DisplayConfig disp, OSVR_ViewerCount viewer, OSVR_EyeCount eye, OSVR_Pose3 *pose)
Get the "viewpoint" for the given eye of a viewer in a display config.
Definition: DisplayC.cpp:204
uint8_t OSVR_EyeCount
The integer type specifying the number of eyes (viewpoints) of a viewer.
Definition: RenderingTypesC.h:92
uint8_t OSVR_DisplayInputCount
A count or index for a display input in a display config.
Definition: RenderingTypesC.h:51
osvr::clientkit::DisplayDimensions getDisplayDimensions(OSVR_DisplayInputCount displayInputIndex) const
Returns display dimensions for a display input.
Definition: Display.h:479
Definition: Display.h:96
bool operator==(OSVR_DisplayConfig lhs, DisplayConfig const &rhs)
Equality operator for clientkit::DisplayConfig.
Definition: Display.h:631
A structure defining a 3D (6DOF) rigid body pose: translation and rotation.
Definition: Pose3C.h:54
Class wrapping OSVR_DisplayConfig objects, optionally managing shared ownership.
Definition: Display.h:409
bool operator!=(OSVR_DisplayConfig lhs, DisplayConfig const &rhs)
Inequality operator for clientkit::DisplayConfig.
Definition: Display.h:650
ProjectionClippingPlanes getProjectionClippingPlanes() const
Gets the clipping planes.
Definition: Display.h:173
int32_t OSVR_ViewportDimension
The integer type used in specification of size or location of a viewport.
Definition: RenderingTypesC.h:113
RelativeViewport getRelativeViewport() const
Gets the video-input-relative viewport corresponding to this surface.
Definition: Display.h:127
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientGetViewerEyeViewMatrixd(OSVR_DisplayConfig disp, OSVR_ViewerCount viewer, OSVR_EyeCount eye, OSVR_MatrixConventions flags, double *mat)
Get the view matrix (inverse of pose) for the given eye of a viewer in a display config - matrix of d...
Definition: DisplayC.cpp:256
void forEachViewer(F OSVR_CLIENTKIT_FUNCTOR_REF functor)
Definition: Display.h:524
OSVR_DisplayConfig getDisplayConfig() const
Gets the raw OSVR_DisplayConfig.
Definition: Display.h:556
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientGetViewerPose(OSVR_DisplayConfig disp, OSVR_ViewerCount viewer, OSVR_Pose3 *pose)
Get the pose of a viewer in a display config.
Definition: DisplayC.cpp:174
UnderlyingDisplayConfigPtr getDisplay(ClientContext &ctx)
Get a shared_ptr to a DisplayConfig (with appropriate deleter pre-loaded)
Definition: Display.h:89
bool operator!=(Viewer const &lhs, Viewer const &rhs)
Inequality operator for clientkit::Viewer.
Definition: Display.h:611
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientGetViewerEyeSurfaceRadialDistortionPriority(OSVR_DisplayConfig disp, OSVR_ViewerCount viewer, OSVR_EyeCount eye, OSVR_SurfaceCount surface, OSVR_DistortionPriority *priority)
Returns the priority/availability of radial distortion parameters for a surface seen by an eye of a v...
Definition: DisplayC.cpp:400
Wrapper for a viewer bound to a display config.
Definition: Display.h:332
void forEachEye(F OSVR_CLIENTKIT_FUNCTOR_REF functor)
Definition: Display.h:381
int32_t OSVR_DisplayDimension
The integer type used in specification of size or location of a display input, in pixels...
Definition: RenderingTypesC.h:56
Header configuring some general properties of the header-only C++ API provided by ClientKit...