(function (global, factory) { if (typeof define === "function" && define.amd) { define(["exports", "three"], factory); } else if (typeof exports !== "undefined") { factory(exports, require("three")); } else { var mod = { exports: {} }; factory(mod.exports, global.three); global.StereoEffect = mod.exports; } })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _three) { "use strict"; Object.defineProperty(_exports, "__esModule", { value: true }); _exports.StereoEffect = void 0; function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var StereoEffect = /*#__PURE__*/_createClass(function StereoEffect(renderer) { _classCallCheck(this, StereoEffect); var _stereo = new _three.StereoCamera(); _stereo.aspect = 0.5; var size = new _three.Vector2(); this.setEyeSeparation = function (eyeSep) { _stereo.eyeSep = eyeSep; }; this.setSize = function (width, height) { renderer.setSize(width, height); }; this.render = function (scene, camera) { scene.updateMatrixWorld(); if (camera.parent === null) camera.updateMatrixWorld(); _stereo.update(camera); renderer.getSize(size); if (renderer.autoClear) renderer.clear(); renderer.setScissorTest(true); renderer.setScissor(0, 0, size.width / 2, size.height); renderer.setViewport(0, 0, size.width / 2, size.height); renderer.render(scene, _stereo.cameraL); renderer.setScissor(size.width / 2, 0, size.width / 2, size.height); renderer.setViewport(size.width / 2, 0, size.width / 2, size.height); renderer.render(scene, _stereo.cameraR); renderer.setScissorTest(false); }; }); _exports.StereoEffect = StereoEffect; });