Skip to content

Instantly share code, notes, and snippets.

View demonixis's full-sized avatar

Yannick Comte demonixis

View GitHub Profile
@demonixis
demonixis / OsvrGetDistortion.cs
Created April 1, 2017 06:31
A function to get the distortion parameters for an OSVR Application.
public Vector3[] GetDistortionParams()
{
var displayConfig = _context.GetDisplayConfig();
var numViewers = displayConfig.GetNumViewers();
var distortionParams = new Vector3[2];
if (numViewers != 1)
return -1;
for (uint viewer = 0; viewer < numViewers; viewer++)
@demonixis
demonixis / OsvrDistortion.cs
Last active January 3, 2018 20:16
A distortion correction effect for Unity.
using UnityEngine;
namespace OSVR.Unity
{
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
public sealed class OsvrDistortion : MonoBehaviour
{
private bool isSupported = true;
private Material distortionMaterial = null;
@demonixis
demonixis / PlayVideoUnity56beta.cs
Created February 7, 2017 14:20
Playing a video with the new VideoPlayer component with Unity 5.6 beta.
public class VideoManager : MonoBehaviour
{
[SerializeField]
private RenderTexture _renderTexture = null;
[SerializeField]
private VideoClip _videoClip = null;
private IEnumerator Start()
{
Application.runInBackground = true;
@demonixis
demonixis / OculusTouchVirtualDevice.cs
Created December 26, 2016 17:41
An input device for InControl for the Oculus Touch Controllers
using InControl;
using UnityEngine;
namespace Demonixis.Toolbox
{
public class OculusTouchVirtualDevice : InputDevice
{
private Vector2 _leftTouch = Vector2.zero;
private Vector2 _rightTouch = Vector2.zero;
@demonixis
demonixis / read_pvr_rotation.cpp
Created December 21, 2016 14:48
A simple C++ program that reads the rotation of the Pimax 4k HMD
#include <PVR_API.h>
#include <iostream>
int main(int argc, char** argv)
{
pvrResult result = pvr_initialise();
if (result == pvr_success)
{
std::cout << "PVR SDK Initialized!" << std::endl;
@demonixis
demonixis / osvr_server_config.HDK13DirectModeLandscape+Kinect+Wiimote.sample.json
Last active August 26, 2016 06:10
Configuration file for the OSVR server using the HDK in Direct Mode, the Kinect V2 sensor and two wiimotes.
{
"description": "This configuration supports video (so-called 'positional') and IMU fusion tracking, in addition to orientation-only tracking, with the OSVR HDK. It is configured for RenderManager applications in direct mode (portrait) on HDK 1.3 optics.",
"display": "displays/OSVR_HDK_1_3.json",
"renderManagerConfig": "sample-configs/renderManager.direct.landscape.json",
"drivers": [{
"plugin": "com_osvr_VideoBasedHMDTracker",
"driver": "VideoBasedHMDTracker",
"params": {
"showDebug": false,
"includeRearPanel": true,
@demonixis
demonixis / osvr_server_config.HDK13DirectModeLandscape+Kinect.sample.json
Last active May 26, 2020 20:11
Configuration file for the OSVR server using the HDK in Direct Mode, the Kinect V2 sensor and the Fusion Plugin. It's a bit experimental for now, the x and z axis are reversed with Kinect.
{
"description": "This configuration supports video (so-called 'positional') and IMU fusion tracking, in addition to orientation-only tracking, with the OSVR HDK. It is configured for RenderManager applications in direct mode (portrait) on HDK 1.3 optics.",
"display": "displays/OSVR_HDK_1_3.json",
"renderManagerConfig": "sample-configs/renderManager.direct.landscape.json",
"drivers": [{
"plugin": "com_osvr_VideoBasedHMDTracker",
"driver": "VideoBasedHMDTracker",
"params": {
"showDebug": false,
"includeRearPanel": true,
@demonixis
demonixis / osvr-config-fr.md
Last active July 18, 2016 14:28
OSVR et/ou configuration SteamVR

Installation & Configuration OSVR & SteamVR

Installation et mise en place du casque Razer HDK

La première chose à faire est d'installer tous les outils nécessaires au fonctionnement du casque sur votre PC.

A propos des modes d'affichage du casque

@demonixis
demonixis / detect_gpu.js
Last active June 25, 2020 22:44
Gets the user's GPU name using the `WEBGL_debug_renderer_info` WebGL extension. It returns a `string` with the graphics card name or `unknow` if the extension is not supported.
function getGraphicsCardName() {
var canvas = document.createElement("canvas");
var gl = canvas.getContext("experimental-webgl") || canvas.getContext("webgl");
if (!gl) {
return "Unknow";
}
var ext = gl.getExtension("WEBGL_debug_renderer_info");
if (!ext) {
@demonixis
demonixis / CheckOSVR_Unity.cs
Created November 13, 2015 07:04
A static method used to check if an HMD is available with the OSVR SDK for Unity.
public static bool HasOSVRHMDEnabled()
{
#if UNITY_STANDALONE
var clientContext = new OSVR.ClientKit.ClientContext(GamePrefs.AppID);
// Check if the server is running
if (clientContext != null && clientContext.CheckStatus())
{
// Check if the HMD si connected
var displayConfig = clientContext.GetDisplayConfig();