Skip to content

Commit

Permalink
OculusRenderPass improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaicoianu committed Apr 1, 2014
1 parent 0be5ec9 commit 20319d3
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion scripts/external/three/render/OculusRenderPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,30 @@ THREE.OculusRenderPass = function ( scene, camera, overrideMaterial, clearColor,
THREE.OculusRenderPass.prototype = {

initOculus: function() {
this.oculusparams = {};
document.body.addEventListener('click', this.fullscreen.bind(this));
},
fullscreen: function() {
if (!this.isfullscreen) {
if (document.body.webkitRequestFullScreen) {
document.body.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
} else if (document.body.mozRequestFullScreen) {
document.body.mozRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
} else if (document.body.requestFullScreen) {
document.body.requestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
}
}
},

setOculusParameters: function(params) {
this.oculusparams = params;
},

render: function ( renderer, writeBuffer, readBuffer, delta ) {

this.oculusparams.renderTarget = readBuffer;
if (!this.oculuseffect) {
this.oculuseffect = new THREE.OculusRiftEffect(renderer, {renderTarget: writeBuffer});
this.oculuseffect = new THREE.OculusRiftEffect(renderer, this.oculusparams);
} else {
this.oculuseffect.setOutputTarget(readBuffer);
}
Expand Down

0 comments on commit 20319d3

Please sign in to comment.