Skip to content

Commit

Permalink
Updated builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Jun 17, 2022
1 parent cca9b5c commit 90165b4
Show file tree
Hide file tree
Showing 4 changed files with 216 additions and 156 deletions.
118 changes: 68 additions & 50 deletions build/three.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -18324,7 +18324,7 @@ class WebXRManager extends EventDispatcher {
let initialRenderTarget = null;
let newRenderTarget = null;
const controllers = [];
const inputSourcesMap = new Map(); //
const controllerInputSources = []; //

const cameraL = new PerspectiveCamera();
cameraL.layers.enable(1);
Expand Down Expand Up @@ -18378,7 +18378,13 @@ class WebXRManager extends EventDispatcher {


function onSessionEvent(event) {
const controller = inputSourcesMap.get(event.inputSource);
const controllerIndex = controllerInputSources.indexOf(event.inputSource);

if (controllerIndex === -1) {
return;
}

const controller = controllers[controllerIndex];

if (controller !== undefined) {
controller.dispatchEvent({
Expand All @@ -18397,12 +18403,13 @@ class WebXRManager extends EventDispatcher {
session.removeEventListener('squeezeend', onSessionEvent);
session.removeEventListener('end', onSessionEnd);
session.removeEventListener('inputsourceschange', onInputSourcesChange);
inputSourcesMap.forEach(function (controller, inputSource) {
if (controller !== undefined) {
controller.disconnect(inputSource);
}
});
inputSourcesMap.clear();

for (let i = 0; i < controllers.length; i++) {
const inputSource = controllerInputSources[i];
if (inputSource === null) continue;
controllers[i].disconnect(inputSource);
}

_currentDepthNear = null;
_currentDepthFar = null; // restore framebuffer/rendering state

Expand Down Expand Up @@ -18544,31 +18551,44 @@ class WebXRManager extends EventDispatcher {
};

function onInputSourcesChange(event) {
const inputSources = session.inputSources; // Assign controllers to available inputSources

for (let i = 0; i < inputSources.length; i++) {
const index = inputSources[i].handedness === 'right' ? 1 : 0;
inputSourcesMap.set(inputSources[i], controllers[index]);
} // Notify disconnected


// Notify disconnected
for (let i = 0; i < event.removed.length; i++) {
const inputSource = event.removed[i];
const controller = inputSourcesMap.get(inputSource);
const index = controllerInputSources.indexOf(inputSource);

if (controller) {
controller.dispatchEvent({
if (index >= 0) {
controllerInputSources[index] = null;
controllers[index].dispatchEvent({
type: 'disconnected',
data: inputSource
});
inputSourcesMap.delete(inputSource);
}
} // Notify connected


for (let i = 0; i < event.added.length; i++) {
const inputSource = event.added[i];
const controller = inputSourcesMap.get(inputSource);
let controllerIndex = controllerInputSources.indexOf(inputSource);

if (controllerIndex === -1) {
// Assign input source a controller that currently has no input source
for (let i = 0; i < controllers.length; i++) {
if (i >= controllerInputSources.length) {
controllerInputSources.push(inputSource);
controllerIndex = i;
break;
} else if (controllerInputSources[i] === null) {
controllerInputSources[i] = inputSource;
controllerIndex = i;
break;
}
} // If all controllers do currently receive input we ignore new ones


if (controllerIndex === -1) break;
}

const controller = controllers[controllerIndex];

if (controller) {
controller.dispatchEvent({
Expand Down Expand Up @@ -18773,13 +18793,11 @@ class WebXRManager extends EventDispatcher {
} //


const inputSources = session.inputSources;

for (let i = 0; i < controllers.length; i++) {
const inputSource = inputSources[i];
const controller = inputSourcesMap.get(inputSource);
const inputSource = controllerInputSources[i];
const controller = controllers[i];

if (controller !== undefined) {
if (inputSource !== null && controller !== undefined) {
controller.update(inputSource, frame, customReferenceSpace || referenceSpace);
}
}
Expand Down Expand Up @@ -29616,31 +29634,31 @@ class MaterialLoader extends Loader {
return this;
}

}
static createMaterialFromType(type) {
const materialLib = {
ShadowMaterial,
SpriteMaterial,
RawShaderMaterial,
ShaderMaterial,
PointsMaterial,
MeshPhysicalMaterial,
MeshStandardMaterial,
MeshPhongMaterial,
MeshToonMaterial,
MeshNormalMaterial,
MeshLambertMaterial,
MeshDepthMaterial,
MeshDistanceMaterial,
MeshBasicMaterial,
MeshMatcapMaterial,
LineDashedMaterial,
LineBasicMaterial,
Material
};
return new materialLib[type]();
}

MaterialLoader.createMaterialFromType = function (type) {
const materialLib = {
ShadowMaterial,
SpriteMaterial,
RawShaderMaterial,
ShaderMaterial,
PointsMaterial,
MeshPhysicalMaterial,
MeshStandardMaterial,
MeshPhongMaterial,
MeshToonMaterial,
MeshNormalMaterial,
MeshLambertMaterial,
MeshDepthMaterial,
MeshDistanceMaterial,
MeshBasicMaterial,
MeshMatcapMaterial,
LineDashedMaterial,
LineBasicMaterial,
Material
};
return new materialLib[type]();
};
}

class LoaderUtils {
static decodeText(array) {
Expand Down
118 changes: 68 additions & 50 deletions build/three.js
Original file line number Diff line number Diff line change
Expand Up @@ -18326,7 +18326,7 @@
let initialRenderTarget = null;
let newRenderTarget = null;
const controllers = [];
const inputSourcesMap = new Map(); //
const controllerInputSources = []; //

const cameraL = new PerspectiveCamera();
cameraL.layers.enable(1);
Expand Down Expand Up @@ -18380,7 +18380,13 @@


function onSessionEvent(event) {
const controller = inputSourcesMap.get(event.inputSource);
const controllerIndex = controllerInputSources.indexOf(event.inputSource);

if (controllerIndex === -1) {
return;
}

const controller = controllers[controllerIndex];

if (controller !== undefined) {
controller.dispatchEvent({
Expand All @@ -18399,12 +18405,13 @@
session.removeEventListener('squeezeend', onSessionEvent);
session.removeEventListener('end', onSessionEnd);
session.removeEventListener('inputsourceschange', onInputSourcesChange);
inputSourcesMap.forEach(function (controller, inputSource) {
if (controller !== undefined) {
controller.disconnect(inputSource);
}
});
inputSourcesMap.clear();

for (let i = 0; i < controllers.length; i++) {
const inputSource = controllerInputSources[i];
if (inputSource === null) continue;
controllers[i].disconnect(inputSource);
}

_currentDepthNear = null;
_currentDepthFar = null; // restore framebuffer/rendering state

Expand Down Expand Up @@ -18546,31 +18553,44 @@
};

function onInputSourcesChange(event) {
const inputSources = session.inputSources; // Assign controllers to available inputSources

for (let i = 0; i < inputSources.length; i++) {
const index = inputSources[i].handedness === 'right' ? 1 : 0;
inputSourcesMap.set(inputSources[i], controllers[index]);
} // Notify disconnected


// Notify disconnected
for (let i = 0; i < event.removed.length; i++) {
const inputSource = event.removed[i];
const controller = inputSourcesMap.get(inputSource);
const index = controllerInputSources.indexOf(inputSource);

if (controller) {
controller.dispatchEvent({
if (index >= 0) {
controllerInputSources[index] = null;
controllers[index].dispatchEvent({
type: 'disconnected',
data: inputSource
});
inputSourcesMap.delete(inputSource);
}
} // Notify connected


for (let i = 0; i < event.added.length; i++) {
const inputSource = event.added[i];
const controller = inputSourcesMap.get(inputSource);
let controllerIndex = controllerInputSources.indexOf(inputSource);

if (controllerIndex === -1) {
// Assign input source a controller that currently has no input source
for (let i = 0; i < controllers.length; i++) {
if (i >= controllerInputSources.length) {
controllerInputSources.push(inputSource);
controllerIndex = i;
break;
} else if (controllerInputSources[i] === null) {
controllerInputSources[i] = inputSource;
controllerIndex = i;
break;
}
} // If all controllers do currently receive input we ignore new ones


if (controllerIndex === -1) break;
}

const controller = controllers[controllerIndex];

if (controller) {
controller.dispatchEvent({
Expand Down Expand Up @@ -18775,13 +18795,11 @@
} //


const inputSources = session.inputSources;

for (let i = 0; i < controllers.length; i++) {
const inputSource = inputSources[i];
const controller = inputSourcesMap.get(inputSource);
const inputSource = controllerInputSources[i];
const controller = controllers[i];

if (controller !== undefined) {
if (inputSource !== null && controller !== undefined) {
controller.update(inputSource, frame, customReferenceSpace || referenceSpace);
}
}
Expand Down Expand Up @@ -29618,31 +29636,31 @@
return this;
}

}
static createMaterialFromType(type) {
const materialLib = {
ShadowMaterial,
SpriteMaterial,
RawShaderMaterial,
ShaderMaterial,
PointsMaterial,
MeshPhysicalMaterial,
MeshStandardMaterial,
MeshPhongMaterial,
MeshToonMaterial,
MeshNormalMaterial,
MeshLambertMaterial,
MeshDepthMaterial,
MeshDistanceMaterial,
MeshBasicMaterial,
MeshMatcapMaterial,
LineDashedMaterial,
LineBasicMaterial,
Material
};
return new materialLib[type]();
}

MaterialLoader.createMaterialFromType = function (type) {
const materialLib = {
ShadowMaterial,
SpriteMaterial,
RawShaderMaterial,
ShaderMaterial,
PointsMaterial,
MeshPhysicalMaterial,
MeshStandardMaterial,
MeshPhongMaterial,
MeshToonMaterial,
MeshNormalMaterial,
MeshLambertMaterial,
MeshDepthMaterial,
MeshDistanceMaterial,
MeshBasicMaterial,
MeshMatcapMaterial,
LineDashedMaterial,
LineBasicMaterial,
Material
};
return new materialLib[type]();
};
}

class LoaderUtils {
static decodeText(array) {
Expand Down
2 changes: 1 addition & 1 deletion build/three.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 90165b4

Please sign in to comment.