Skip to content

Instantly share code, notes, and snippets.

@shakesoda
Last active December 17, 2015 20:59
Show Gist options
  • Save shakesoda/5671212 to your computer and use it in GitHub Desktop.
Save shakesoda/5671212 to your computer and use it in GitHub Desktop.
OpenHMD API mockup
/*
* OpenHMD - Free and Open Source API and drivers for immersive technology.
* Copyright (C) 2013 Fredrik Hultin.
* Copyright (C) 2013 Jakob Bornecrantz.
* Distributed under the Boost 1.0 licence, see LICENSE for full text.
*/
#ifndef OPENHMD_H
#define OPENHMD_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _WIN32
#ifdef DLL_EXPORT
#define OHMD_APIENTRY __cdecl __declspec( dllexport )
#else
#ifdef OHMD_STATIC
#define OHMD_APIENTRY __cdecl
#else
#define OHMD_APIENTRY __cdecl __declspec( dllimport )
#endif
#endif
#else
#define OHMD_APIENTRY
#endif
typedef enum {
OHMD_DEVICE_VENDOR = 0x0001,
OHMD_DEVICE_NAME = 0x0002,
OHMD_DEVICE_PATH = 0x0003,
OHMD_EXTENSIONS = 0x0004,
} OHMDstring_token;
typedef enum {
OHMD_DEVICE_COUNT = 0x0005,
OHMD_VERSION_MAJOR = 0x0006,
OHMD_VERSION_MINOR = 0x0007
} OHMDint_token;
typedef enum {
OHMD_ROTATION_EULER = 0x0008,
OHMD_ROTATION_QUAT = 0x0009,
OHMD_POSITION = 0x000a,
OHMD_VELOCITY = 0x000b,
OHMD_CHROMA_PARAMETERS = 0x000c,
OHMD_WARP_PARAMETERS = 0x000d,
} OHMDfloat_token;
typedef OHMDbyte char;
typedef OHMDfloat float;
typedef OHMDuint unsigned int;
typedef OHMDdevice void;
typedef OHMDcontext void;
OHMD_APIENTRY void ohmd_get_integer(OHMDdevice* devices, OHMDint_token token, OHMDuint* out);
OHMD_APIENTRY void ohmd_get_float3(OHMDdevice* devices, OHMDfloat_token, OHMDfloat* out);
OHMD_APIENTRY void ohmd_get_float4(OHMDdevice* devices, OHMDfloat_token token, OHMDfloat* out);
OHMD_APIENTRY void ohmd_get_string(OHMDdevice* devices, OHMDstring_token token, OHMDbyte* out);
OHMD_APIENTRY void ohmd_scan_devices(OHMDcontext* context, OHMDdevice* devices, OHMDuint* count);
OHMD_APIENTRY void ohmd_free_devices(OHMDdevice* devices, OHMDuint count);
OHMD_APIENTRY OHMDcontext* ohmd_create_context();
OHMD_APIENTRY void ohmd_destroy_context(OHMDcontext*);
OHMD_APIENTRY void ohmd_make_context_current(OHMDcontext*);
OHMD_APIENTRY void ohmd_poll_events();
/* example extension stuff */
/* OHMD_EXT_compute_matrices */
typedef enum {
OHMD_LEFT_EYE_MODELVIEW_EXT = 0x1001,
OHMD_RIGHT_EYE_MODELVIEW_EXT = 0x1002,
OHMD_LEFT_EYE_PROJECTION_EXT = 0x1003,
OHMD_RIGHT_EYE_PROJECTION_EXT = 0x1004
} OHMDmatrix_token;
OHMD_APIENTRY void ohmd_get_matrix4f_ext(OHMDdevice*, OHMDmatrix_token, OHMDfloat* out);
#ifdef __cplusplus
}
#endif
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment