diff options
Diffstat (limited to 'make/config/oculusvr')
-rw-r--r-- | make/config/oculusvr/oculusvr-common.cfg | 55 | ||||
-rw-r--r-- | make/config/oculusvr/oculusvr-ovr-CustomJavaCode.java | 33 | ||||
-rw-r--r-- | make/config/oculusvr/oculusvr.c | 5 | ||||
-rw-r--r-- | make/config/oculusvr/oculusvr.cfg | 18 |
4 files changed, 111 insertions, 0 deletions
diff --git a/make/config/oculusvr/oculusvr-common.cfg b/make/config/oculusvr/oculusvr-common.cfg new file mode 100644 index 000000000..24f535d45 --- /dev/null +++ b/make/config/oculusvr/oculusvr-common.cfg @@ -0,0 +1,55 @@ +Package com.jogamp.oculusvr + +# Specify output directories +HierarchicalNativeOutput false +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/oculusvr + +# Raise OVRException instead of RuntimeException in glue code +RuntimeExceptionType OVRException + +# We utilize OvrHmdContext as specified below as a 'typesafe' opaque instance, +# which is typedefed to ovrHmd - hence no type-unsafe opaque 'long' is required. +# typedef struct ovrHmdStruct { +# } OvrHmdContext; +#Opaque long ovrHmd + +# Mappings for data types +Opaque boolean ovrBool + +# Not implemented in SDK !? +Ignore ovrHmd_ProcessLatencyTest + +# Not native sized: CType['uintptr_t *', size [fixed false, lnx64 64], [array*1]] +Ignore ovrRenderAPIConfig.PlatformData +# Not native sized: CType['uintptr_t *', size [fixed false, lnx64 64], [array*1]] +Ignore ovrTexture.PlatformData + +# These routines use or return strings +ReturnsString ovrHmd_GetLastError +ReturnsString ovrHmd_GetLatencyTestResult +ReturnsString ovrHmd_GetString + +ReturnsString ovrHmdDesc.ProductName +ReturnsString ovrHmdDesc.Manufacturer +ReturnsString ovrHmdDesc.DisplayDeviceName +ReturnsString ovrSensorDesc.SerialNumber + +ReturnedArrayLength ovrHmdDesc.Handle 1 +ReturnedArrayLength ovrDistortionMesh.pVertexData getVertexCount() +ReturnedArrayLength ovrDistortionMesh.pIndexData getIndexCount() + +ReturnValueCapacity ovrHmd_Create sizeof(ovrHmd) +ReturnValueCapacity ovrHmd_CreateDebug sizeof(ovrHmd) + +JavaPrologue ovr_Initialize if( !isAvailable() ) { return false; } +JavaPrologue ovrHmd_Create if( !isAvailable() ) { return null; } +JavaPrologue ovrHmd_CreateDebug if( !isAvailable() ) { return null; } + +ArgumentIsString ovrHmd_GetFloat 1 +ArgumentIsString ovrHmd_SetFloat 1 +ArgumentIsString ovrHmd_GetFloatArray 1 +ArgumentIsString ovrHmd_SetFloatArray 1 +ArgumentIsString ovrHmd_GetArraySize 1 + + diff --git a/make/config/oculusvr/oculusvr-ovr-CustomJavaCode.java b/make/config/oculusvr/oculusvr-ovr-CustomJavaCode.java new file mode 100644 index 000000000..281610a20 --- /dev/null +++ b/make/config/oculusvr/oculusvr-ovr-CustomJavaCode.java @@ -0,0 +1,33 @@ + + static final DynamicLibraryBundle dynamicLookupHelper; + + static { + dynamicLookupHelper = AccessController.doPrivileged(new PrivilegedAction<DynamicLibraryBundle>() { + public DynamicLibraryBundle run() { + final DynamicLibraryBundle bundle = new DynamicLibraryBundle(new OVRDynamicLibraryBundleInfo()); + if(null==bundle) { + throw new RuntimeException("Null DynamicLibraryBundle"); + } + /** No native tool library to load + if(!bundle.isToolLibLoaded()) { + System.err.println("Couln't load native OVR/JNI glue library"); + return null; + } */ + if(!bundle.isLibComplete()) { + System.err.println("Couln't load native OVR/JNI glue library"); + return null; + } + if( !initializeImpl() ) { + System.err.println("Native initialization failure of OVR/JNI glue library"); + return null; + } + return bundle; + } } ); + } + + /** + * Accessor. + * @returns true if OVR library is available on this machine. + */ + public static boolean isAvailable() { return dynamicLookupHelper != null; } + diff --git a/make/config/oculusvr/oculusvr.c b/make/config/oculusvr/oculusvr.c new file mode 100644 index 000000000..7486ce35d --- /dev/null +++ b/make/config/oculusvr/oculusvr.c @@ -0,0 +1,5 @@ + +typedef struct ovrHmdStruct { +} OvrHmdContext; + +#include "OVR_CAPI.h" diff --git a/make/config/oculusvr/oculusvr.cfg b/make/config/oculusvr/oculusvr.cfg new file mode 100644 index 000000000..11e1ee78b --- /dev/null +++ b/make/config/oculusvr/oculusvr.cfg @@ -0,0 +1,18 @@ +# This .cfg file is used to generate the JOAL interface. +Include oculusvr-common.cfg + +Style AllStatic +JavaClass OVR + +Import com.jogamp.oculusvr.* +Import java.security.AccessController +Import java.security.PrivilegedAction + +IncludeAs CustomJavaCode OVR oculusvr-ovr-CustomJavaCode.java +ManualStaticInitCall OVR + +# Provide #includes to native code +CustomCCode typedef struct ovrHmdStruct { +CustomCCode } OvrHmdContext; +CustomCCode #include <OVR_CAPI.h> + |