super-three 0.173.1 → 0.173.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +63 -577
- package/build/three.core.js +0 -15
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +64 -563
- package/build/three.module.min.js +1 -1
- package/package.json +1 -1
- package/src/renderers/webgl/WebGLTextures.js +1 -2
package/build/three.module.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2010-2025 Three.js Authors
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
|
-
import { Color, Matrix3, Vector2, mergeUniforms, Vector3, CubeUVReflectionMapping, Mesh, BoxGeometry, ShaderMaterial, cloneUniforms, BackSide, ColorManagement, SRGBTransfer, PlaneGeometry, FrontSide, getUnlitUniformColorSpace, Euler, Matrix4, IntType, RGBAFormat, HalfFloatType, UnsignedByteType, FloatType, Plane, EquirectangularReflectionMapping, EquirectangularRefractionMapping, WebGLCubeRenderTarget, CubeReflectionMapping, CubeRefractionMapping, PerspectiveCamera, NoToneMapping, MeshBasicMaterial, BufferGeometry, BufferAttribute, WebGLRenderTarget, NoBlending, OrthographicCamera, LinearFilter, LinearSRGBColorSpace, warnOnce, arrayNeedsUint32, Uint32BufferAttribute, Uint16BufferAttribute, Vector4, DataArrayTexture, LessEqualCompare, Texture, DepthTexture, Data3DTexture, CubeTexture, GLSL3, CustomToneMapping, NeutralToneMapping, AgXToneMapping, ACESFilmicToneMapping, CineonToneMapping, ReinhardToneMapping, LinearToneMapping, PCFShadowMap, PCFSoftShadowMap, VSMShadowMap, LinearTransfer, AddOperation, MixOperation, MultiplyOperation, ObjectSpaceNormalMap, TangentSpaceNormalMap, NormalBlending, DoubleSide, UniformsUtils, Layers, Frustum, MeshDepthMaterial, RGBADepthPacking, MeshDistanceMaterial, NearestFilter, LessEqualDepth, AddEquation, SubtractEquation, ReverseSubtractEquation, ZeroFactor, OneFactor, SrcColorFactor, SrcAlphaFactor, SrcAlphaSaturateFactor, DstColorFactor, DstAlphaFactor, OneMinusSrcColorFactor, OneMinusSrcAlphaFactor, OneMinusDstColorFactor, OneMinusDstAlphaFactor, ConstantColorFactor, OneMinusConstantColorFactor, ConstantAlphaFactor, OneMinusConstantAlphaFactor, CustomBlending, MultiplyBlending, SubtractiveBlending, AdditiveBlending, CullFaceNone, CullFaceBack, CullFaceFront, NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessDepth, AlwaysDepth, NeverDepth, MinEquation, MaxEquation, RepeatWrapping, ClampToEdgeWrapping, MirroredRepeatWrapping, NearestMipmapNearestFilter, NearestMipmapLinearFilter, LinearMipmapNearestFilter, LinearMipmapLinearFilter, NeverCompare, AlwaysCompare, LessCompare, EqualCompare, GreaterEqualCompare, GreaterCompare, NotEqualCompare, NoColorSpace, DepthStencilFormat, getByteLength,
|
|
6
|
+
import { Color, Matrix3, Vector2, mergeUniforms, Vector3, CubeUVReflectionMapping, Mesh, BoxGeometry, ShaderMaterial, cloneUniforms, BackSide, ColorManagement, SRGBTransfer, PlaneGeometry, FrontSide, getUnlitUniformColorSpace, Euler, Matrix4, IntType, RGBAFormat, HalfFloatType, UnsignedByteType, FloatType, Plane, EquirectangularReflectionMapping, EquirectangularRefractionMapping, WebGLCubeRenderTarget, CubeReflectionMapping, CubeRefractionMapping, PerspectiveCamera, NoToneMapping, MeshBasicMaterial, BufferGeometry, BufferAttribute, WebGLRenderTarget, NoBlending, OrthographicCamera, LinearFilter, LinearSRGBColorSpace, warnOnce, arrayNeedsUint32, Uint32BufferAttribute, Uint16BufferAttribute, Vector4, DataArrayTexture, LessEqualCompare, Texture, DepthTexture, Data3DTexture, CubeTexture, GLSL3, CustomToneMapping, NeutralToneMapping, AgXToneMapping, ACESFilmicToneMapping, CineonToneMapping, ReinhardToneMapping, LinearToneMapping, PCFShadowMap, PCFSoftShadowMap, VSMShadowMap, LinearTransfer, AddOperation, MixOperation, MultiplyOperation, ObjectSpaceNormalMap, TangentSpaceNormalMap, NormalBlending, DoubleSide, UniformsUtils, Layers, Frustum, MeshDepthMaterial, RGBADepthPacking, MeshDistanceMaterial, NearestFilter, LessEqualDepth, AddEquation, SubtractEquation, ReverseSubtractEquation, ZeroFactor, OneFactor, SrcColorFactor, SrcAlphaFactor, SrcAlphaSaturateFactor, DstColorFactor, DstAlphaFactor, OneMinusSrcColorFactor, OneMinusSrcAlphaFactor, OneMinusDstColorFactor, OneMinusDstAlphaFactor, ConstantColorFactor, OneMinusConstantColorFactor, ConstantAlphaFactor, OneMinusConstantAlphaFactor, CustomBlending, MultiplyBlending, SubtractiveBlending, AdditiveBlending, CullFaceNone, CullFaceBack, CullFaceFront, NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessDepth, AlwaysDepth, NeverDepth, MinEquation, MaxEquation, RepeatWrapping, ClampToEdgeWrapping, MirroredRepeatWrapping, NearestMipmapNearestFilter, NearestMipmapLinearFilter, LinearMipmapNearestFilter, LinearMipmapLinearFilter, NeverCompare, AlwaysCompare, LessCompare, EqualCompare, GreaterEqualCompare, GreaterCompare, NotEqualCompare, NoColorSpace, DepthStencilFormat, getByteLength, UnsignedIntType, UnsignedInt248Type, UnsignedShortType, DepthFormat, createElementNS, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt5999Type, ByteType, ShortType, AlphaFormat, RGBFormat, LuminanceFormat, LuminanceAlphaFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, EventDispatcher, ArrayCamera, WebXRController, RAD2DEG, createCanvasElement, SRGBColorSpace, REVISION, toNormalizedProjectionMatrix, toReversedProjectionMatrix, probeAsync, WebGLCoordinateSystem } from './three.core.js';
|
|
7
7
|
export { AdditiveAnimationBlendMode, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BasicShadowMap, BatchedMesh, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeCamera, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CylinderGeometry, Cylindrical, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualStencilFunc, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, Fog, FogExp2, FramebufferTexture, GLBufferAttribute, GLSL1, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialLoader, MathUtils, Matrix2, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NeverStencilFunc, NormalAnimationBlendMode, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, OctahedronGeometry, Path, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBDepthPacking, RGBIntegerFormat, RGDepthPacking, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RenderTarget, RenderTarget3D, RenderTargetArray, ReplaceStencilOp, RingGeometry, Scene, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, TOUCH, TetrahedronGeometry, TextureLoader, TextureUtils, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, ZeroStencilOp } from './three.core.js';
|
|
8
8
|
|
|
9
9
|
function WebGLAnimation() {
|
|
@@ -1378,7 +1378,7 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
|
|
|
1378
1378
|
if ( boxMesh === undefined ) {
|
|
1379
1379
|
|
|
1380
1380
|
boxMesh = new Mesh(
|
|
1381
|
-
new BoxGeometry(
|
|
1381
|
+
new BoxGeometry( 1, 1, 1 ),
|
|
1382
1382
|
new ShaderMaterial( {
|
|
1383
1383
|
name: 'BackgroundCubeMaterial',
|
|
1384
1384
|
uniforms: cloneUniforms( ShaderLib.backgroundCube.uniforms ),
|
|
@@ -4289,103 +4289,6 @@ function WebGLMorphtargets( gl, capabilities, textures ) {
|
|
|
4289
4289
|
|
|
4290
4290
|
}
|
|
4291
4291
|
|
|
4292
|
-
/**
|
|
4293
|
-
* @author fernandojsg / http://fernandojsg.com
|
|
4294
|
-
* @author Takahiro https://github.com/takahirox
|
|
4295
|
-
*/
|
|
4296
|
-
|
|
4297
|
-
class WebGLMultiview {
|
|
4298
|
-
|
|
4299
|
-
constructor( renderer, extensions, gl ) {
|
|
4300
|
-
|
|
4301
|
-
this.renderer = renderer;
|
|
4302
|
-
|
|
4303
|
-
this.DEFAULT_NUMVIEWS = 2;
|
|
4304
|
-
this.maxNumViews = 0;
|
|
4305
|
-
this.gl = gl;
|
|
4306
|
-
|
|
4307
|
-
this.extensions = extensions;
|
|
4308
|
-
|
|
4309
|
-
this.available = this.extensions.has( 'OCULUS_multiview' );
|
|
4310
|
-
|
|
4311
|
-
if ( this.available ) {
|
|
4312
|
-
|
|
4313
|
-
const extension = this.extensions.get( 'OCULUS_multiview' );
|
|
4314
|
-
|
|
4315
|
-
this.maxNumViews = this.gl.getParameter( extension.MAX_VIEWS_OVR );
|
|
4316
|
-
|
|
4317
|
-
this.mat4 = [];
|
|
4318
|
-
this.mat3 = [];
|
|
4319
|
-
this.cameraArray = [];
|
|
4320
|
-
|
|
4321
|
-
for ( var i = 0; i < this.maxNumViews; i ++ ) {
|
|
4322
|
-
|
|
4323
|
-
this.mat4[ i ] = new Matrix4();
|
|
4324
|
-
this.mat3[ i ] = new Matrix3();
|
|
4325
|
-
|
|
4326
|
-
}
|
|
4327
|
-
|
|
4328
|
-
}
|
|
4329
|
-
|
|
4330
|
-
}
|
|
4331
|
-
|
|
4332
|
-
//
|
|
4333
|
-
getCameraArray( camera ) {
|
|
4334
|
-
|
|
4335
|
-
if ( camera.isArrayCamera ) return camera.cameras;
|
|
4336
|
-
|
|
4337
|
-
this.cameraArray[ 0 ] = camera;
|
|
4338
|
-
|
|
4339
|
-
return this.cameraArray;
|
|
4340
|
-
|
|
4341
|
-
}
|
|
4342
|
-
|
|
4343
|
-
updateCameraProjectionMatricesUniform( camera, uniforms ) {
|
|
4344
|
-
|
|
4345
|
-
var cameras = this.getCameraArray( camera );
|
|
4346
|
-
|
|
4347
|
-
for ( var i = 0; i < cameras.length; i ++ ) {
|
|
4348
|
-
|
|
4349
|
-
this.mat4[ i ].copy( cameras[ i ].projectionMatrix );
|
|
4350
|
-
|
|
4351
|
-
}
|
|
4352
|
-
|
|
4353
|
-
uniforms.setValue( this.gl, 'projectionMatrices', this.mat4 );
|
|
4354
|
-
|
|
4355
|
-
}
|
|
4356
|
-
|
|
4357
|
-
updateCameraViewMatricesUniform( camera, uniforms ) {
|
|
4358
|
-
|
|
4359
|
-
var cameras = this.getCameraArray( camera );
|
|
4360
|
-
|
|
4361
|
-
for ( var i = 0; i < cameras.length; i ++ ) {
|
|
4362
|
-
|
|
4363
|
-
this.mat4[ i ].copy( cameras[ i ].matrixWorldInverse );
|
|
4364
|
-
|
|
4365
|
-
}
|
|
4366
|
-
|
|
4367
|
-
uniforms.setValue( this.gl, 'viewMatrices', this.mat4 );
|
|
4368
|
-
|
|
4369
|
-
}
|
|
4370
|
-
|
|
4371
|
-
updateObjectMatricesUniforms( object, camera, uniforms ) {
|
|
4372
|
-
|
|
4373
|
-
var cameras = this.getCameraArray( camera );
|
|
4374
|
-
|
|
4375
|
-
for ( var i = 0; i < cameras.length; i ++ ) {
|
|
4376
|
-
|
|
4377
|
-
this.mat4[ i ].multiplyMatrices( cameras[ i ].matrixWorldInverse, object.matrixWorld );
|
|
4378
|
-
this.mat3[ i ].getNormalMatrix( this.mat4[ i ] );
|
|
4379
|
-
|
|
4380
|
-
}
|
|
4381
|
-
|
|
4382
|
-
uniforms.setValue( this.gl, 'modelViewMatrices', this.mat4 );
|
|
4383
|
-
uniforms.setValue( this.gl, 'normalMatrices', this.mat3 );
|
|
4384
|
-
|
|
4385
|
-
}
|
|
4386
|
-
|
|
4387
|
-
}
|
|
4388
|
-
|
|
4389
4292
|
function WebGLObjects( gl, geometries, attributes, info ) {
|
|
4390
4293
|
|
|
4391
4294
|
let updateMap = new WeakMap();
|
|
@@ -6137,8 +6040,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
6137
6040
|
let prefixVertex, prefixFragment;
|
|
6138
6041
|
let versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\n' : '';
|
|
6139
6042
|
|
|
6140
|
-
const numMultiviewViews = parameters.numMultiviewViews;
|
|
6141
|
-
|
|
6142
6043
|
if ( parameters.isRawShaderMaterial ) {
|
|
6143
6044
|
|
|
6144
6045
|
prefixVertex = [
|
|
@@ -6526,53 +6427,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
6526
6427
|
'#define textureCubeGradEXT textureGrad'
|
|
6527
6428
|
].join( '\n' ) + '\n' + prefixFragment;
|
|
6528
6429
|
|
|
6529
|
-
// Multiview
|
|
6530
|
-
|
|
6531
|
-
if ( numMultiviewViews > 0 ) {
|
|
6532
|
-
|
|
6533
|
-
// TODO: fix light transforms here?
|
|
6534
|
-
|
|
6535
|
-
prefixVertex = [
|
|
6536
|
-
'#extension GL_OVR_multiview : require',
|
|
6537
|
-
'layout(num_views = ' + numMultiviewViews + ') in;',
|
|
6538
|
-
'#define VIEW_ID gl_ViewID_OVR'
|
|
6539
|
-
].join( '\n' ) + '\n' + prefixVertex;
|
|
6540
|
-
|
|
6541
|
-
prefixVertex = prefixVertex.replace(
|
|
6542
|
-
[
|
|
6543
|
-
'uniform mat4 modelViewMatrix;',
|
|
6544
|
-
'uniform mat4 projectionMatrix;',
|
|
6545
|
-
'uniform mat4 viewMatrix;',
|
|
6546
|
-
'uniform mat3 normalMatrix;'
|
|
6547
|
-
].join( '\n' ),
|
|
6548
|
-
[
|
|
6549
|
-
'uniform mat4 modelViewMatrices[' + numMultiviewViews + '];',
|
|
6550
|
-
'uniform mat4 projectionMatrices[' + numMultiviewViews + '];',
|
|
6551
|
-
'uniform mat4 viewMatrices[' + numMultiviewViews + '];',
|
|
6552
|
-
'uniform mat3 normalMatrices[' + numMultiviewViews + '];',
|
|
6553
|
-
|
|
6554
|
-
'#define modelViewMatrix modelViewMatrices[VIEW_ID]',
|
|
6555
|
-
'#define projectionMatrix projectionMatrices[VIEW_ID]',
|
|
6556
|
-
'#define viewMatrix viewMatrices[VIEW_ID]',
|
|
6557
|
-
'#define normalMatrix normalMatrices[VIEW_ID]'
|
|
6558
|
-
].join( '\n' )
|
|
6559
|
-
);
|
|
6560
|
-
|
|
6561
|
-
prefixFragment = [
|
|
6562
|
-
'#extension GL_OVR_multiview : require',
|
|
6563
|
-
'#define VIEW_ID gl_ViewID_OVR'
|
|
6564
|
-
].join( '\n' ) + '\n' + prefixFragment;
|
|
6565
|
-
|
|
6566
|
-
prefixFragment = prefixFragment.replace(
|
|
6567
|
-
'uniform mat4 viewMatrix;',
|
|
6568
|
-
[
|
|
6569
|
-
'uniform mat4 viewMatrices[' + numMultiviewViews + '];',
|
|
6570
|
-
'#define viewMatrix viewMatrices[VIEW_ID]'
|
|
6571
|
-
].join( '\n' )
|
|
6572
|
-
);
|
|
6573
|
-
|
|
6574
|
-
}
|
|
6575
|
-
|
|
6576
6430
|
}
|
|
6577
6431
|
|
|
6578
6432
|
const vertexGlsl = versionString + prefixVertex + vertexShader;
|
|
@@ -6765,7 +6619,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
6765
6619
|
this.program = program;
|
|
6766
6620
|
this.vertexShader = glVertexShader;
|
|
6767
6621
|
this.fragmentShader = glFragmentShader;
|
|
6768
|
-
this.numMultiviewViews = numMultiviewViews;
|
|
6769
6622
|
|
|
6770
6623
|
return this;
|
|
6771
6624
|
|
|
@@ -6998,8 +6851,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
6998
6851
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
6999
6852
|
const reverseDepthBuffer = renderer.state.buffers.depth.getReversed();
|
|
7000
6853
|
|
|
7001
|
-
const numMultiviewViews = currentRenderTarget && currentRenderTarget.isWebGLMultiviewRenderTarget ? currentRenderTarget.numViews : 0;
|
|
7002
|
-
|
|
7003
6854
|
const IS_INSTANCEDMESH = object.isInstancedMesh === true;
|
|
7004
6855
|
const IS_BATCHEDMESH = object.isBatchedMesh === true;
|
|
7005
6856
|
|
|
@@ -7089,7 +6940,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
7089
6940
|
instancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,
|
|
7090
6941
|
|
|
7091
6942
|
supportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,
|
|
7092
|
-
numMultiviewViews: numMultiviewViews,
|
|
7093
6943
|
outputColorSpace: ( currentRenderTarget === null ) ? renderer.outputColorSpace : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace ),
|
|
7094
6944
|
alphaToCoverage: !! material.alphaToCoverage,
|
|
7095
6945
|
|
|
@@ -7454,8 +7304,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
7454
7304
|
_programLayers.enable( 20 );
|
|
7455
7305
|
if ( parameters.alphaToCoverage )
|
|
7456
7306
|
_programLayers.enable( 21 );
|
|
7457
|
-
if ( parameters.numMultiviewViews )
|
|
7458
|
-
_programLayers.enable( 21 );
|
|
7459
7307
|
|
|
7460
7308
|
array.push( _programLayers.mask );
|
|
7461
7309
|
|
|
@@ -10253,7 +10101,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10253
10101
|
|
|
10254
10102
|
const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
|
|
10255
10103
|
const supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );
|
|
10256
|
-
const multiviewExt = extensions.has( 'OCULUS_multiview' ) ? extensions.get( 'OCULUS_multiview' ) : null;
|
|
10257
10104
|
|
|
10258
10105
|
const _imageDimensions = new Vector2();
|
|
10259
10106
|
const _videoTextures = new WeakMap();
|
|
@@ -10261,9 +10108,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10261
10108
|
|
|
10262
10109
|
const _sources = new WeakMap(); // maps WebglTexture objects to instances of Source
|
|
10263
10110
|
|
|
10264
|
-
let _deferredUploads = [];
|
|
10265
|
-
let _deferTextureUploads = false;
|
|
10266
|
-
|
|
10267
10111
|
// cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,
|
|
10268
10112
|
// also OffscreenCanvas.getContext("webgl"), but not OffscreenCanvas.getContext("2d")!
|
|
10269
10113
|
// Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).
|
|
@@ -10778,11 +10622,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10778
10622
|
|
|
10779
10623
|
} else {
|
|
10780
10624
|
|
|
10781
|
-
|
|
10782
|
-
|
|
10783
|
-
return;
|
|
10784
|
-
|
|
10785
|
-
}
|
|
10625
|
+
uploadTexture( textureProperties, texture, slot );
|
|
10626
|
+
return;
|
|
10786
10627
|
|
|
10787
10628
|
}
|
|
10788
10629
|
|
|
@@ -10991,45 +10832,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10991
10832
|
|
|
10992
10833
|
}
|
|
10993
10834
|
|
|
10994
|
-
function setDeferTextureUploads( deferFlag ) {
|
|
10995
|
-
|
|
10996
|
-
_deferTextureUploads = deferFlag;
|
|
10997
|
-
|
|
10998
|
-
}
|
|
10999
|
-
|
|
11000
|
-
function runDeferredUploads() {
|
|
11001
|
-
|
|
11002
|
-
const previousDeferSetting = _deferTextureUploads;
|
|
11003
|
-
_deferTextureUploads = false;
|
|
11004
|
-
|
|
11005
|
-
for ( const upload of _deferredUploads ) {
|
|
11006
|
-
|
|
11007
|
-
uploadTexture( upload.textureProperties, upload.texture, upload.slot );
|
|
11008
|
-
upload.texture.isPendingDeferredUpload = false;
|
|
11009
|
-
|
|
11010
|
-
}
|
|
11011
|
-
|
|
11012
|
-
_deferredUploads = [];
|
|
11013
|
-
|
|
11014
|
-
_deferTextureUploads = previousDeferSetting;
|
|
11015
|
-
|
|
11016
|
-
}
|
|
11017
|
-
|
|
11018
10835
|
function uploadTexture( textureProperties, texture, slot ) {
|
|
11019
10836
|
|
|
11020
|
-
if ( _deferTextureUploads ) {
|
|
11021
|
-
|
|
11022
|
-
if ( ! texture.isPendingDeferredUpload ) {
|
|
11023
|
-
|
|
11024
|
-
texture.isPendingDeferredUpload = true;
|
|
11025
|
-
_deferredUploads.push( { textureProperties: textureProperties, texture: texture, slot: slot } );
|
|
11026
|
-
|
|
11027
|
-
}
|
|
11028
|
-
|
|
11029
|
-
return false;
|
|
11030
|
-
|
|
11031
|
-
}
|
|
11032
|
-
|
|
11033
10837
|
let textureType = _gl.TEXTURE_2D;
|
|
11034
10838
|
|
|
11035
10839
|
if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) textureType = _gl.TEXTURE_2D_ARRAY;
|
|
@@ -11459,7 +11263,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
11459
11263
|
}
|
|
11460
11264
|
|
|
11461
11265
|
textureProperties.__version = texture.version;
|
|
11462
|
-
return true;
|
|
11463
11266
|
|
|
11464
11267
|
}
|
|
11465
11268
|
|
|
@@ -11718,11 +11521,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
11718
11521
|
const width = Math.max( 1, renderTarget.width >> level );
|
|
11719
11522
|
const height = Math.max( 1, renderTarget.height >> level );
|
|
11720
11523
|
|
|
11721
|
-
if (
|
|
11722
|
-
|
|
11723
|
-
state.texStorage3D( _gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, renderTarget.width, renderTarget.height, renderTarget.numViews );
|
|
11724
|
-
|
|
11725
|
-
} else if ( textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY ) {
|
|
11524
|
+
if ( textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY ) {
|
|
11726
11525
|
|
|
11727
11526
|
state.texImage3D( textureTarget, level, glInternalFormat, width, height, renderTarget.depth, 0, glFormat, glType, null );
|
|
11728
11527
|
|
|
@@ -11736,31 +11535,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
11736
11535
|
|
|
11737
11536
|
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
11738
11537
|
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
if ( renderTarget.isWebGLMultiviewRenderTarget === true ) {
|
|
11538
|
+
if ( useMultisampledRTT( renderTarget ) ) {
|
|
11742
11539
|
|
|
11743
|
-
|
|
11744
|
-
|
|
11745
|
-
multiviewExt.framebufferTextureMultisampleMultiviewOVR( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, 0, getRenderTargetSamples( renderTarget ), 0, renderTarget.numViews );
|
|
11746
|
-
|
|
11747
|
-
} else {
|
|
11748
|
-
|
|
11749
|
-
multiviewExt.framebufferTextureMultiviewOVR( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, 0, 0, renderTarget.numViews );
|
|
11750
|
-
|
|
11751
|
-
}
|
|
11540
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget, textureProperties.__webglTexture, 0, getRenderTargetSamples( renderTarget ) );
|
|
11752
11541
|
|
|
11753
11542
|
} else if ( textureTarget === _gl.TEXTURE_2D || ( textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z ) ) { // see #24753
|
|
11754
11543
|
|
|
11755
|
-
|
|
11756
|
-
|
|
11757
|
-
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget, textureProperties.__webglTexture, 0, getRenderTargetSamples( renderTarget ) );
|
|
11758
|
-
|
|
11759
|
-
} else {
|
|
11760
|
-
|
|
11761
|
-
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, textureProperties.__webglTexture, level );
|
|
11762
|
-
|
|
11763
|
-
}
|
|
11544
|
+
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, textureProperties.__webglTexture, level );
|
|
11764
11545
|
|
|
11765
11546
|
}
|
|
11766
11547
|
|
|
@@ -11773,59 +11554,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
11773
11554
|
|
|
11774
11555
|
_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );
|
|
11775
11556
|
|
|
11776
|
-
if ( renderTarget.
|
|
11777
|
-
|
|
11778
|
-
const useMultisample = useMultisampledRTT( renderTarget );
|
|
11779
|
-
const numViews = renderTarget.numViews;
|
|
11780
|
-
|
|
11781
|
-
const depthTexture = renderTarget.depthTexture;
|
|
11782
|
-
let glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
11783
|
-
let glDepthAttachment = _gl.DEPTH_ATTACHMENT;
|
|
11784
|
-
|
|
11785
|
-
if ( depthTexture && depthTexture.isDepthTexture ) {
|
|
11786
|
-
|
|
11787
|
-
if ( depthTexture.type === FloatType ) {
|
|
11788
|
-
|
|
11789
|
-
glInternalFormat = _gl.DEPTH_COMPONENT32F;
|
|
11790
|
-
|
|
11791
|
-
} else if ( depthTexture.type === UnsignedInt248Type ) {
|
|
11792
|
-
|
|
11793
|
-
glInternalFormat = _gl.DEPTH24_STENCIL8;
|
|
11794
|
-
glDepthAttachment = _gl.DEPTH_STENCIL_ATTACHMENT;
|
|
11795
|
-
|
|
11796
|
-
}
|
|
11797
|
-
|
|
11798
|
-
// we're defaulting to _gl.DEPTH_COMPONENT24 so don't assign here
|
|
11799
|
-
// or else DeepScan will complain
|
|
11800
|
-
|
|
11801
|
-
// else if ( depthTexture.type === UnsignedIntType ) {
|
|
11802
|
-
|
|
11803
|
-
// glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
11804
|
-
|
|
11805
|
-
// }
|
|
11806
|
-
|
|
11807
|
-
}
|
|
11808
|
-
|
|
11809
|
-
let depthStencilTexture = properties.get( renderTarget.depthTexture ).__webglTexture;
|
|
11810
|
-
if ( depthStencilTexture === undefined ) {
|
|
11811
|
-
|
|
11812
|
-
depthStencilTexture = _gl.createTexture();
|
|
11813
|
-
_gl.bindTexture( _gl.TEXTURE_2D_ARRAY, depthStencilTexture );
|
|
11814
|
-
_gl.texStorage3D( _gl.TEXTURE_2D_ARRAY, 1, glInternalFormat, renderTarget.width, renderTarget.height, numViews );
|
|
11815
|
-
|
|
11816
|
-
}
|
|
11817
|
-
|
|
11818
|
-
if ( useMultisample ) {
|
|
11819
|
-
|
|
11820
|
-
multiviewExt.framebufferTextureMultisampleMultiviewOVR( _gl.FRAMEBUFFER, glDepthAttachment, depthStencilTexture, 0, getRenderTargetSamples( renderTarget ), 0, numViews );
|
|
11821
|
-
|
|
11822
|
-
} else {
|
|
11823
|
-
|
|
11824
|
-
multiviewExt.framebufferTextureMultiviewOVR( _gl.FRAMEBUFFER, glDepthAttachment, depthStencilTexture, 0, 0, numViews );
|
|
11825
|
-
|
|
11826
|
-
}
|
|
11827
|
-
|
|
11828
|
-
} else if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {
|
|
11557
|
+
if ( renderTarget.depthBuffer ) {
|
|
11829
11558
|
|
|
11830
11559
|
// retrieve the depth attachment types
|
|
11831
11560
|
const depthTexture = renderTarget.depthTexture;
|
|
@@ -11916,85 +11645,37 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
11916
11645
|
}
|
|
11917
11646
|
|
|
11918
11647
|
setTexture2D( renderTarget.depthTexture, 0 );
|
|
11919
|
-
if ( renderTarget.depthTexture.image.depth != 1 ) {
|
|
11920
|
-
|
|
11921
|
-
setTexture2DArray( renderTarget.depthTexture, 0 );
|
|
11922
|
-
|
|
11923
|
-
} else {
|
|
11924
|
-
|
|
11925
|
-
setTexture2D( renderTarget.depthTexture, 0 );
|
|
11926
|
-
|
|
11927
|
-
}
|
|
11928
11648
|
|
|
11929
11649
|
const webglDepthTexture = textureProperties.__webglTexture;
|
|
11930
11650
|
const samples = getRenderTargetSamples( renderTarget );
|
|
11931
11651
|
|
|
11932
|
-
if ( renderTarget.
|
|
11933
|
-
|
|
11934
|
-
const useMultisample = useMultisampledRTT( renderTarget );
|
|
11935
|
-
const numViews = renderTarget.numViews;
|
|
11936
|
-
|
|
11937
|
-
if ( renderTarget.depthTexture.format === DepthFormat ) {
|
|
11652
|
+
if ( renderTarget.depthTexture.format === DepthFormat ) {
|
|
11938
11653
|
|
|
11939
|
-
|
|
11654
|
+
if ( useMultisampledRTT( renderTarget ) ) {
|
|
11940
11655
|
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
} else {
|
|
11656
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );
|
|
11944
11657
|
|
|
11945
|
-
|
|
11946
|
-
|
|
11947
|
-
}
|
|
11948
|
-
|
|
11949
|
-
} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {
|
|
11658
|
+
} else {
|
|
11950
11659
|
|
|
11951
|
-
|
|
11660
|
+
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );
|
|
11952
11661
|
|
|
11953
|
-
|
|
11662
|
+
}
|
|
11954
11663
|
|
|
11955
|
-
|
|
11664
|
+
} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {
|
|
11956
11665
|
|
|
11957
|
-
|
|
11666
|
+
if ( useMultisampledRTT( renderTarget ) ) {
|
|
11958
11667
|
|
|
11959
|
-
|
|
11668
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );
|
|
11960
11669
|
|
|
11961
11670
|
} else {
|
|
11962
11671
|
|
|
11963
|
-
|
|
11672
|
+
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );
|
|
11964
11673
|
|
|
11965
11674
|
}
|
|
11966
11675
|
|
|
11967
11676
|
} else {
|
|
11968
11677
|
|
|
11969
|
-
|
|
11970
|
-
|
|
11971
|
-
if ( useMultisampledRTT( renderTarget ) ) {
|
|
11972
|
-
|
|
11973
|
-
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );
|
|
11974
|
-
|
|
11975
|
-
} else {
|
|
11976
|
-
|
|
11977
|
-
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );
|
|
11978
|
-
|
|
11979
|
-
}
|
|
11980
|
-
|
|
11981
|
-
} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {
|
|
11982
|
-
|
|
11983
|
-
if ( useMultisampledRTT( renderTarget ) ) {
|
|
11984
|
-
|
|
11985
|
-
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );
|
|
11986
|
-
|
|
11987
|
-
} else {
|
|
11988
|
-
|
|
11989
|
-
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );
|
|
11990
|
-
|
|
11991
|
-
}
|
|
11992
|
-
|
|
11993
|
-
} else {
|
|
11994
|
-
|
|
11995
|
-
throw new Error( 'Unknown depthTexture format' );
|
|
11996
|
-
|
|
11997
|
-
}
|
|
11678
|
+
throw new Error( 'Unknown depthTexture format' );
|
|
11998
11679
|
|
|
11999
11680
|
}
|
|
12000
11681
|
|
|
@@ -12309,12 +11990,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
12309
11990
|
|
|
12310
11991
|
}
|
|
12311
11992
|
|
|
12312
|
-
if ( renderTarget.isWebGLMultiviewRenderTarget === true ) {
|
|
12313
|
-
|
|
12314
|
-
glTextureType = _gl.TEXTURE_2D_ARRAY;
|
|
12315
|
-
|
|
12316
|
-
}
|
|
12317
|
-
|
|
12318
11993
|
state.bindTexture( glTextureType, textureProperties.__webglTexture );
|
|
12319
11994
|
setTextureParameters( glTextureType, texture );
|
|
12320
11995
|
|
|
@@ -12344,9 +12019,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
12344
12019
|
|
|
12345
12020
|
// Setup depth and stencil buffers
|
|
12346
12021
|
|
|
12347
|
-
if ( renderTarget.depthBuffer
|
|
12022
|
+
if ( renderTarget.depthBuffer ) {
|
|
12348
12023
|
|
|
12349
|
-
|
|
12024
|
+
setupDepthRenderbuffer( renderTarget );
|
|
12350
12025
|
|
|
12351
12026
|
}
|
|
12352
12027
|
|
|
@@ -12591,16 +12266,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
12591
12266
|
this.setTexture3D = setTexture3D;
|
|
12592
12267
|
this.setTextureCube = setTextureCube;
|
|
12593
12268
|
this.rebindTextures = rebindTextures;
|
|
12594
|
-
this.uploadTexture = uploadTexture;
|
|
12595
12269
|
this.setupRenderTarget = setupRenderTarget;
|
|
12596
12270
|
this.updateRenderTargetMipmap = updateRenderTargetMipmap;
|
|
12597
12271
|
this.updateMultisampleRenderTarget = updateMultisampleRenderTarget;
|
|
12598
|
-
this.setupDepthTexture = setupDepthTexture;
|
|
12599
12272
|
this.setupDepthRenderbuffer = setupDepthRenderbuffer;
|
|
12600
12273
|
this.setupFrameBufferTexture = setupFrameBufferTexture;
|
|
12601
12274
|
this.useMultisampledRTT = useMultisampledRTT;
|
|
12602
|
-
this.runDeferredUploads = runDeferredUploads;
|
|
12603
|
-
this.setDeferTextureUploads = setDeferTextureUploads;
|
|
12604
12275
|
|
|
12605
12276
|
}
|
|
12606
12277
|
|
|
@@ -12813,39 +12484,6 @@ function WebGLUtils( gl, extensions ) {
|
|
|
12813
12484
|
|
|
12814
12485
|
}
|
|
12815
12486
|
|
|
12816
|
-
/**
|
|
12817
|
-
* @author fernandojsg / http://fernandojsg.com
|
|
12818
|
-
* @author Takahiro https://github.com/takahirox
|
|
12819
|
-
*/
|
|
12820
|
-
|
|
12821
|
-
|
|
12822
|
-
class WebGLMultiviewRenderTarget extends WebGLRenderTarget {
|
|
12823
|
-
|
|
12824
|
-
constructor( width, height, numViews, options = {} ) {
|
|
12825
|
-
|
|
12826
|
-
super( width, height, options );
|
|
12827
|
-
|
|
12828
|
-
this.depthBuffer = false;
|
|
12829
|
-
this.stencilBuffer = false;
|
|
12830
|
-
|
|
12831
|
-
this.numViews = numViews;
|
|
12832
|
-
|
|
12833
|
-
}
|
|
12834
|
-
|
|
12835
|
-
copy( source ) {
|
|
12836
|
-
|
|
12837
|
-
super.copy( source );
|
|
12838
|
-
|
|
12839
|
-
this.numViews = source.numViews;
|
|
12840
|
-
|
|
12841
|
-
return this;
|
|
12842
|
-
|
|
12843
|
-
}
|
|
12844
|
-
|
|
12845
|
-
}
|
|
12846
|
-
|
|
12847
|
-
WebGLMultiviewRenderTarget.prototype.isWebGLMultiviewRenderTarget = true;
|
|
12848
|
-
|
|
12849
12487
|
const _occlusion_vertex = `
|
|
12850
12488
|
void main() {
|
|
12851
12489
|
|
|
@@ -12952,7 +12590,7 @@ class WebXRDepthSensing {
|
|
|
12952
12590
|
|
|
12953
12591
|
class WebXRManager extends EventDispatcher {
|
|
12954
12592
|
|
|
12955
|
-
constructor( renderer, gl
|
|
12593
|
+
constructor( renderer, gl ) {
|
|
12956
12594
|
|
|
12957
12595
|
super();
|
|
12958
12596
|
|
|
@@ -12961,7 +12599,6 @@ class WebXRManager extends EventDispatcher {
|
|
|
12961
12599
|
let session = null;
|
|
12962
12600
|
|
|
12963
12601
|
let framebufferScaleFactor = 1.0;
|
|
12964
|
-
var poseTarget = null;
|
|
12965
12602
|
|
|
12966
12603
|
let referenceSpace = null;
|
|
12967
12604
|
let referenceSpaceType = 'local-floor';
|
|
@@ -12970,8 +12607,6 @@ class WebXRManager extends EventDispatcher {
|
|
|
12970
12607
|
let customReferenceSpace = null;
|
|
12971
12608
|
|
|
12972
12609
|
let pose = null;
|
|
12973
|
-
var layers = [];
|
|
12974
|
-
|
|
12975
12610
|
let glBinding = null;
|
|
12976
12611
|
let glProjLayer = null;
|
|
12977
12612
|
let glBaseLayer = null;
|
|
@@ -13005,18 +12640,11 @@ class WebXRManager extends EventDispatcher {
|
|
|
13005
12640
|
let _currentDepthFar = null;
|
|
13006
12641
|
|
|
13007
12642
|
//
|
|
12643
|
+
|
|
13008
12644
|
this.cameraAutoUpdate = true;
|
|
13009
|
-
this.layersEnabled = false;
|
|
13010
12645
|
this.enabled = false;
|
|
13011
12646
|
|
|
13012
12647
|
this.isPresenting = false;
|
|
13013
|
-
this.isMultiview = false;
|
|
13014
|
-
|
|
13015
|
-
this.getCameraPose = function ( ) {
|
|
13016
|
-
|
|
13017
|
-
return pose;
|
|
13018
|
-
|
|
13019
|
-
};
|
|
13020
12648
|
|
|
13021
12649
|
this.getController = function ( index ) {
|
|
13022
12650
|
|
|
@@ -13185,12 +12813,6 @@ class WebXRManager extends EventDispatcher {
|
|
|
13185
12813
|
|
|
13186
12814
|
};
|
|
13187
12815
|
|
|
13188
|
-
this.getRenderTarget = function () {
|
|
13189
|
-
|
|
13190
|
-
return newRenderTarget;
|
|
13191
|
-
|
|
13192
|
-
};
|
|
13193
|
-
|
|
13194
12816
|
this.getFrame = function () {
|
|
13195
12817
|
|
|
13196
12818
|
return xrFrame;
|
|
@@ -13275,20 +12897,12 @@ class WebXRManager extends EventDispatcher {
|
|
|
13275
12897
|
|
|
13276
12898
|
}
|
|
13277
12899
|
|
|
13278
|
-
scope.isMultiview = useMultiview && extensions.has( 'OCULUS_multiview' );
|
|
13279
|
-
|
|
13280
12900
|
const projectionlayerInit = {
|
|
13281
12901
|
colorFormat: gl.RGBA8,
|
|
13282
12902
|
depthFormat: glDepthFormat,
|
|
13283
12903
|
scaleFactor: framebufferScaleFactor
|
|
13284
12904
|
};
|
|
13285
12905
|
|
|
13286
|
-
if ( scope.isMultiview ) {
|
|
13287
|
-
|
|
13288
|
-
projectionlayerInit.textureType = 'texture-array';
|
|
13289
|
-
|
|
13290
|
-
}
|
|
13291
|
-
|
|
13292
12906
|
glBinding = new XRWebGLBinding( session, gl );
|
|
13293
12907
|
|
|
13294
12908
|
glProjLayer = glBinding.createProjectionLayer( projectionlayerInit );
|
|
@@ -13298,32 +12912,18 @@ class WebXRManager extends EventDispatcher {
|
|
|
13298
12912
|
renderer.setPixelRatio( 1 );
|
|
13299
12913
|
renderer.setSize( glProjLayer.textureWidth, glProjLayer.textureHeight, false );
|
|
13300
12914
|
|
|
13301
|
-
|
|
13302
|
-
|
|
13303
|
-
|
|
13304
|
-
|
|
13305
|
-
|
|
13306
|
-
|
|
13307
|
-
|
|
13308
|
-
|
|
13309
|
-
|
|
13310
|
-
|
|
13311
|
-
|
|
13312
|
-
|
|
13313
|
-
const extension = extensions.get( 'OCULUS_multiview' );
|
|
13314
|
-
|
|
13315
|
-
this.maxNumViews = gl.getParameter( extension.MAX_VIEWS_OVR );
|
|
13316
|
-
|
|
13317
|
-
newRenderTarget = new WebGLMultiviewRenderTarget( glProjLayer.textureWidth, glProjLayer.textureHeight, 2, renderTargetOptions );
|
|
13318
|
-
|
|
13319
|
-
} else {
|
|
13320
|
-
|
|
13321
|
-
newRenderTarget = new WebGLRenderTarget(
|
|
13322
|
-
glProjLayer.textureWidth,
|
|
13323
|
-
glProjLayer.textureHeight,
|
|
13324
|
-
renderTargetOptions );
|
|
13325
|
-
|
|
13326
|
-
}
|
|
12915
|
+
newRenderTarget = new WebGLRenderTarget(
|
|
12916
|
+
glProjLayer.textureWidth,
|
|
12917
|
+
glProjLayer.textureHeight,
|
|
12918
|
+
{
|
|
12919
|
+
format: RGBAFormat,
|
|
12920
|
+
type: UnsignedByteType,
|
|
12921
|
+
depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
|
|
12922
|
+
stencilBuffer: attributes.stencil,
|
|
12923
|
+
colorSpace: renderer.outputColorSpace,
|
|
12924
|
+
samples: attributes.antialias ? 4 : 0,
|
|
12925
|
+
resolveDepthBuffer: ( glProjLayer.ignoreDepthValues === false )
|
|
12926
|
+
} );
|
|
13327
12927
|
|
|
13328
12928
|
}
|
|
13329
12929
|
|
|
@@ -13352,28 +12952,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
13352
12952
|
return session.environmentBlendMode;
|
|
13353
12953
|
|
|
13354
12954
|
}
|
|
13355
|
-
};
|
|
13356
|
-
|
|
13357
|
-
this.addLayer = function(layer) {
|
|
13358
|
-
if (!window.XRWebGLBinding || !this.layersEnabled || !session) { return; }
|
|
13359
12955
|
|
|
13360
|
-
layers.push( layer );
|
|
13361
|
-
this.updateLayers();
|
|
13362
|
-
};
|
|
13363
|
-
|
|
13364
|
-
this.removeLayer = function(layer) {
|
|
13365
|
-
|
|
13366
|
-
layers.splice( layers.indexOf(layer), 1 );
|
|
13367
|
-
if (!window.XRWebGLBinding || !this.layersEnabled || !session) { return; }
|
|
13368
|
-
|
|
13369
|
-
this.updateLayers();
|
|
13370
|
-
};
|
|
13371
|
-
|
|
13372
|
-
this.updateLayers = function() {
|
|
13373
|
-
var layersCopy = layers.map(function (x) { return x; });
|
|
13374
|
-
|
|
13375
|
-
layersCopy.unshift( session.renderState.layers[0] );
|
|
13376
|
-
session.updateRenderState( { layers: layersCopy } );
|
|
13377
12956
|
};
|
|
13378
12957
|
|
|
13379
12958
|
this.getDepthTexture = function () {
|
|
@@ -13542,12 +13121,6 @@ class WebXRManager extends EventDispatcher {
|
|
|
13542
13121
|
|
|
13543
13122
|
}
|
|
13544
13123
|
|
|
13545
|
-
this.setPoseTarget = function ( object ) {
|
|
13546
|
-
|
|
13547
|
-
if ( object !== undefined ) poseTarget = object;
|
|
13548
|
-
|
|
13549
|
-
};
|
|
13550
|
-
|
|
13551
13124
|
this.updateCamera = function ( camera ) {
|
|
13552
13125
|
|
|
13553
13126
|
if ( session === null ) return;
|
|
@@ -13583,9 +13156,8 @@ class WebXRManager extends EventDispatcher {
|
|
|
13583
13156
|
cameraR.layers.mask = camera.layers.mask | 0b100;
|
|
13584
13157
|
cameraXR.layers.mask = cameraL.layers.mask | cameraR.layers.mask;
|
|
13585
13158
|
|
|
13159
|
+
const parent = camera.parent;
|
|
13586
13160
|
const cameras = cameraXR.cameras;
|
|
13587
|
-
var object = poseTarget || camera;
|
|
13588
|
-
const parent = object.parent;
|
|
13589
13161
|
|
|
13590
13162
|
updateCamera( cameraXR, parent );
|
|
13591
13163
|
|
|
@@ -13609,28 +13181,28 @@ class WebXRManager extends EventDispatcher {
|
|
|
13609
13181
|
|
|
13610
13182
|
}
|
|
13611
13183
|
|
|
13612
|
-
|
|
13184
|
+
// update user camera and its children
|
|
13613
13185
|
|
|
13614
|
-
|
|
13186
|
+
updateUserCamera( camera, cameraXR, parent );
|
|
13615
13187
|
|
|
13616
|
-
|
|
13188
|
+
};
|
|
13617
13189
|
|
|
13618
|
-
|
|
13190
|
+
function updateUserCamera( camera, cameraXR, parent ) {
|
|
13619
13191
|
|
|
13620
|
-
if (
|
|
13192
|
+
if ( parent === null ) {
|
|
13621
13193
|
|
|
13622
|
-
|
|
13194
|
+
camera.matrix.copy( cameraXR.matrixWorld );
|
|
13623
13195
|
|
|
13624
13196
|
} else {
|
|
13625
13197
|
|
|
13626
|
-
|
|
13627
|
-
|
|
13628
|
-
|
|
13198
|
+
camera.matrix.copy( parent.matrixWorld );
|
|
13199
|
+
camera.matrix.invert();
|
|
13200
|
+
camera.matrix.multiply( cameraXR.matrixWorld );
|
|
13629
13201
|
|
|
13630
13202
|
}
|
|
13631
13203
|
|
|
13632
|
-
|
|
13633
|
-
|
|
13204
|
+
camera.matrix.decompose( camera.position, camera.quaternion, camera.scale );
|
|
13205
|
+
camera.updateMatrixWorld( true );
|
|
13634
13206
|
|
|
13635
13207
|
camera.projectionMatrix.copy( cameraXR.projectionMatrix );
|
|
13636
13208
|
camera.projectionMatrixInverse.copy( cameraXR.projectionMatrixInverse );
|
|
@@ -14842,7 +14414,6 @@ class WebGLRenderer {
|
|
|
14842
14414
|
powerPreference = 'default',
|
|
14843
14415
|
failIfMajorPerformanceCaveat = false,
|
|
14844
14416
|
reverseDepthBuffer = false,
|
|
14845
|
-
multiviewStereo = false,
|
|
14846
14417
|
} = parameters;
|
|
14847
14418
|
|
|
14848
14419
|
this.isWebGLRenderer = true;
|
|
@@ -15050,7 +14621,6 @@ class WebGLRenderer {
|
|
|
15050
14621
|
let extensions, capabilities, state, info;
|
|
15051
14622
|
let properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects;
|
|
15052
14623
|
let programCache, materials, renderLists, renderStates, clipping, shadowMap;
|
|
15053
|
-
let multiview;
|
|
15054
14624
|
|
|
15055
14625
|
let background, morphtargets, bufferRenderer, indexedBufferRenderer;
|
|
15056
14626
|
|
|
@@ -15089,7 +14659,6 @@ class WebGLRenderer {
|
|
|
15089
14659
|
renderLists = new WebGLRenderLists();
|
|
15090
14660
|
renderStates = new WebGLRenderStates( extensions );
|
|
15091
14661
|
background = new WebGLBackground( _this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha );
|
|
15092
|
-
multiview = new WebGLMultiview( _this, extensions, _gl );
|
|
15093
14662
|
shadowMap = new WebGLShadowMap( _this, objects, capabilities );
|
|
15094
14663
|
uniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );
|
|
15095
14664
|
|
|
@@ -16026,21 +15595,11 @@ class WebGLRenderer {
|
|
|
16026
15595
|
|
|
16027
15596
|
if ( _renderBackground ) background.render( scene );
|
|
16028
15597
|
|
|
16029
|
-
|
|
16030
|
-
|
|
16031
|
-
textures.setDeferTextureUploads( true );
|
|
16032
|
-
|
|
16033
|
-
renderScene( currentRenderList, scene, camera, camera.cameras[ 0 ].viewport );
|
|
16034
|
-
|
|
16035
|
-
} else {
|
|
16036
|
-
|
|
16037
|
-
for ( let i = 0, l = cameras.length; i < l; i ++ ) {
|
|
15598
|
+
for ( let i = 0, l = cameras.length; i < l; i ++ ) {
|
|
16038
15599
|
|
|
16039
|
-
|
|
15600
|
+
const camera2 = cameras[ i ];
|
|
16040
15601
|
|
|
16041
|
-
|
|
16042
|
-
|
|
16043
|
-
}
|
|
15602
|
+
renderScene( currentRenderList, scene, camera2, camera2.viewport );
|
|
16044
15603
|
|
|
16045
15604
|
}
|
|
16046
15605
|
|
|
@@ -16566,7 +16125,6 @@ class WebGLRenderer {
|
|
|
16566
16125
|
materialProperties.vertexAlphas = parameters.vertexAlphas;
|
|
16567
16126
|
materialProperties.vertexTangents = parameters.vertexTangents;
|
|
16568
16127
|
materialProperties.toneMapping = parameters.toneMapping;
|
|
16569
|
-
materialProperties.numMultiviewViews = parameters.numMultiviewViews;
|
|
16570
16128
|
|
|
16571
16129
|
}
|
|
16572
16130
|
|
|
@@ -16598,8 +16156,6 @@ class WebGLRenderer {
|
|
|
16598
16156
|
|
|
16599
16157
|
}
|
|
16600
16158
|
|
|
16601
|
-
const numMultiviewViews = _currentRenderTarget && _currentRenderTarget.isWebGLMultiviewRenderTarget ? _currentRenderTarget.numViews : 0;
|
|
16602
|
-
|
|
16603
16159
|
const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
|
|
16604
16160
|
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
|
|
16605
16161
|
|
|
@@ -16727,10 +16283,6 @@ class WebGLRenderer {
|
|
|
16727
16283
|
|
|
16728
16284
|
needsProgramChange = true;
|
|
16729
16285
|
|
|
16730
|
-
} else if ( materialProperties.numMultiviewViews !== numMultiviewViews ) {
|
|
16731
|
-
|
|
16732
|
-
needsProgramChange = true;
|
|
16733
|
-
|
|
16734
16286
|
}
|
|
16735
16287
|
|
|
16736
16288
|
} else {
|
|
@@ -16777,34 +16329,25 @@ class WebGLRenderer {
|
|
|
16777
16329
|
|
|
16778
16330
|
// common camera uniforms
|
|
16779
16331
|
|
|
16780
|
-
|
|
16332
|
+
const reverseDepthBuffer = state.buffers.depth.getReversed();
|
|
16781
16333
|
|
|
16782
|
-
|
|
16783
|
-
multiview.updateCameraViewMatricesUniform( camera, p_uniforms );
|
|
16334
|
+
if ( reverseDepthBuffer ) {
|
|
16784
16335
|
|
|
16785
|
-
|
|
16786
|
-
|
|
16787
|
-
const reverseDepthBuffer = state.buffers.depth.getReversed();
|
|
16788
|
-
|
|
16789
|
-
if ( reverseDepthBuffer ) {
|
|
16336
|
+
_currentProjectionMatrix.copy( camera.projectionMatrix );
|
|
16790
16337
|
|
|
16791
|
-
|
|
16338
|
+
toNormalizedProjectionMatrix( _currentProjectionMatrix );
|
|
16339
|
+
toReversedProjectionMatrix( _currentProjectionMatrix );
|
|
16792
16340
|
|
|
16793
|
-
|
|
16794
|
-
toReversedProjectionMatrix( _currentProjectionMatrix );
|
|
16341
|
+
p_uniforms.setValue( _gl, 'projectionMatrix', _currentProjectionMatrix );
|
|
16795
16342
|
|
|
16796
|
-
|
|
16797
|
-
|
|
16798
|
-
} else {
|
|
16799
|
-
|
|
16800
|
-
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
16801
|
-
|
|
16802
|
-
}
|
|
16343
|
+
} else {
|
|
16803
16344
|
|
|
16804
|
-
p_uniforms.setValue( _gl, '
|
|
16345
|
+
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
16805
16346
|
|
|
16806
16347
|
}
|
|
16807
16348
|
|
|
16349
|
+
p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
|
|
16350
|
+
|
|
16808
16351
|
const uCamPos = p_uniforms.map.cameraPosition;
|
|
16809
16352
|
|
|
16810
16353
|
if ( uCamPos !== undefined ) {
|
|
@@ -16965,17 +16508,8 @@ class WebGLRenderer {
|
|
|
16965
16508
|
|
|
16966
16509
|
// common matrices
|
|
16967
16510
|
|
|
16968
|
-
|
|
16969
|
-
|
|
16970
|
-
multiview.updateObjectMatricesUniforms( object, camera, p_uniforms );
|
|
16971
|
-
|
|
16972
|
-
} else {
|
|
16973
|
-
|
|
16974
|
-
p_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );
|
|
16975
|
-
p_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );
|
|
16976
|
-
|
|
16977
|
-
}
|
|
16978
|
-
|
|
16511
|
+
p_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );
|
|
16512
|
+
p_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );
|
|
16979
16513
|
p_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld );
|
|
16980
16514
|
|
|
16981
16515
|
// UBOs
|
|
@@ -17025,32 +16559,6 @@ class WebGLRenderer {
|
|
|
17025
16559
|
|
|
17026
16560
|
}
|
|
17027
16561
|
|
|
17028
|
-
this.setTexture2D = ( function () {
|
|
17029
|
-
|
|
17030
|
-
var warned = false;
|
|
17031
|
-
|
|
17032
|
-
// backwards compatibility: peel texture.texture
|
|
17033
|
-
return function setTexture2D( texture, slot ) {
|
|
17034
|
-
|
|
17035
|
-
if ( texture && texture.isWebGLRenderTarget ) {
|
|
17036
|
-
|
|
17037
|
-
if ( ! warned ) {
|
|
17038
|
-
|
|
17039
|
-
console.warn( "THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead." );
|
|
17040
|
-
warned = true;
|
|
17041
|
-
|
|
17042
|
-
}
|
|
17043
|
-
|
|
17044
|
-
texture = texture.texture;
|
|
17045
|
-
|
|
17046
|
-
}
|
|
17047
|
-
|
|
17048
|
-
textures.setTexture2D( texture, slot );
|
|
17049
|
-
|
|
17050
|
-
};
|
|
17051
|
-
|
|
17052
|
-
}() );
|
|
17053
|
-
|
|
17054
16562
|
this.getActiveCubeFace = function () {
|
|
17055
16563
|
|
|
17056
16564
|
return _currentActiveCubeFace;
|
|
@@ -17079,7 +16587,7 @@ class WebGLRenderer {
|
|
|
17079
16587
|
|
|
17080
16588
|
renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;
|
|
17081
16589
|
|
|
17082
|
-
if ( ! renderTargetProperties.__autoAllocateDepthBuffer
|
|
16590
|
+
if ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {
|
|
17083
16591
|
|
|
17084
16592
|
// The multisample_render_to_texture extension doesn't work properly if there
|
|
17085
16593
|
// are midframe flushes and an external depth buffer. Disable use of the extension.
|
|
@@ -17105,13 +16613,6 @@ class WebGLRenderer {
|
|
|
17105
16613
|
const _scratchFrameBuffer = _gl.createFramebuffer();
|
|
17106
16614
|
this.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {
|
|
17107
16615
|
|
|
17108
|
-
// Render to base layer instead of canvas in WebXR
|
|
17109
|
-
if ( renderTarget === null && this.xr.isPresenting ) {
|
|
17110
|
-
|
|
17111
|
-
renderTarget = this.xr.getRenderTarget();
|
|
17112
|
-
|
|
17113
|
-
}
|
|
17114
|
-
|
|
17115
16616
|
_currentRenderTarget = renderTarget;
|
|
17116
16617
|
_currentActiveCubeFace = activeCubeFace;
|
|
17117
16618
|
_currentActiveMipmapLevel = activeMipmapLevel;
|