|
@@ -9,7 +9,7 @@
|
|
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.THREE = {}));
|
|
|
})(this, (function (exports) { 'use strict';
|
|
|
|
|
|
- const REVISION = '135';
|
|
|
+ const REVISION = '136dev';
|
|
|
const MOUSE = {
|
|
|
LEFT: 0,
|
|
|
MIDDLE: 1,
|
|
@@ -14643,8 +14643,6 @@
|
|
|
return a.groupOrder - b.groupOrder;
|
|
|
} else if (a.renderOrder !== b.renderOrder) {
|
|
|
return a.renderOrder - b.renderOrder;
|
|
|
- } else if (a.program !== b.program) {
|
|
|
- return a.program.id - b.program.id;
|
|
|
} else if (a.material.id !== b.material.id) {
|
|
|
return a.material.id - b.material.id;
|
|
|
} else if (a.z !== b.z) {
|
|
@@ -14666,15 +14664,12 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function WebGLRenderList(properties) {
|
|
|
+ function WebGLRenderList() {
|
|
|
const renderItems = [];
|
|
|
let renderItemsIndex = 0;
|
|
|
const opaque = [];
|
|
|
const transmissive = [];
|
|
|
const transparent = [];
|
|
|
- const defaultProgram = {
|
|
|
- id: -1
|
|
|
- };
|
|
|
|
|
|
function init() {
|
|
|
renderItemsIndex = 0;
|
|
@@ -14685,7 +14680,6 @@
|
|
|
|
|
|
function getNextRenderItem(object, geometry, material, groupOrder, z, group) {
|
|
|
let renderItem = renderItems[renderItemsIndex];
|
|
|
- const materialProperties = properties.get(material);
|
|
|
|
|
|
if (renderItem === undefined) {
|
|
|
renderItem = {
|
|
@@ -14693,7 +14687,6 @@
|
|
|
object: object,
|
|
|
geometry: geometry,
|
|
|
material: material,
|
|
|
- program: materialProperties.program || defaultProgram,
|
|
|
groupOrder: groupOrder,
|
|
|
renderOrder: object.renderOrder,
|
|
|
z: z,
|
|
@@ -14705,7 +14698,6 @@
|
|
|
renderItem.object = object;
|
|
|
renderItem.geometry = geometry;
|
|
|
renderItem.material = material;
|
|
|
- renderItem.program = materialProperties.program || defaultProgram;
|
|
|
renderItem.groupOrder = groupOrder;
|
|
|
renderItem.renderOrder = object.renderOrder;
|
|
|
renderItem.z = z;
|
|
@@ -14755,7 +14747,6 @@
|
|
|
renderItem.object = null;
|
|
|
renderItem.geometry = null;
|
|
|
renderItem.material = null;
|
|
|
- renderItem.program = null;
|
|
|
renderItem.group = null;
|
|
|
}
|
|
|
}
|
|
@@ -14772,18 +14763,18 @@
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- function WebGLRenderLists(properties) {
|
|
|
+ function WebGLRenderLists() {
|
|
|
let lists = new WeakMap();
|
|
|
|
|
|
function get(scene, renderCallDepth) {
|
|
|
let list;
|
|
|
|
|
|
if (lists.has(scene) === false) {
|
|
|
- list = new WebGLRenderList(properties);
|
|
|
+ list = new WebGLRenderList();
|
|
|
lists.set(scene, [list]);
|
|
|
} else {
|
|
|
if (renderCallDepth >= lists.get(scene).length) {
|
|
|
- list = new WebGLRenderList(properties);
|
|
|
+ list = new WebGLRenderList();
|
|
|
lists.get(scene).push(list);
|
|
|
} else {
|
|
|
list = lists.get(scene)[renderCallDepth];
|
|
@@ -16769,6 +16760,8 @@
|
|
|
setTextureParameters(textureType, texture, supportsMips);
|
|
|
let mipmap;
|
|
|
const mipmaps = texture.mipmaps;
|
|
|
+ const useTexStorage = isWebGL2 && texture.isVideoTexture !== true;
|
|
|
+ const allocateMemory = textureProperties.__version === undefined;
|
|
|
|
|
|
if (texture.isDepthTexture) {
|
|
|
// populate depth texture with dummy data
|
|
@@ -16817,7 +16810,11 @@
|
|
|
} //
|
|
|
|
|
|
|
|
|
- state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null);
|
|
|
+ if (useTexStorage && allocateMemory) {
|
|
|
+ state.texStorage2D(_gl.TEXTURE_2D, 1, glInternalFormat, image.width, image.height);
|
|
|
+ } else {
|
|
|
+ state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null);
|
|
|
+ }
|
|
|
} else if (texture.isDataTexture) {
|
|
|
// use manually created mipmaps if available
|
|
|
// if there are no manual mipmaps
|
|
@@ -16850,14 +16847,12 @@
|
|
|
state.texImage3D(_gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data);
|
|
|
} else if (texture.isDataTexture3D) {
|
|
|
state.texImage3D(_gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data);
|
|
|
- } else {
|
|
|
+ } else if (texture.isFramebufferTexture) ; else {
|
|
|
// regular Texture (image, video, canvas)
|
|
|
// use manually created mipmaps if available
|
|
|
// if there are no manual mipmaps
|
|
|
// set 0 level mipmap and then use GL to generate other mipmap levels
|
|
|
const levels = getMipLevels(texture, image, supportsMips);
|
|
|
- const useTexStorage = isWebGL2 && texture.isVideoTexture !== true;
|
|
|
- const allocateMemory = textureProperties.__version === undefined;
|
|
|
|
|
|
if (mipmaps.length > 0 && supportsMips) {
|
|
|
if (useTexStorage && allocateMemory) {
|
|
@@ -17980,7 +17975,7 @@
|
|
|
let glDepthFormat = null;
|
|
|
|
|
|
if (attributes.depth) {
|
|
|
- glDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT16;
|
|
|
+ glDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;
|
|
|
depthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat;
|
|
|
depthType = attributes.stencil ? UnsignedInt248Type : UnsignedShortType;
|
|
|
}
|
|
@@ -18003,7 +17998,8 @@
|
|
|
depthTexture: new DepthTexture(glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat),
|
|
|
stencilBuffer: attributes.stencil,
|
|
|
ignoreDepth: glProjLayer.ignoreDepthValues,
|
|
|
- useRenderToTexture: hasMultisampledRenderToTexture
|
|
|
+ useRenderToTexture: hasMultisampledRenderToTexture,
|
|
|
+ encoding: renderer.outputEncoding
|
|
|
});
|
|
|
} else {
|
|
|
newRenderTarget = new WebGLRenderTarget(glProjLayer.textureWidth, glProjLayer.textureHeight, {
|
|
@@ -18011,13 +18007,14 @@
|
|
|
type: UnsignedByteType,
|
|
|
depthTexture: new DepthTexture(glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat),
|
|
|
stencilBuffer: attributes.stencil,
|
|
|
- ignoreDepth: glProjLayer.ignoreDepthValues
|
|
|
+ ignoreDepth: glProjLayer.ignoreDepthValues,
|
|
|
+ encoding: renderer.outputEncoding
|
|
|
});
|
|
|
}
|
|
|
} // Set foveation to maximum.
|
|
|
|
|
|
|
|
|
- this.setFoveation(0);
|
|
|
+ this.setFoveation(1.0);
|
|
|
referenceSpace = await session.requestReferenceSpace(referenceSpaceType);
|
|
|
animation.setContext(session);
|
|
|
animation.start();
|
|
@@ -19008,7 +19005,7 @@
|
|
|
clipping = new WebGLClipping(properties);
|
|
|
programCache = new WebGLPrograms(_this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping);
|
|
|
materials = new WebGLMaterials(properties);
|
|
|
- renderLists = new WebGLRenderLists(properties);
|
|
|
+ renderLists = new WebGLRenderLists();
|
|
|
renderStates = new WebGLRenderStates(extensions, capabilities);
|
|
|
background = new WebGLBackground(_this, cubemaps, state, objects, _premultipliedAlpha);
|
|
|
shadowMap = new WebGLShadowMap(_this, objects, capabilities);
|
|
@@ -20154,6 +20151,11 @@
|
|
|
};
|
|
|
|
|
|
this.copyFramebufferToTexture = function (position, texture, level = 0) {
|
|
|
+ if (texture.isFramebufferTexture !== true) {
|
|
|
+ console.error('THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
const levelScale = Math.pow(2, -level);
|
|
|
const width = Math.floor(texture.image.width * levelScale);
|
|
|
const height = Math.floor(texture.image.height * levelScale);
|
|
@@ -21923,6 +21925,23 @@
|
|
|
|
|
|
VideoTexture.prototype.isVideoTexture = true;
|
|
|
|
|
|
+ class FramebufferTexture extends Texture {
|
|
|
+ constructor(width, height, format) {
|
|
|
+ super({
|
|
|
+ width,
|
|
|
+ height
|
|
|
+ });
|
|
|
+ this.format = format;
|
|
|
+ this.magFilter = NearestFilter;
|
|
|
+ this.minFilter = NearestFilter;
|
|
|
+ this.generateMipmaps = false;
|
|
|
+ this.needsUpdate = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ FramebufferTexture.prototype.isFramebufferTexture = true;
|
|
|
+
|
|
|
class CompressedTexture extends Texture {
|
|
|
constructor(mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding) {
|
|
|
super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding);
|
|
@@ -36147,6 +36166,7 @@
|
|
|
exports.FogExp2 = FogExp2;
|
|
|
exports.Font = Font;
|
|
|
exports.FontLoader = FontLoader;
|
|
|
+ exports.FramebufferTexture = FramebufferTexture;
|
|
|
exports.FrontSide = FrontSide;
|
|
|
exports.Frustum = Frustum;
|
|
|
exports.GLBufferAttribute = GLBufferAttribute;
|