Browse Source

Initial HTC Vive framework code

TheOnlyJoey 9 years ago
parent
commit
2fd0eadd3a
4 changed files with 30 additions and 0 deletions
  1. 13 0
      configure.ac
  2. 12 0
      src/Makefile.am
  3. 4 0
      src/openhmd.c
  4. 1 0
      src/openhmdi.h

+ 13 - 0
configure.ac

@@ -40,6 +40,15 @@ AC_ARG_ENABLE([driver-oculus-rift],
 
 AM_CONDITIONAL([BUILD_DRIVER_OCULUS_RIFT], [test "x$driver_oculus_rift_enabled" != "xno"])
 
+# HTC Vive driver
+AC_ARG_ENABLE([driver-htc-vive],
+        [AS_HELP_STRING([--disable-driver-htc-vive],
+                [disable building of HTC Vive driver [default=yes]])],
+        [driver_htc_vive_enabled=$enableval],
+        [driver_htc_vive_enabled='yes'])
+
+AM_CONDITIONAL([BUILD_DRIVER_OCULUS_RIFT], [test "x$driver_oculus_rift_enabled" != "xno"])
+
 # External Driver
 AC_ARG_ENABLE([driver-external],
         [AS_HELP_STRING([--disable-driver-external],
@@ -62,6 +71,10 @@ AM_CONDITIONAL([BUILD_DRIVER_ANDROID], [test "x$driver_android_enabled" != "xno"
 AS_IF([test "x$driver_oculus_rift_enabled" != "xno"],
 	[PKG_CHECK_MODULES([hidapi], [$hidapi] >= 0.0.5)])
 
+# Libs required by HTC Vive Driver
+AS_IF([test "x$driver_htc_vive_enabled" != "xno"],
+	[PKG_CHECK_MODULES([hidapi], [$hidapi] >= 0.0.5)])
+
 # Do we build OpenGL example?
 AC_ARG_ENABLE([openglexample],
         [AS_HELP_STRING([--enable-openglexample],

+ 12 - 0
src/Makefile.am

@@ -25,6 +25,18 @@ libopenhmd_la_LDFLAGS += $(hidapi_LIBS)
 
 endif
 
+if BUILD_DRIVER_HTC_VIVE
+
+libopenhmd_la_SOURCES += \
+	drv_htc_vive/vive.c \
+	drv_htc_vive/packet.c
+
+libopenhmd_la_CPPFLAGS += $(hidapi_CFLAGS) -DDRIVER_HTC_VIVE
+libopenhmd_la_LDFLAGS += $(hidapi_LIBS)
+
+endif
+
+
 if BUILD_DRIVER_EXTERNAL
 
 libopenhmd_la_SOURCES += \

+ 4 - 0
src/openhmd.c

@@ -24,6 +24,10 @@ ohmd_context* OHMD_APIENTRY ohmd_ctx_create(void)
 	ctx->drivers[ctx->num_drivers++] = ohmd_create_oculus_rift_drv(ctx);
 #endif
 
+#if DRIVER_HTC_VIVE
+	ctx->drivers[ctx->num_drivers++] = ohmd_create_htc_vive_drv(ctx);
+#endif
+
 #if DRIVER_EXTERNAL
 	ctx->drivers[ctx->num_drivers++] = ohmd_create_external_drv(ctx);
 #endif

+ 1 - 0
src/openhmdi.h

@@ -108,6 +108,7 @@ void ohmd_calc_default_proj_matrices(ohmd_device_properties* props);
 // drivers
 ohmd_driver* ohmd_create_dummy_drv(ohmd_context* ctx);
 ohmd_driver* ohmd_create_oculus_rift_drv(ohmd_context* ctx);
+ohmd_driver* ohmd_create_htc_vive_drv(ohmd_context* ctx);
 ohmd_driver* ohmd_create_external_drv(ohmd_context* ctx);
 ohmd_driver* ohmd_create_android_drv(ohmd_context* ctx);