Open mkeblx opened 8 years ago
It may be possible to use WebVR API provided view and projection matrixes by introducing a WebvrRenderedTexture node (similar to RenderedTexture.js) which uses these in getProjectionMatrix and getViewMatrix.
I took a stab at extending the RenderedTexture node to directly provide the WebVR view and projection matrixes to the x3dom viewarea for rendering. See the matrix branch of my fork here :
https://github.com/andreasplesch/x3d-webvr-demo/tree/matrix
The extended node in js/ has additional stereo modes 'LEFT_VR' and 'RIGHT_VR' and an additional field 'vrDisplay' which trigger use of the WebVR defined matrixes, after applying any additional local transforms.
With webvr.x3d using the new modes, webvr.js does not need the viewpoint position and orientation mutations. With these changes the classroom then works, in the simulator.
Still need to test in Rift and Valve, and also if wrapping Transforms are correctly multiplied in.
Also probably need to set near and far before getting matrixes from frame data.
But now encouraged since the idea works in principle.
Calculate correctly based on HMD parameters returned by WebVR API.