mage-engine 3.23.3 → 3.23.4
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/dist/mage.js +1818 -1998
- package/package.json +1 -1
package/dist/mage.js
CHANGED
|
@@ -39152,7 +39152,7 @@ function LoadingManager( onLoad, onProgress, onError ) {
|
|
|
39152
39152
|
|
|
39153
39153
|
const DefaultLoadingManager = new LoadingManager();
|
|
39154
39154
|
|
|
39155
|
-
function Loader
|
|
39155
|
+
function Loader( manager ) {
|
|
39156
39156
|
|
|
39157
39157
|
this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
|
|
39158
39158
|
|
|
@@ -39164,7 +39164,7 @@ function Loader$1( manager ) {
|
|
|
39164
39164
|
|
|
39165
39165
|
}
|
|
39166
39166
|
|
|
39167
|
-
Object.assign( Loader
|
|
39167
|
+
Object.assign( Loader.prototype, {
|
|
39168
39168
|
|
|
39169
39169
|
load: function ( /* url, onLoad, onProgress, onError */ ) {},
|
|
39170
39170
|
|
|
@@ -39223,11 +39223,11 @@ const loading = {};
|
|
|
39223
39223
|
|
|
39224
39224
|
function FileLoader( manager ) {
|
|
39225
39225
|
|
|
39226
|
-
Loader
|
|
39226
|
+
Loader.call( this, manager );
|
|
39227
39227
|
|
|
39228
39228
|
}
|
|
39229
39229
|
|
|
39230
|
-
FileLoader.prototype = Object.assign( Object.create( Loader
|
|
39230
|
+
FileLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
|
|
39231
39231
|
|
|
39232
39232
|
constructor: FileLoader,
|
|
39233
39233
|
|
|
@@ -39513,7 +39513,7 @@ FileLoader.prototype = Object.assign( Object.create( Loader$1.prototype ), {
|
|
|
39513
39513
|
|
|
39514
39514
|
} );
|
|
39515
39515
|
|
|
39516
|
-
class AnimationLoader extends Loader
|
|
39516
|
+
class AnimationLoader extends Loader {
|
|
39517
39517
|
|
|
39518
39518
|
constructor( manager ) {
|
|
39519
39519
|
|
|
@@ -39581,11 +39581,11 @@ class AnimationLoader extends Loader$1 {
|
|
|
39581
39581
|
|
|
39582
39582
|
function CompressedTextureLoader( manager ) {
|
|
39583
39583
|
|
|
39584
|
-
Loader
|
|
39584
|
+
Loader.call( this, manager );
|
|
39585
39585
|
|
|
39586
39586
|
}
|
|
39587
39587
|
|
|
39588
|
-
CompressedTextureLoader.prototype = Object.assign( Object.create( Loader
|
|
39588
|
+
CompressedTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
|
|
39589
39589
|
|
|
39590
39590
|
constructor: CompressedTextureLoader,
|
|
39591
39591
|
|
|
@@ -39702,7 +39702,7 @@ CompressedTextureLoader.prototype = Object.assign( Object.create( Loader$1.proto
|
|
|
39702
39702
|
|
|
39703
39703
|
} );
|
|
39704
39704
|
|
|
39705
|
-
class ImageLoader extends Loader
|
|
39705
|
+
class ImageLoader extends Loader {
|
|
39706
39706
|
|
|
39707
39707
|
constructor( manager ) {
|
|
39708
39708
|
|
|
@@ -39782,7 +39782,7 @@ class ImageLoader extends Loader$1 {
|
|
|
39782
39782
|
|
|
39783
39783
|
}
|
|
39784
39784
|
|
|
39785
|
-
class CubeTextureLoader extends Loader
|
|
39785
|
+
class CubeTextureLoader extends Loader {
|
|
39786
39786
|
|
|
39787
39787
|
constructor( manager ) {
|
|
39788
39788
|
|
|
@@ -39840,11 +39840,11 @@ class CubeTextureLoader extends Loader$1 {
|
|
|
39840
39840
|
|
|
39841
39841
|
function DataTextureLoader( manager ) {
|
|
39842
39842
|
|
|
39843
|
-
Loader
|
|
39843
|
+
Loader.call( this, manager );
|
|
39844
39844
|
|
|
39845
39845
|
}
|
|
39846
39846
|
|
|
39847
|
-
DataTextureLoader.prototype = Object.assign( Object.create( Loader
|
|
39847
|
+
DataTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
|
|
39848
39848
|
|
|
39849
39849
|
constructor: DataTextureLoader,
|
|
39850
39850
|
|
|
@@ -39937,11 +39937,11 @@ DataTextureLoader.prototype = Object.assign( Object.create( Loader$1.prototype )
|
|
|
39937
39937
|
|
|
39938
39938
|
function TextureLoader( manager ) {
|
|
39939
39939
|
|
|
39940
|
-
Loader
|
|
39940
|
+
Loader.call( this, manager );
|
|
39941
39941
|
|
|
39942
39942
|
}
|
|
39943
39943
|
|
|
39944
|
-
TextureLoader.prototype = Object.assign( Object.create( Loader
|
|
39944
|
+
TextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
|
|
39945
39945
|
|
|
39946
39946
|
constructor: TextureLoader,
|
|
39947
39947
|
|
|
@@ -42894,7 +42894,7 @@ class LightProbe extends Light$2 {
|
|
|
42894
42894
|
|
|
42895
42895
|
LightProbe.prototype.isLightProbe = true;
|
|
42896
42896
|
|
|
42897
|
-
class MaterialLoader extends Loader
|
|
42897
|
+
class MaterialLoader extends Loader {
|
|
42898
42898
|
|
|
42899
42899
|
constructor( manager ) {
|
|
42900
42900
|
|
|
@@ -43318,7 +43318,7 @@ InstancedBufferAttribute.prototype = Object.assign( Object.create( BufferAttribu
|
|
|
43318
43318
|
|
|
43319
43319
|
} );
|
|
43320
43320
|
|
|
43321
|
-
class BufferGeometryLoader extends Loader
|
|
43321
|
+
class BufferGeometryLoader extends Loader {
|
|
43322
43322
|
|
|
43323
43323
|
constructor( manager ) {
|
|
43324
43324
|
|
|
@@ -43520,7 +43520,7 @@ class BufferGeometryLoader extends Loader$1 {
|
|
|
43520
43520
|
|
|
43521
43521
|
}
|
|
43522
43522
|
|
|
43523
|
-
class ObjectLoader extends Loader
|
|
43523
|
+
class ObjectLoader extends Loader {
|
|
43524
43524
|
|
|
43525
43525
|
constructor( manager ) {
|
|
43526
43526
|
|
|
@@ -44647,13 +44647,13 @@ function ImageBitmapLoader( manager ) {
|
|
|
44647
44647
|
|
|
44648
44648
|
}
|
|
44649
44649
|
|
|
44650
|
-
Loader
|
|
44650
|
+
Loader.call( this, manager );
|
|
44651
44651
|
|
|
44652
44652
|
this.options = { premultiplyAlpha: 'none' };
|
|
44653
44653
|
|
|
44654
44654
|
}
|
|
44655
44655
|
|
|
44656
|
-
ImageBitmapLoader.prototype = Object.assign( Object.create( Loader
|
|
44656
|
+
ImageBitmapLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
|
|
44657
44657
|
|
|
44658
44658
|
constructor: ImageBitmapLoader,
|
|
44659
44659
|
|
|
@@ -45158,7 +45158,7 @@ function createPath( char, scale, offsetX, offsetY, data ) {
|
|
|
45158
45158
|
|
|
45159
45159
|
Font.prototype.isFont = true;
|
|
45160
45160
|
|
|
45161
|
-
class FontLoader extends Loader
|
|
45161
|
+
class FontLoader extends Loader {
|
|
45162
45162
|
|
|
45163
45163
|
constructor( manager ) {
|
|
45164
45164
|
|
|
@@ -45229,7 +45229,7 @@ const AudioContext = {
|
|
|
45229
45229
|
|
|
45230
45230
|
};
|
|
45231
45231
|
|
|
45232
|
-
class AudioLoader extends Loader
|
|
45232
|
+
class AudioLoader extends Loader {
|
|
45233
45233
|
|
|
45234
45234
|
constructor( manager ) {
|
|
45235
45235
|
|
|
@@ -52087,14 +52087,14 @@ function WireframeHelper( object, hex ) {
|
|
|
52087
52087
|
|
|
52088
52088
|
//
|
|
52089
52089
|
|
|
52090
|
-
Loader
|
|
52090
|
+
Loader.prototype.extractUrlBase = function ( url ) {
|
|
52091
52091
|
|
|
52092
52092
|
console.warn( 'THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead.' );
|
|
52093
52093
|
return LoaderUtils.extractUrlBase( url );
|
|
52094
52094
|
|
|
52095
52095
|
};
|
|
52096
52096
|
|
|
52097
|
-
Loader
|
|
52097
|
+
Loader.Handlers = {
|
|
52098
52098
|
|
|
52099
52099
|
add: function ( /* regex, loader */ ) {
|
|
52100
52100
|
|
|
@@ -53918,7 +53918,7 @@ if ( typeof window !== 'undefined' ) {
|
|
|
53918
53918
|
|
|
53919
53919
|
}
|
|
53920
53920
|
|
|
53921
|
-
}var three_module=/*#__PURE__*/Object.freeze({__proto__:null,ACESFilmicToneMapping:ACESFilmicToneMapping,AddEquation:AddEquation,AddOperation:AddOperation,AdditiveAnimationBlendMode:AdditiveAnimationBlendMode,AdditiveBlending:AdditiveBlending,AlphaFormat:AlphaFormat,AlwaysDepth:AlwaysDepth,AlwaysStencilFunc:AlwaysStencilFunc,AmbientLight:AmbientLight$1,AmbientLightProbe:AmbientLightProbe,AnimationClip:AnimationClip,AnimationLoader:AnimationLoader,AnimationMixer:AnimationMixer,AnimationObjectGroup:AnimationObjectGroup,AnimationUtils:AnimationUtils,ArcCurve:ArcCurve,ArrayCamera:ArrayCamera,ArrowHelper:ArrowHelper,Audio:Audio$2,AudioAnalyser:AudioAnalyser,AudioContext:AudioContext,AudioListener:AudioListener,AudioLoader:AudioLoader,AxesHelper:AxesHelper$1,AxisHelper:AxisHelper,BackSide:BackSide,BasicDepthPacking:BasicDepthPacking,BasicShadowMap:BasicShadowMap,BinaryTextureLoader:BinaryTextureLoader,Bone:Bone,BooleanKeyframeTrack:BooleanKeyframeTrack,BoundingBoxHelper:BoundingBoxHelper,Box2:Box2,Box3:Box3,Box3Helper:Box3Helper,BoxBufferGeometry:BoxGeometry,BoxGeometry:BoxGeometry,BoxHelper:BoxHelper,BufferAttribute:BufferAttribute,BufferGeometry:BufferGeometry,BufferGeometryLoader:BufferGeometryLoader,ByteType:ByteType,Cache:Cache,Camera:Camera$1,CameraHelper:CameraHelper,CanvasRenderer:CanvasRenderer,CanvasTexture:CanvasTexture,CatmullRomCurve3:CatmullRomCurve3,CineonToneMapping:CineonToneMapping,CircleBufferGeometry:CircleGeometry,CircleGeometry:CircleGeometry,ClampToEdgeWrapping:ClampToEdgeWrapping,Clock:Clock,Color:Color$1,ColorKeyframeTrack:ColorKeyframeTrack,CompressedTexture:CompressedTexture,CompressedTextureLoader:CompressedTextureLoader,ConeBufferGeometry:ConeGeometry,ConeGeometry:ConeGeometry,CubeCamera:CubeCamera,CubeReflectionMapping:CubeReflectionMapping,CubeRefractionMapping:CubeRefractionMapping,CubeTexture:CubeTexture,CubeTextureLoader:CubeTextureLoader,CubeUVReflectionMapping:CubeUVReflectionMapping,CubeUVRefractionMapping:CubeUVRefractionMapping,CubicBezierCurve:CubicBezierCurve,CubicBezierCurve3:CubicBezierCurve3,CubicInterpolant:CubicInterpolant,CullFaceBack:CullFaceBack,CullFaceFront:CullFaceFront,CullFaceFrontBack:CullFaceFrontBack,CullFaceNone:CullFaceNone,Curve:Curve,CurvePath:CurvePath,CustomBlending:CustomBlending,CustomToneMapping:CustomToneMapping,CylinderBufferGeometry:CylinderGeometry,CylinderGeometry:CylinderGeometry,Cylindrical:Cylindrical,DataTexture:DataTexture,DataTexture2DArray:DataTexture2DArray,DataTexture3D:DataTexture3D,DataTextureLoader:DataTextureLoader,DataUtils:DataUtils,DecrementStencilOp:DecrementStencilOp,DecrementWrapStencilOp:DecrementWrapStencilOp,DefaultLoadingManager:DefaultLoadingManager,DepthFormat:DepthFormat,DepthStencilFormat:DepthStencilFormat,DepthTexture:DepthTexture,DirectionalLight:DirectionalLight,DirectionalLightHelper:DirectionalLightHelper,DiscreteInterpolant:DiscreteInterpolant,DodecahedronBufferGeometry:DodecahedronGeometry,DodecahedronGeometry:DodecahedronGeometry,DoubleSide:DoubleSide,DstAlphaFactor:DstAlphaFactor,DstColorFactor:DstColorFactor,DynamicBufferAttribute:DynamicBufferAttribute,DynamicCopyUsage:DynamicCopyUsage,DynamicDrawUsage:DynamicDrawUsage,DynamicReadUsage:DynamicReadUsage,EdgesGeometry:EdgesGeometry,EdgesHelper:EdgesHelper,EllipseCurve:EllipseCurve,EqualDepth:EqualDepth,EqualStencilFunc:EqualStencilFunc,EquirectangularReflectionMapping:EquirectangularReflectionMapping,EquirectangularRefractionMapping:EquirectangularRefractionMapping,Euler:Euler,EventDispatcher:EventDispatcher,ExtrudeBufferGeometry:ExtrudeGeometry,ExtrudeGeometry:ExtrudeGeometry,FaceColors:FaceColors,FileLoader:FileLoader,FlatShading:FlatShading,Float16BufferAttribute:Float16BufferAttribute,Float32Attribute:Float32Attribute,Float32BufferAttribute:Float32BufferAttribute,Float64Attribute:Float64Attribute,Float64BufferAttribute:Float64BufferAttribute,FloatType:FloatType$1,Fog:Fog,FogExp2:FogExp2,Font:Font,FontLoader:FontLoader,FrontSide:FrontSide,Frustum:Frustum$1,GLBufferAttribute:GLBufferAttribute,GLSL1:GLSL1,GLSL3:GLSL3,GammaEncoding:GammaEncoding,GreaterDepth:GreaterDepth,GreaterEqualDepth:GreaterEqualDepth,GreaterEqualStencilFunc:GreaterEqualStencilFunc,GreaterStencilFunc:GreaterStencilFunc,GridHelper:GridHelper,Group:Group,HalfFloatType:HalfFloatType,HemisphereLight:HemisphereLight$1,HemisphereLightHelper:HemisphereLightHelper,HemisphereLightProbe:HemisphereLightProbe,IcosahedronBufferGeometry:IcosahedronGeometry,IcosahedronGeometry:IcosahedronGeometry,ImageBitmapLoader:ImageBitmapLoader,ImageLoader:ImageLoader,ImageUtils:ImageUtils,ImmediateRenderObject:ImmediateRenderObject,IncrementStencilOp:IncrementStencilOp,IncrementWrapStencilOp:IncrementWrapStencilOp,InstancedBufferAttribute:InstancedBufferAttribute,InstancedBufferGeometry:InstancedBufferGeometry,InstancedInterleavedBuffer:InstancedInterleavedBuffer,InstancedMesh:InstancedMesh,Int16Attribute:Int16Attribute,Int16BufferAttribute:Int16BufferAttribute,Int32Attribute:Int32Attribute,Int32BufferAttribute:Int32BufferAttribute,Int8Attribute:Int8Attribute,Int8BufferAttribute:Int8BufferAttribute,IntType:IntType,InterleavedBuffer:InterleavedBuffer,InterleavedBufferAttribute:InterleavedBufferAttribute,Interpolant:Interpolant,InterpolateDiscrete:InterpolateDiscrete,InterpolateLinear:InterpolateLinear,InterpolateSmooth:InterpolateSmooth,InvertStencilOp:InvertStencilOp,JSONLoader:JSONLoader,KeepStencilOp:KeepStencilOp,KeyframeTrack:KeyframeTrack,LOD:LOD,LatheBufferGeometry:LatheGeometry,LatheGeometry:LatheGeometry,Layers:Layers,LensFlare:LensFlare,LessDepth:LessDepth,LessEqualDepth:LessEqualDepth,LessEqualStencilFunc:LessEqualStencilFunc,LessStencilFunc:LessStencilFunc,Light:Light$2,LightProbe:LightProbe,Line:Line$1,Line3:Line3,LineBasicMaterial:LineBasicMaterial,LineCurve:LineCurve,LineCurve3:LineCurve3,LineDashedMaterial:LineDashedMaterial,LineLoop:LineLoop,LinePieces:LinePieces,LineSegments:LineSegments,LineStrip:LineStrip,LinearEncoding:LinearEncoding,LinearFilter:LinearFilter,LinearInterpolant:LinearInterpolant,LinearMipMapLinearFilter:LinearMipMapLinearFilter,LinearMipMapNearestFilter:LinearMipMapNearestFilter,LinearMipmapLinearFilter:LinearMipmapLinearFilter,LinearMipmapNearestFilter:LinearMipmapNearestFilter,LinearToneMapping:LinearToneMapping,Loader:Loader$1,LoaderUtils:LoaderUtils,LoadingManager:LoadingManager,LogLuvEncoding:LogLuvEncoding,LoopOnce:LoopOnce,LoopPingPong:LoopPingPong,LoopRepeat:LoopRepeat,LuminanceAlphaFormat:LuminanceAlphaFormat,LuminanceFormat:LuminanceFormat,MOUSE:MOUSE,Material:Material,MaterialLoader:MaterialLoader,Math:MathUtils,MathUtils:MathUtils,Matrix3:Matrix3,Matrix4:Matrix4,MaxEquation:MaxEquation,Mesh:Mesh,MeshBasicMaterial:MeshBasicMaterial,MeshDepthMaterial:MeshDepthMaterial,MeshDistanceMaterial:MeshDistanceMaterial,MeshFaceMaterial:MeshFaceMaterial,MeshLambertMaterial:MeshLambertMaterial,MeshMatcapMaterial:MeshMatcapMaterial,MeshNormalMaterial:MeshNormalMaterial,MeshPhongMaterial:MeshPhongMaterial,MeshPhysicalMaterial:MeshPhysicalMaterial,MeshStandardMaterial:MeshStandardMaterial,MeshToonMaterial:MeshToonMaterial,MinEquation:MinEquation,MirroredRepeatWrapping:MirroredRepeatWrapping,MixOperation:MixOperation,MultiMaterial:MultiMaterial,MultiplyBlending:MultiplyBlending,MultiplyOperation:MultiplyOperation,NearestFilter:NearestFilter,NearestMipMapLinearFilter:NearestMipMapLinearFilter,NearestMipMapNearestFilter:NearestMipMapNearestFilter,NearestMipmapLinearFilter:NearestMipmapLinearFilter,NearestMipmapNearestFilter:NearestMipmapNearestFilter,NeverDepth:NeverDepth,NeverStencilFunc:NeverStencilFunc,NoBlending:NoBlending,NoColors:NoColors,NoToneMapping:NoToneMapping,NormalAnimationBlendMode:NormalAnimationBlendMode,NormalBlending:NormalBlending,NotEqualDepth:NotEqualDepth,NotEqualStencilFunc:NotEqualStencilFunc,NumberKeyframeTrack:NumberKeyframeTrack,Object3D:Object3D,ObjectLoader:ObjectLoader,ObjectSpaceNormalMap:ObjectSpaceNormalMap,OctahedronBufferGeometry:OctahedronGeometry,OctahedronGeometry:OctahedronGeometry,OneFactor:OneFactor,OneMinusDstAlphaFactor:OneMinusDstAlphaFactor,OneMinusDstColorFactor:OneMinusDstColorFactor,OneMinusSrcAlphaFactor:OneMinusSrcAlphaFactor,OneMinusSrcColorFactor:OneMinusSrcColorFactor,OrthographicCamera:OrthographicCamera,PCFShadowMap:PCFShadowMap,PCFSoftShadowMap:PCFSoftShadowMap,PMREMGenerator:PMREMGenerator,ParametricBufferGeometry:ParametricGeometry,ParametricGeometry:ParametricGeometry,Particle:Particle,ParticleBasicMaterial:ParticleBasicMaterial,ParticleSystem:ParticleSystem,ParticleSystemMaterial:ParticleSystemMaterial,Path:Path,PerspectiveCamera:PerspectiveCamera,Plane:Plane$1,PlaneBufferGeometry:PlaneGeometry,PlaneGeometry:PlaneGeometry,PlaneHelper:PlaneHelper,PointCloud:PointCloud,PointCloudMaterial:PointCloudMaterial,PointLight:PointLight$1,PointLightHelper:PointLightHelper,Points:Points,PointsMaterial:PointsMaterial,PolarGridHelper:PolarGridHelper,PolyhedronBufferGeometry:PolyhedronGeometry,PolyhedronGeometry:PolyhedronGeometry,PositionalAudio:PositionalAudio,PropertyBinding:PropertyBinding,PropertyMixer:PropertyMixer,QuadraticBezierCurve:QuadraticBezierCurve,QuadraticBezierCurve3:QuadraticBezierCurve3,Quaternion:Quaternion,QuaternionKeyframeTrack:QuaternionKeyframeTrack,QuaternionLinearInterpolant:QuaternionLinearInterpolant,REVISION:REVISION,RGBADepthPacking:RGBADepthPacking,RGBAFormat:RGBAFormat,RGBAIntegerFormat:RGBAIntegerFormat,RGBA_ASTC_10x10_Format:RGBA_ASTC_10x10_Format,RGBA_ASTC_10x5_Format:RGBA_ASTC_10x5_Format,RGBA_ASTC_10x6_Format:RGBA_ASTC_10x6_Format,RGBA_ASTC_10x8_Format:RGBA_ASTC_10x8_Format,RGBA_ASTC_12x10_Format:RGBA_ASTC_12x10_Format,RGBA_ASTC_12x12_Format:RGBA_ASTC_12x12_Format,RGBA_ASTC_4x4_Format:RGBA_ASTC_4x4_Format,RGBA_ASTC_5x4_Format:RGBA_ASTC_5x4_Format,RGBA_ASTC_5x5_Format:RGBA_ASTC_5x5_Format,RGBA_ASTC_6x5_Format:RGBA_ASTC_6x5_Format,RGBA_ASTC_6x6_Format:RGBA_ASTC_6x6_Format,RGBA_ASTC_8x5_Format:RGBA_ASTC_8x5_Format,RGBA_ASTC_8x6_Format:RGBA_ASTC_8x6_Format,RGBA_ASTC_8x8_Format:RGBA_ASTC_8x8_Format,RGBA_BPTC_Format:RGBA_BPTC_Format,RGBA_ETC2_EAC_Format:RGBA_ETC2_EAC_Format,RGBA_PVRTC_2BPPV1_Format:RGBA_PVRTC_2BPPV1_Format,RGBA_PVRTC_4BPPV1_Format:RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format:RGBA_S3TC_DXT1_Format,RGBA_S3TC_DXT3_Format:RGBA_S3TC_DXT3_Format,RGBA_S3TC_DXT5_Format:RGBA_S3TC_DXT5_Format,RGBDEncoding:RGBDEncoding,RGBEEncoding:RGBEEncoding,RGBEFormat:RGBEFormat,RGBFormat:RGBFormat,RGBIntegerFormat:RGBIntegerFormat,RGBM16Encoding:RGBM16Encoding,RGBM7Encoding:RGBM7Encoding,RGB_ETC1_Format:RGB_ETC1_Format,RGB_ETC2_Format:RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format:RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format:RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format:RGB_S3TC_DXT1_Format,RGFormat:RGFormat,RGIntegerFormat:RGIntegerFormat,RawShaderMaterial:RawShaderMaterial,Ray:Ray,Raycaster:Raycaster,RectAreaLight:RectAreaLight,RedFormat:RedFormat,RedIntegerFormat:RedIntegerFormat,ReinhardToneMapping:ReinhardToneMapping,RepeatWrapping:RepeatWrapping$1,ReplaceStencilOp:ReplaceStencilOp,ReverseSubtractEquation:ReverseSubtractEquation,RingBufferGeometry:RingGeometry,RingGeometry:RingGeometry,SRGB8_ALPHA8_ASTC_10x10_Format:SRGB8_ALPHA8_ASTC_10x10_Format,SRGB8_ALPHA8_ASTC_10x5_Format:SRGB8_ALPHA8_ASTC_10x5_Format,SRGB8_ALPHA8_ASTC_10x6_Format:SRGB8_ALPHA8_ASTC_10x6_Format,SRGB8_ALPHA8_ASTC_10x8_Format:SRGB8_ALPHA8_ASTC_10x8_Format,SRGB8_ALPHA8_ASTC_12x10_Format:SRGB8_ALPHA8_ASTC_12x10_Format,SRGB8_ALPHA8_ASTC_12x12_Format:SRGB8_ALPHA8_ASTC_12x12_Format,SRGB8_ALPHA8_ASTC_4x4_Format:SRGB8_ALPHA8_ASTC_4x4_Format,SRGB8_ALPHA8_ASTC_5x4_Format:SRGB8_ALPHA8_ASTC_5x4_Format,SRGB8_ALPHA8_ASTC_5x5_Format:SRGB8_ALPHA8_ASTC_5x5_Format,SRGB8_ALPHA8_ASTC_6x5_Format:SRGB8_ALPHA8_ASTC_6x5_Format,SRGB8_ALPHA8_ASTC_6x6_Format:SRGB8_ALPHA8_ASTC_6x6_Format,SRGB8_ALPHA8_ASTC_8x5_Format:SRGB8_ALPHA8_ASTC_8x5_Format,SRGB8_ALPHA8_ASTC_8x6_Format:SRGB8_ALPHA8_ASTC_8x6_Format,SRGB8_ALPHA8_ASTC_8x8_Format:SRGB8_ALPHA8_ASTC_8x8_Format,Scene:Scene$2,SceneUtils:SceneUtils,ShaderChunk:ShaderChunk,ShaderLib:ShaderLib,ShaderMaterial:ShaderMaterial,ShadowMaterial:ShadowMaterial,Shape:Shape,ShapeBufferGeometry:ShapeGeometry,ShapeGeometry:ShapeGeometry,ShapePath:ShapePath,ShapeUtils:ShapeUtils,ShortType:ShortType,Skeleton:Skeleton,SkeletonHelper:SkeletonHelper,SkinnedMesh:SkinnedMesh,SmoothShading:SmoothShading,Sphere:Sphere$1,SphereBufferGeometry:SphereGeometry,SphereGeometry:SphereGeometry,Spherical:Spherical,SphericalHarmonics3:SphericalHarmonics3,SplineCurve:SplineCurve,SpotLight:SpotLight$1,SpotLightHelper:SpotLightHelper,Sprite:Sprite$1,SpriteMaterial:SpriteMaterial,SrcAlphaFactor:SrcAlphaFactor,SrcAlphaSaturateFactor:SrcAlphaSaturateFactor,SrcColorFactor:SrcColorFactor,StaticCopyUsage:StaticCopyUsage,StaticDrawUsage:StaticDrawUsage,StaticReadUsage:StaticReadUsage,StereoCamera:StereoCamera,StreamCopyUsage:StreamCopyUsage,StreamDrawUsage:StreamDrawUsage,StreamReadUsage:StreamReadUsage,StringKeyframeTrack:StringKeyframeTrack,SubtractEquation:SubtractEquation,SubtractiveBlending:SubtractiveBlending,TOUCH:TOUCH,TangentSpaceNormalMap:TangentSpaceNormalMap,TetrahedronBufferGeometry:TetrahedronGeometry,TetrahedronGeometry:TetrahedronGeometry,TextBufferGeometry:TextGeometry,TextGeometry:TextGeometry,Texture:Texture,TextureLoader:TextureLoader,TorusBufferGeometry:TorusGeometry,TorusGeometry:TorusGeometry,TorusKnotBufferGeometry:TorusKnotGeometry,TorusKnotGeometry:TorusKnotGeometry,Triangle:Triangle,TriangleFanDrawMode:TriangleFanDrawMode,TriangleStripDrawMode:TriangleStripDrawMode,TrianglesDrawMode:TrianglesDrawMode,TubeBufferGeometry:TubeGeometry,TubeGeometry:TubeGeometry,UVMapping:UVMapping,Uint16Attribute:Uint16Attribute,Uint16BufferAttribute:Uint16BufferAttribute,Uint32Attribute:Uint32Attribute,Uint32BufferAttribute:Uint32BufferAttribute,Uint8Attribute:Uint8Attribute,Uint8BufferAttribute:Uint8BufferAttribute,Uint8ClampedAttribute:Uint8ClampedAttribute,Uint8ClampedBufferAttribute:Uint8ClampedBufferAttribute,Uniform:Uniform,UniformsLib:UniformsLib,UniformsUtils:UniformsUtils,UnsignedByteType:UnsignedByteType,UnsignedInt248Type:UnsignedInt248Type,UnsignedIntType:UnsignedIntType,UnsignedShort4444Type:UnsignedShort4444Type,UnsignedShort5551Type:UnsignedShort5551Type,UnsignedShort565Type:UnsignedShort565Type,UnsignedShortType:UnsignedShortType,VSMShadowMap:VSMShadowMap,Vector2:Vector2,Vector3:Vector3$1,Vector4:Vector4,VectorKeyframeTrack:VectorKeyframeTrack,Vertex:Vertex,VertexColors:VertexColors,VideoTexture:VideoTexture,WebGL1Renderer:WebGL1Renderer,WebGLCubeRenderTarget:WebGLCubeRenderTarget,WebGLMultisampleRenderTarget:WebGLMultisampleRenderTarget,WebGLRenderTarget:WebGLRenderTarget,WebGLRenderTargetCube:WebGLRenderTargetCube,WebGLRenderer:WebGLRenderer,WebGLUtils:WebGLUtils,WireframeGeometry:WireframeGeometry,WireframeHelper:WireframeHelper,WrapAroundEnding:WrapAroundEnding,XHRLoader:XHRLoader,ZeroCurvatureEnding:ZeroCurvatureEnding,ZeroFactor:ZeroFactor,ZeroSlopeEnding:ZeroSlopeEnding,ZeroStencilOp:ZeroStencilOp,sRGBEncoding:sRGBEncoding});var PREFIX = "[Mage]";
|
|
53921
|
+
}var three_module=/*#__PURE__*/Object.freeze({__proto__:null,ACESFilmicToneMapping:ACESFilmicToneMapping,AddEquation:AddEquation,AddOperation:AddOperation,AdditiveAnimationBlendMode:AdditiveAnimationBlendMode,AdditiveBlending:AdditiveBlending,AlphaFormat:AlphaFormat,AlwaysDepth:AlwaysDepth,AlwaysStencilFunc:AlwaysStencilFunc,AmbientLight:AmbientLight$1,AmbientLightProbe:AmbientLightProbe,AnimationClip:AnimationClip,AnimationLoader:AnimationLoader,AnimationMixer:AnimationMixer,AnimationObjectGroup:AnimationObjectGroup,AnimationUtils:AnimationUtils,ArcCurve:ArcCurve,ArrayCamera:ArrayCamera,ArrowHelper:ArrowHelper,Audio:Audio$2,AudioAnalyser:AudioAnalyser,AudioContext:AudioContext,AudioListener:AudioListener,AudioLoader:AudioLoader,AxesHelper:AxesHelper$1,AxisHelper:AxisHelper,BackSide:BackSide,BasicDepthPacking:BasicDepthPacking,BasicShadowMap:BasicShadowMap,BinaryTextureLoader:BinaryTextureLoader,Bone:Bone,BooleanKeyframeTrack:BooleanKeyframeTrack,BoundingBoxHelper:BoundingBoxHelper,Box2:Box2,Box3:Box3,Box3Helper:Box3Helper,BoxBufferGeometry:BoxGeometry,BoxGeometry:BoxGeometry,BoxHelper:BoxHelper,BufferAttribute:BufferAttribute,BufferGeometry:BufferGeometry,BufferGeometryLoader:BufferGeometryLoader,ByteType:ByteType,Cache:Cache,Camera:Camera$1,CameraHelper:CameraHelper,CanvasRenderer:CanvasRenderer,CanvasTexture:CanvasTexture,CatmullRomCurve3:CatmullRomCurve3,CineonToneMapping:CineonToneMapping,CircleBufferGeometry:CircleGeometry,CircleGeometry:CircleGeometry,ClampToEdgeWrapping:ClampToEdgeWrapping,Clock:Clock,Color:Color$1,ColorKeyframeTrack:ColorKeyframeTrack,CompressedTexture:CompressedTexture,CompressedTextureLoader:CompressedTextureLoader,ConeBufferGeometry:ConeGeometry,ConeGeometry:ConeGeometry,CubeCamera:CubeCamera,CubeReflectionMapping:CubeReflectionMapping,CubeRefractionMapping:CubeRefractionMapping,CubeTexture:CubeTexture,CubeTextureLoader:CubeTextureLoader,CubeUVReflectionMapping:CubeUVReflectionMapping,CubeUVRefractionMapping:CubeUVRefractionMapping,CubicBezierCurve:CubicBezierCurve,CubicBezierCurve3:CubicBezierCurve3,CubicInterpolant:CubicInterpolant,CullFaceBack:CullFaceBack,CullFaceFront:CullFaceFront,CullFaceFrontBack:CullFaceFrontBack,CullFaceNone:CullFaceNone,Curve:Curve,CurvePath:CurvePath,CustomBlending:CustomBlending,CustomToneMapping:CustomToneMapping,CylinderBufferGeometry:CylinderGeometry,CylinderGeometry:CylinderGeometry,Cylindrical:Cylindrical,DataTexture:DataTexture,DataTexture2DArray:DataTexture2DArray,DataTexture3D:DataTexture3D,DataTextureLoader:DataTextureLoader,DataUtils:DataUtils,DecrementStencilOp:DecrementStencilOp,DecrementWrapStencilOp:DecrementWrapStencilOp,DefaultLoadingManager:DefaultLoadingManager,DepthFormat:DepthFormat,DepthStencilFormat:DepthStencilFormat,DepthTexture:DepthTexture,DirectionalLight:DirectionalLight,DirectionalLightHelper:DirectionalLightHelper,DiscreteInterpolant:DiscreteInterpolant,DodecahedronBufferGeometry:DodecahedronGeometry,DodecahedronGeometry:DodecahedronGeometry,DoubleSide:DoubleSide,DstAlphaFactor:DstAlphaFactor,DstColorFactor:DstColorFactor,DynamicBufferAttribute:DynamicBufferAttribute,DynamicCopyUsage:DynamicCopyUsage,DynamicDrawUsage:DynamicDrawUsage,DynamicReadUsage:DynamicReadUsage,EdgesGeometry:EdgesGeometry,EdgesHelper:EdgesHelper,EllipseCurve:EllipseCurve,EqualDepth:EqualDepth,EqualStencilFunc:EqualStencilFunc,EquirectangularReflectionMapping:EquirectangularReflectionMapping,EquirectangularRefractionMapping:EquirectangularRefractionMapping,Euler:Euler,EventDispatcher:EventDispatcher,ExtrudeBufferGeometry:ExtrudeGeometry,ExtrudeGeometry:ExtrudeGeometry,FaceColors:FaceColors,FileLoader:FileLoader,FlatShading:FlatShading,Float16BufferAttribute:Float16BufferAttribute,Float32Attribute:Float32Attribute,Float32BufferAttribute:Float32BufferAttribute,Float64Attribute:Float64Attribute,Float64BufferAttribute:Float64BufferAttribute,FloatType:FloatType$1,Fog:Fog,FogExp2:FogExp2,Font:Font,FontLoader:FontLoader,FrontSide:FrontSide,Frustum:Frustum$1,GLBufferAttribute:GLBufferAttribute,GLSL1:GLSL1,GLSL3:GLSL3,GammaEncoding:GammaEncoding,GreaterDepth:GreaterDepth,GreaterEqualDepth:GreaterEqualDepth,GreaterEqualStencilFunc:GreaterEqualStencilFunc,GreaterStencilFunc:GreaterStencilFunc,GridHelper:GridHelper,Group:Group,HalfFloatType:HalfFloatType,HemisphereLight:HemisphereLight$1,HemisphereLightHelper:HemisphereLightHelper,HemisphereLightProbe:HemisphereLightProbe,IcosahedronBufferGeometry:IcosahedronGeometry,IcosahedronGeometry:IcosahedronGeometry,ImageBitmapLoader:ImageBitmapLoader,ImageLoader:ImageLoader,ImageUtils:ImageUtils,ImmediateRenderObject:ImmediateRenderObject,IncrementStencilOp:IncrementStencilOp,IncrementWrapStencilOp:IncrementWrapStencilOp,InstancedBufferAttribute:InstancedBufferAttribute,InstancedBufferGeometry:InstancedBufferGeometry,InstancedInterleavedBuffer:InstancedInterleavedBuffer,InstancedMesh:InstancedMesh,Int16Attribute:Int16Attribute,Int16BufferAttribute:Int16BufferAttribute,Int32Attribute:Int32Attribute,Int32BufferAttribute:Int32BufferAttribute,Int8Attribute:Int8Attribute,Int8BufferAttribute:Int8BufferAttribute,IntType:IntType,InterleavedBuffer:InterleavedBuffer,InterleavedBufferAttribute:InterleavedBufferAttribute,Interpolant:Interpolant,InterpolateDiscrete:InterpolateDiscrete,InterpolateLinear:InterpolateLinear,InterpolateSmooth:InterpolateSmooth,InvertStencilOp:InvertStencilOp,JSONLoader:JSONLoader,KeepStencilOp:KeepStencilOp,KeyframeTrack:KeyframeTrack,LOD:LOD,LatheBufferGeometry:LatheGeometry,LatheGeometry:LatheGeometry,Layers:Layers,LensFlare:LensFlare,LessDepth:LessDepth,LessEqualDepth:LessEqualDepth,LessEqualStencilFunc:LessEqualStencilFunc,LessStencilFunc:LessStencilFunc,Light:Light$2,LightProbe:LightProbe,Line:Line$1,Line3:Line3,LineBasicMaterial:LineBasicMaterial,LineCurve:LineCurve,LineCurve3:LineCurve3,LineDashedMaterial:LineDashedMaterial,LineLoop:LineLoop,LinePieces:LinePieces,LineSegments:LineSegments,LineStrip:LineStrip,LinearEncoding:LinearEncoding,LinearFilter:LinearFilter,LinearInterpolant:LinearInterpolant,LinearMipMapLinearFilter:LinearMipMapLinearFilter,LinearMipMapNearestFilter:LinearMipMapNearestFilter,LinearMipmapLinearFilter:LinearMipmapLinearFilter,LinearMipmapNearestFilter:LinearMipmapNearestFilter,LinearToneMapping:LinearToneMapping,Loader:Loader,LoaderUtils:LoaderUtils,LoadingManager:LoadingManager,LogLuvEncoding:LogLuvEncoding,LoopOnce:LoopOnce,LoopPingPong:LoopPingPong,LoopRepeat:LoopRepeat,LuminanceAlphaFormat:LuminanceAlphaFormat,LuminanceFormat:LuminanceFormat,MOUSE:MOUSE,Material:Material,MaterialLoader:MaterialLoader,Math:MathUtils,MathUtils:MathUtils,Matrix3:Matrix3,Matrix4:Matrix4,MaxEquation:MaxEquation,Mesh:Mesh,MeshBasicMaterial:MeshBasicMaterial,MeshDepthMaterial:MeshDepthMaterial,MeshDistanceMaterial:MeshDistanceMaterial,MeshFaceMaterial:MeshFaceMaterial,MeshLambertMaterial:MeshLambertMaterial,MeshMatcapMaterial:MeshMatcapMaterial,MeshNormalMaterial:MeshNormalMaterial,MeshPhongMaterial:MeshPhongMaterial,MeshPhysicalMaterial:MeshPhysicalMaterial,MeshStandardMaterial:MeshStandardMaterial,MeshToonMaterial:MeshToonMaterial,MinEquation:MinEquation,MirroredRepeatWrapping:MirroredRepeatWrapping,MixOperation:MixOperation,MultiMaterial:MultiMaterial,MultiplyBlending:MultiplyBlending,MultiplyOperation:MultiplyOperation,NearestFilter:NearestFilter,NearestMipMapLinearFilter:NearestMipMapLinearFilter,NearestMipMapNearestFilter:NearestMipMapNearestFilter,NearestMipmapLinearFilter:NearestMipmapLinearFilter,NearestMipmapNearestFilter:NearestMipmapNearestFilter,NeverDepth:NeverDepth,NeverStencilFunc:NeverStencilFunc,NoBlending:NoBlending,NoColors:NoColors,NoToneMapping:NoToneMapping,NormalAnimationBlendMode:NormalAnimationBlendMode,NormalBlending:NormalBlending,NotEqualDepth:NotEqualDepth,NotEqualStencilFunc:NotEqualStencilFunc,NumberKeyframeTrack:NumberKeyframeTrack,Object3D:Object3D,ObjectLoader:ObjectLoader,ObjectSpaceNormalMap:ObjectSpaceNormalMap,OctahedronBufferGeometry:OctahedronGeometry,OctahedronGeometry:OctahedronGeometry,OneFactor:OneFactor,OneMinusDstAlphaFactor:OneMinusDstAlphaFactor,OneMinusDstColorFactor:OneMinusDstColorFactor,OneMinusSrcAlphaFactor:OneMinusSrcAlphaFactor,OneMinusSrcColorFactor:OneMinusSrcColorFactor,OrthographicCamera:OrthographicCamera,PCFShadowMap:PCFShadowMap,PCFSoftShadowMap:PCFSoftShadowMap,PMREMGenerator:PMREMGenerator,ParametricBufferGeometry:ParametricGeometry,ParametricGeometry:ParametricGeometry,Particle:Particle,ParticleBasicMaterial:ParticleBasicMaterial,ParticleSystem:ParticleSystem,ParticleSystemMaterial:ParticleSystemMaterial,Path:Path,PerspectiveCamera:PerspectiveCamera,Plane:Plane$1,PlaneBufferGeometry:PlaneGeometry,PlaneGeometry:PlaneGeometry,PlaneHelper:PlaneHelper,PointCloud:PointCloud,PointCloudMaterial:PointCloudMaterial,PointLight:PointLight$1,PointLightHelper:PointLightHelper,Points:Points,PointsMaterial:PointsMaterial,PolarGridHelper:PolarGridHelper,PolyhedronBufferGeometry:PolyhedronGeometry,PolyhedronGeometry:PolyhedronGeometry,PositionalAudio:PositionalAudio,PropertyBinding:PropertyBinding,PropertyMixer:PropertyMixer,QuadraticBezierCurve:QuadraticBezierCurve,QuadraticBezierCurve3:QuadraticBezierCurve3,Quaternion:Quaternion,QuaternionKeyframeTrack:QuaternionKeyframeTrack,QuaternionLinearInterpolant:QuaternionLinearInterpolant,REVISION:REVISION,RGBADepthPacking:RGBADepthPacking,RGBAFormat:RGBAFormat,RGBAIntegerFormat:RGBAIntegerFormat,RGBA_ASTC_10x10_Format:RGBA_ASTC_10x10_Format,RGBA_ASTC_10x5_Format:RGBA_ASTC_10x5_Format,RGBA_ASTC_10x6_Format:RGBA_ASTC_10x6_Format,RGBA_ASTC_10x8_Format:RGBA_ASTC_10x8_Format,RGBA_ASTC_12x10_Format:RGBA_ASTC_12x10_Format,RGBA_ASTC_12x12_Format:RGBA_ASTC_12x12_Format,RGBA_ASTC_4x4_Format:RGBA_ASTC_4x4_Format,RGBA_ASTC_5x4_Format:RGBA_ASTC_5x4_Format,RGBA_ASTC_5x5_Format:RGBA_ASTC_5x5_Format,RGBA_ASTC_6x5_Format:RGBA_ASTC_6x5_Format,RGBA_ASTC_6x6_Format:RGBA_ASTC_6x6_Format,RGBA_ASTC_8x5_Format:RGBA_ASTC_8x5_Format,RGBA_ASTC_8x6_Format:RGBA_ASTC_8x6_Format,RGBA_ASTC_8x8_Format:RGBA_ASTC_8x8_Format,RGBA_BPTC_Format:RGBA_BPTC_Format,RGBA_ETC2_EAC_Format:RGBA_ETC2_EAC_Format,RGBA_PVRTC_2BPPV1_Format:RGBA_PVRTC_2BPPV1_Format,RGBA_PVRTC_4BPPV1_Format:RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format:RGBA_S3TC_DXT1_Format,RGBA_S3TC_DXT3_Format:RGBA_S3TC_DXT3_Format,RGBA_S3TC_DXT5_Format:RGBA_S3TC_DXT5_Format,RGBDEncoding:RGBDEncoding,RGBEEncoding:RGBEEncoding,RGBEFormat:RGBEFormat,RGBFormat:RGBFormat,RGBIntegerFormat:RGBIntegerFormat,RGBM16Encoding:RGBM16Encoding,RGBM7Encoding:RGBM7Encoding,RGB_ETC1_Format:RGB_ETC1_Format,RGB_ETC2_Format:RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format:RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format:RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format:RGB_S3TC_DXT1_Format,RGFormat:RGFormat,RGIntegerFormat:RGIntegerFormat,RawShaderMaterial:RawShaderMaterial,Ray:Ray,Raycaster:Raycaster,RectAreaLight:RectAreaLight,RedFormat:RedFormat,RedIntegerFormat:RedIntegerFormat,ReinhardToneMapping:ReinhardToneMapping,RepeatWrapping:RepeatWrapping$1,ReplaceStencilOp:ReplaceStencilOp,ReverseSubtractEquation:ReverseSubtractEquation,RingBufferGeometry:RingGeometry,RingGeometry:RingGeometry,SRGB8_ALPHA8_ASTC_10x10_Format:SRGB8_ALPHA8_ASTC_10x10_Format,SRGB8_ALPHA8_ASTC_10x5_Format:SRGB8_ALPHA8_ASTC_10x5_Format,SRGB8_ALPHA8_ASTC_10x6_Format:SRGB8_ALPHA8_ASTC_10x6_Format,SRGB8_ALPHA8_ASTC_10x8_Format:SRGB8_ALPHA8_ASTC_10x8_Format,SRGB8_ALPHA8_ASTC_12x10_Format:SRGB8_ALPHA8_ASTC_12x10_Format,SRGB8_ALPHA8_ASTC_12x12_Format:SRGB8_ALPHA8_ASTC_12x12_Format,SRGB8_ALPHA8_ASTC_4x4_Format:SRGB8_ALPHA8_ASTC_4x4_Format,SRGB8_ALPHA8_ASTC_5x4_Format:SRGB8_ALPHA8_ASTC_5x4_Format,SRGB8_ALPHA8_ASTC_5x5_Format:SRGB8_ALPHA8_ASTC_5x5_Format,SRGB8_ALPHA8_ASTC_6x5_Format:SRGB8_ALPHA8_ASTC_6x5_Format,SRGB8_ALPHA8_ASTC_6x6_Format:SRGB8_ALPHA8_ASTC_6x6_Format,SRGB8_ALPHA8_ASTC_8x5_Format:SRGB8_ALPHA8_ASTC_8x5_Format,SRGB8_ALPHA8_ASTC_8x6_Format:SRGB8_ALPHA8_ASTC_8x6_Format,SRGB8_ALPHA8_ASTC_8x8_Format:SRGB8_ALPHA8_ASTC_8x8_Format,Scene:Scene$2,SceneUtils:SceneUtils,ShaderChunk:ShaderChunk,ShaderLib:ShaderLib,ShaderMaterial:ShaderMaterial,ShadowMaterial:ShadowMaterial,Shape:Shape,ShapeBufferGeometry:ShapeGeometry,ShapeGeometry:ShapeGeometry,ShapePath:ShapePath,ShapeUtils:ShapeUtils,ShortType:ShortType,Skeleton:Skeleton,SkeletonHelper:SkeletonHelper,SkinnedMesh:SkinnedMesh,SmoothShading:SmoothShading,Sphere:Sphere$1,SphereBufferGeometry:SphereGeometry,SphereGeometry:SphereGeometry,Spherical:Spherical,SphericalHarmonics3:SphericalHarmonics3,SplineCurve:SplineCurve,SpotLight:SpotLight$1,SpotLightHelper:SpotLightHelper,Sprite:Sprite$1,SpriteMaterial:SpriteMaterial,SrcAlphaFactor:SrcAlphaFactor,SrcAlphaSaturateFactor:SrcAlphaSaturateFactor,SrcColorFactor:SrcColorFactor,StaticCopyUsage:StaticCopyUsage,StaticDrawUsage:StaticDrawUsage,StaticReadUsage:StaticReadUsage,StereoCamera:StereoCamera,StreamCopyUsage:StreamCopyUsage,StreamDrawUsage:StreamDrawUsage,StreamReadUsage:StreamReadUsage,StringKeyframeTrack:StringKeyframeTrack,SubtractEquation:SubtractEquation,SubtractiveBlending:SubtractiveBlending,TOUCH:TOUCH,TangentSpaceNormalMap:TangentSpaceNormalMap,TetrahedronBufferGeometry:TetrahedronGeometry,TetrahedronGeometry:TetrahedronGeometry,TextBufferGeometry:TextGeometry,TextGeometry:TextGeometry,Texture:Texture,TextureLoader:TextureLoader,TorusBufferGeometry:TorusGeometry,TorusGeometry:TorusGeometry,TorusKnotBufferGeometry:TorusKnotGeometry,TorusKnotGeometry:TorusKnotGeometry,Triangle:Triangle,TriangleFanDrawMode:TriangleFanDrawMode,TriangleStripDrawMode:TriangleStripDrawMode,TrianglesDrawMode:TrianglesDrawMode,TubeBufferGeometry:TubeGeometry,TubeGeometry:TubeGeometry,UVMapping:UVMapping,Uint16Attribute:Uint16Attribute,Uint16BufferAttribute:Uint16BufferAttribute,Uint32Attribute:Uint32Attribute,Uint32BufferAttribute:Uint32BufferAttribute,Uint8Attribute:Uint8Attribute,Uint8BufferAttribute:Uint8BufferAttribute,Uint8ClampedAttribute:Uint8ClampedAttribute,Uint8ClampedBufferAttribute:Uint8ClampedBufferAttribute,Uniform:Uniform,UniformsLib:UniformsLib,UniformsUtils:UniformsUtils,UnsignedByteType:UnsignedByteType,UnsignedInt248Type:UnsignedInt248Type,UnsignedIntType:UnsignedIntType,UnsignedShort4444Type:UnsignedShort4444Type,UnsignedShort5551Type:UnsignedShort5551Type,UnsignedShort565Type:UnsignedShort565Type,UnsignedShortType:UnsignedShortType,VSMShadowMap:VSMShadowMap,Vector2:Vector2,Vector3:Vector3$1,Vector4:Vector4,VectorKeyframeTrack:VectorKeyframeTrack,Vertex:Vertex,VertexColors:VertexColors,VideoTexture:VideoTexture,WebGL1Renderer:WebGL1Renderer,WebGLCubeRenderTarget:WebGLCubeRenderTarget,WebGLMultisampleRenderTarget:WebGLMultisampleRenderTarget,WebGLRenderTarget:WebGLRenderTarget,WebGLRenderTargetCube:WebGLRenderTargetCube,WebGLRenderer:WebGLRenderer,WebGLUtils:WebGLUtils,WireframeGeometry:WireframeGeometry,WireframeHelper:WireframeHelper,WrapAroundEnding:WrapAroundEnding,XHRLoader:XHRLoader,ZeroCurvatureEnding:ZeroCurvatureEnding,ZeroFactor:ZeroFactor,ZeroSlopeEnding:ZeroSlopeEnding,ZeroStencilOp:ZeroStencilOp,sRGBEncoding:sRGBEncoding});var PREFIX = "[Mage]";
|
|
53922
53922
|
var DEPRECATED = "[DEPRECATED]";
|
|
53923
53923
|
var DEPRECATIONS = {
|
|
53924
53924
|
PARTICLES_ADD_PARTICLE_EMITTER: "".concat(PREFIX, " ").concat(DEPRECATED, " Particles.addParticleEmitter is deprecated, use Particles.add instead. Will be removed in the next major release"),
|
|
@@ -55854,7 +55854,7 @@ var convertAmmoVector = function convertAmmoVector(_ref2) {
|
|
|
55854
55854
|
};
|
|
55855
55855
|
};var utils=/*#__PURE__*/Object.freeze({__proto__:null,DEFAULT_DESCRIPTION:DEFAULT_DESCRIPTION$1,mapColliderTypeToAddEvent:mapColliderTypeToAddEvent$1,extractBoundingBox:extractBoundingBox,extractBiggestBoundingBox:extractBiggestBoundingBox,extractBoundingSphere:extractBoundingSphere,extractBiggestBoundingSphere:extractBiggestBoundingSphere,parseBoundingBoxSize:parseBoundingBoxSize,extractPositionAndQuaternion:extractPositionAndQuaternion$1,extractBoxDescription:extractBoxDescription,extractSphereDescription:extractSphereDescription,getBoxDescriptionForElement:getBoxDescriptionForElement$1,getSphereDescriptionForElement:getSphereDescriptionForElement,mapColliderTypeToDescription:mapColliderTypeToDescription$1,iterateGeometries:iterateGeometries$1,convertAmmoVector:convertAmmoVector});var getHostURL = function getHostURL() {
|
|
55856
55856
|
return "".concat(document.location.protocol, "//").concat(document.location.host);
|
|
55857
|
-
};var _excluded$
|
|
55857
|
+
};var _excluded$9 = ["uuid"];
|
|
55858
55858
|
var COLLIDER_TYPES = COLLIDER_TYPES$1;
|
|
55859
55859
|
var getBoxDescriptionForElement = getBoxDescriptionForElement$1,
|
|
55860
55860
|
extractPositionAndQuaternion = extractPositionAndQuaternion$1,
|
|
@@ -55928,7 +55928,7 @@ var Physics = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
55928
55928
|
|
|
55929
55929
|
_defineProperty$1(_assertThisInitialized(_this), "handleBodyUpdate", function (_ref3) {
|
|
55930
55930
|
var uuid = _ref3.uuid,
|
|
55931
|
-
data = _objectWithoutProperties(_ref3, _excluded$
|
|
55931
|
+
data = _objectWithoutProperties(_ref3, _excluded$9);
|
|
55932
55932
|
|
|
55933
55933
|
var element = Universe$1.getByUUID(uuid);
|
|
55934
55934
|
|
|
@@ -57777,7 +57777,7 @@ function applyMiddleware() {
|
|
|
57777
57777
|
|
|
57778
57778
|
var thunk = createThunkMiddleware();
|
|
57779
57779
|
thunk.withExtraArgument = createThunkMiddleware;var name$1 = "mage-engine";
|
|
57780
|
-
var version$1 = "3.23.
|
|
57780
|
+
var version$1 = "3.23.4";
|
|
57781
57781
|
var description = "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.";
|
|
57782
57782
|
var main = "dist/mage.js";
|
|
57783
57783
|
var author$1 = {
|
|
@@ -59046,7 +59046,7 @@ if (!self.fetch) {
|
|
|
59046
59046
|
self.Headers = Headers;
|
|
59047
59047
|
self.Request = Request;
|
|
59048
59048
|
self.Response = Response;
|
|
59049
|
-
}var _excluded$
|
|
59049
|
+
}var _excluded$8 = ["wheels", "accelerationKey", "brakingKey", "rightKey", "leftKey", "debug", "autostart"];
|
|
59050
59050
|
|
|
59051
59051
|
var BaseCar = /*#__PURE__*/function (_BaseScript) {
|
|
59052
59052
|
_inherits(BaseCar, _BaseScript);
|
|
@@ -59074,7 +59074,7 @@ var BaseCar = /*#__PURE__*/function (_BaseScript) {
|
|
|
59074
59074
|
options.debug;
|
|
59075
59075
|
var _options$autostart = options.autostart,
|
|
59076
59076
|
autostart = _options$autostart === void 0 ? true : _options$autostart,
|
|
59077
|
-
physicsOptions = _objectWithoutProperties(options, _excluded$
|
|
59077
|
+
physicsOptions = _objectWithoutProperties(options, _excluded$8);
|
|
59078
59078
|
|
|
59079
59079
|
this.car = element;
|
|
59080
59080
|
this.wheels = wheels;
|
|
@@ -59762,10 +59762,7 @@ var CascadeShadowMaps = /*#__PURE__*/function () {
|
|
|
59762
59762
|
}]);
|
|
59763
59763
|
|
|
59764
59764
|
return CascadeShadowMaps;
|
|
59765
|
-
}();var
|
|
59766
|
-
var AMBIENTLIGHT = 'ambientlight';
|
|
59767
|
-
var SUNLIGHT = 'sunlight';
|
|
59768
|
-
var Lights = /*#__PURE__*/function () {
|
|
59765
|
+
}();var Lights = /*#__PURE__*/function () {
|
|
59769
59766
|
function Lights() {
|
|
59770
59767
|
_classCallCheck(this, Lights);
|
|
59771
59768
|
|
|
@@ -61102,7 +61099,7 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
61102
61099
|
}(EventDispatcher);var _MATERIAL_TEXTURE_MAP;
|
|
61103
61100
|
var MATERIAL_TEXTURE_MAP = (_MATERIAL_TEXTURE_MAP = {}, _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.BASIC, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.ENV, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.SPECULAR]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.LAMBERT, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.ENV, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.SPECULAR, TEXTURES.EMISSIVE]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.PHONG, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.ENV, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.SPECULAR, TEXTURES.EMISSIVE, TEXTURES.BUMP, TEXTURES.DISPLACEMENT, TEXTURES.NORMAL]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.DEPTH, [TEXTURES.ALPHA, TEXTURES.MAP, TEXTURES.DISPLACEMENT]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.STANDARD, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.ENV, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.EMISSIVE, TEXTURES.BUMP, TEXTURES.DISPLACEMENT, TEXTURES.NORMAL, TEXTURES.METALNESS, TEXTURES.ROUGHNESS]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.THREE_TOON, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.BUMP, TEXTURES.DISPLACEMENT, TEXTURES.EMISSIVE, TEXTURES.GRADIENT, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.NORMAL]), _MATERIAL_TEXTURE_MAP);var material_constants=/*#__PURE__*/Object.freeze({__proto__:null,MATERIAL_TEXTURE_MAP:MATERIAL_TEXTURE_MAP});var isTextureMapAllowedForMaterial = function isTextureMapAllowedForMaterial(materialType, textureType) {
|
|
61104
61101
|
return MATERIAL_TEXTURE_MAP[materialType] && MATERIAL_TEXTURE_MAP[materialType].includes(textureType);
|
|
61105
|
-
};var _excluded$
|
|
61102
|
+
};var _excluded$7 = ["position", "quaternion"],
|
|
61106
61103
|
_excluded2 = ["applyPhysicsUpdate"],
|
|
61107
61104
|
_excluded3 = ["dt", "event"];
|
|
61108
61105
|
var COLLIDER_TAG = "collider";
|
|
@@ -61292,7 +61289,7 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
61292
61289
|
_defineProperty$1(_assertThisInitialized(_this), "handlePhysicsUpdate", function (_ref6) {
|
|
61293
61290
|
var position = _ref6.position,
|
|
61294
61291
|
quaternion = _ref6.quaternion,
|
|
61295
|
-
data = _objectWithoutProperties(_ref6, _excluded$
|
|
61292
|
+
data = _objectWithoutProperties(_ref6, _excluded$7);
|
|
61296
61293
|
|
|
61297
61294
|
_this.setPosition(position);
|
|
61298
61295
|
|
|
@@ -62431,7 +62428,7 @@ var Plane = /*#__PURE__*/function (_Element) {
|
|
|
62431
62428
|
}
|
|
62432
62429
|
|
|
62433
62430
|
return Box;
|
|
62434
|
-
}(Element$1);var _excluded$
|
|
62431
|
+
}(Element$1);var _excluded$6 = ["anisotropy"];
|
|
62435
62432
|
|
|
62436
62433
|
var validateAnisotropy = function validateAnisotropy(anisotropy) {
|
|
62437
62434
|
var max = Scene$1.getRenderer().capabilities.getMaxAnisotropy();
|
|
@@ -62457,7 +62454,7 @@ var Sprite = /*#__PURE__*/function (_Element) {
|
|
|
62457
62454
|
|
|
62458
62455
|
var _options$anisotropy = options.anisotropy,
|
|
62459
62456
|
anisotropy = _options$anisotropy === void 0 ? 1 : _options$anisotropy,
|
|
62460
|
-
rest = _objectWithoutProperties(options, _excluded$
|
|
62457
|
+
rest = _objectWithoutProperties(options, _excluded$6);
|
|
62461
62458
|
|
|
62462
62459
|
var texture = Images$1.get(spriteTexture);
|
|
62463
62460
|
texture.anisotropy = validateAnisotropy(anisotropy);
|
|
@@ -69042,13 +69039,13 @@ var RequirementsTracer = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
69042
69039
|
|
|
69043
69040
|
var GLTFLoader = function () {
|
|
69044
69041
|
function GLTFLoader(manager) {
|
|
69045
|
-
Loader
|
|
69042
|
+
Loader.call(this, manager);
|
|
69046
69043
|
this.dracoLoader = null;
|
|
69047
69044
|
this.ddsLoader = null;
|
|
69048
69045
|
this.options = {};
|
|
69049
69046
|
}
|
|
69050
69047
|
|
|
69051
|
-
GLTFLoader.prototype = Object.assign(Object.create(Loader
|
|
69048
|
+
GLTFLoader.prototype = Object.assign(Object.create(Loader.prototype), {
|
|
69052
69049
|
constructor: GLTFLoader,
|
|
69053
69050
|
setOptions: function setOptions(options) {
|
|
69054
69051
|
this.options = options || {};
|
|
@@ -74656,7 +74653,9 @@ var NURBSCurve = /*#__PURE__*/function (_Curve) {
|
|
|
74656
74653
|
}]);
|
|
74657
74654
|
|
|
74658
74655
|
return NURBSCurve;
|
|
74659
|
-
}(Curve)
|
|
74656
|
+
}(Curve);var isAbsoluteURL = function isAbsoluteURL(url) {
|
|
74657
|
+
return /^(?:\w+:)\/\//.test(url);
|
|
74658
|
+
};/**
|
|
74660
74659
|
* Loader loads FBX file and generates Group representing FBX scene.
|
|
74661
74660
|
* Requires FBX file to be >= 7.0 and in ASCII or >= 6400 in Binary format
|
|
74662
74661
|
* Versions lower than this may load but will probably have errors
|
|
@@ -74748,13 +74747,18 @@ var buildFBXLoader = function buildFBXLoader() {
|
|
|
74748
74747
|
var _this$options$texture = this.options.texture,
|
|
74749
74748
|
texture = _this$options$texture === void 0 ? "" : _this$options$texture;
|
|
74750
74749
|
var texturePath = LoaderUtils.extractUrlBase(texture);
|
|
74751
|
-
var textureLoader = new TextureLoader(this.manager).
|
|
74750
|
+
var textureLoader = new TextureLoader(this.manager).setCrossOrigin(this.crossOrigin);
|
|
74751
|
+
|
|
74752
|
+
if (!isAbsoluteURL(texture)) {
|
|
74753
|
+
textureLoader.setPath(this.resourcePath || texturePath || path);
|
|
74754
|
+
}
|
|
74755
|
+
|
|
74752
74756
|
return new FBXTreeParser(textureLoader, this.manager).parse(fbxTree);
|
|
74753
74757
|
}
|
|
74754
74758
|
}]);
|
|
74755
74759
|
|
|
74756
74760
|
return FBXLoader;
|
|
74757
|
-
}(Loader
|
|
74761
|
+
}(Loader); // Parse the FBXTree object returned by the BinaryParser or TextParser and return a Group
|
|
74758
74762
|
|
|
74759
74763
|
|
|
74760
74764
|
var FBXTreeParser = /*#__PURE__*/function () {
|
|
@@ -77889,7 +77893,7 @@ var MTLLoader = /*#__PURE__*/function (_Loader) {
|
|
|
77889
77893
|
}]);
|
|
77890
77894
|
|
|
77891
77895
|
return MTLLoader;
|
|
77892
|
-
}(Loader
|
|
77896
|
+
}(Loader);
|
|
77893
77897
|
/**
|
|
77894
77898
|
* Create a new MTLLoader.MaterialCreator
|
|
77895
77899
|
* @param baseUrl - Url relative to which textures are loaded
|
|
@@ -78817,7 +78821,7 @@ var OBJLoader = /*#__PURE__*/function (_Loader) {
|
|
|
78817
78821
|
}]);
|
|
78818
78822
|
|
|
78819
78823
|
return OBJLoader;
|
|
78820
|
-
}(Loader
|
|
78824
|
+
}(Loader);var EXTENSIONS$1 = {
|
|
78821
78825
|
OBJ: ".obj",
|
|
78822
78826
|
MTL: ".mtl"
|
|
78823
78827
|
};
|
|
@@ -83072,1407 +83076,416 @@ var Stats = /*#__PURE__*/function () {
|
|
|
83072
83076
|
return Stats;
|
|
83073
83077
|
}();
|
|
83074
83078
|
|
|
83075
|
-
var Stats$1 = new Stats();var
|
|
83076
|
-
function
|
|
83077
|
-
_classCallCheck(this,
|
|
83079
|
+
var Stats$1 = new Stats();var Pass = /*#__PURE__*/function () {
|
|
83080
|
+
function Pass() {
|
|
83081
|
+
_classCallCheck(this, Pass);
|
|
83082
|
+
|
|
83083
|
+
// if set to true, the pass is processed by the composer
|
|
83084
|
+
this.enabled = true; // if set to true, the pass indicates to swap read and write buffer after rendering
|
|
83085
|
+
|
|
83086
|
+
this.needsSwap = true; // if set to true, the pass clears its buffer before rendering
|
|
83078
83087
|
|
|
83079
|
-
this.
|
|
83088
|
+
this.clear = false; // if set to true, the result of the pass is rendered to screen. This is set automatically by EffectComposer.
|
|
83089
|
+
|
|
83090
|
+
this.renderToScreen = false;
|
|
83091
|
+
this.isPass = true;
|
|
83080
83092
|
}
|
|
83081
83093
|
|
|
83082
|
-
_createClass(
|
|
83083
|
-
key: "
|
|
83084
|
-
value: function
|
|
83094
|
+
_createClass(Pass, [{
|
|
83095
|
+
key: "setSize",
|
|
83096
|
+
value: function setSize() {}
|
|
83097
|
+
}, {
|
|
83098
|
+
key: "render",
|
|
83099
|
+
value: function render() {
|
|
83100
|
+
console.error('THREE.Pass: .render() must be implemented in derived pass.');
|
|
83101
|
+
}
|
|
83085
83102
|
}]);
|
|
83086
83103
|
|
|
83087
|
-
return
|
|
83088
|
-
}();
|
|
83089
|
-
var MeshLoader = /*#__PURE__*/function (_Loader) {
|
|
83090
|
-
_inherits(MeshLoader, _Loader);
|
|
83104
|
+
return Pass;
|
|
83105
|
+
}(); // Helper for passes that need to fill the viewport with a single quad.
|
|
83091
83106
|
|
|
83092
|
-
|
|
83107
|
+
var _camera = new OrthographicCamera(-1, 1, 1, -1, 0, 1); // https://github.com/mrdoob/three.js/pull/21358
|
|
83093
83108
|
|
|
83094
|
-
function MeshLoader() {
|
|
83095
|
-
_classCallCheck(this, MeshLoader);
|
|
83096
83109
|
|
|
83097
|
-
|
|
83098
|
-
}
|
|
83110
|
+
var _geometry = new BufferGeometry();
|
|
83099
83111
|
|
|
83100
|
-
|
|
83101
|
-
key: "load",
|
|
83102
|
-
value: function load() {
|
|
83103
|
-
var _this = this;
|
|
83112
|
+
_geometry.setAttribute('position', new Float32BufferAttribute([-1, 3, 0, -1, -1, 0, 3, -1, 0], 3));
|
|
83104
83113
|
|
|
83105
|
-
|
|
83106
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
83107
|
-
this.options = options;
|
|
83114
|
+
_geometry.setAttribute('uv', new Float32BufferAttribute([0, 2, 0, 0, 2, 0], 2));
|
|
83108
83115
|
|
|
83109
|
-
|
|
83110
|
-
|
|
83111
|
-
|
|
83112
|
-
scripts = _ref.scripts,
|
|
83113
|
-
texture = _ref.texture,
|
|
83114
|
-
opts = _objectWithoutProperties(_ref, _excluded$6);
|
|
83116
|
+
var FullScreenQuad = /*#__PURE__*/function () {
|
|
83117
|
+
function FullScreenQuad(material) {
|
|
83118
|
+
_classCallCheck(this, FullScreenQuad);
|
|
83115
83119
|
|
|
83116
|
-
|
|
83117
|
-
|
|
83118
|
-
|
|
83119
|
-
|
|
83120
|
-
|
|
83120
|
+
this._mesh = new Mesh(_geometry, material);
|
|
83121
|
+
}
|
|
83122
|
+
|
|
83123
|
+
_createClass(FullScreenQuad, [{
|
|
83124
|
+
key: "dispose",
|
|
83125
|
+
value: function dispose() {
|
|
83126
|
+
this._mesh.geometry.dispose();
|
|
83121
83127
|
}
|
|
83122
83128
|
}, {
|
|
83123
|
-
key: "
|
|
83124
|
-
value: function
|
|
83125
|
-
|
|
83129
|
+
key: "render",
|
|
83130
|
+
value: function render(renderer) {
|
|
83131
|
+
renderer.render(this._mesh, _camera);
|
|
83126
83132
|
}
|
|
83127
83133
|
}, {
|
|
83128
|
-
key: "
|
|
83129
|
-
|
|
83130
|
-
|
|
83131
|
-
|
|
83132
|
-
|
|
83133
|
-
|
|
83134
|
-
|
|
83135
|
-
|
|
83136
|
-
|
|
83137
|
-
|
|
83138
|
-
|
|
83139
|
-
|
|
83140
|
-
|
|
83141
|
-
|
|
83142
|
-
|
|
83143
|
-
|
|
83134
|
+
key: "material",
|
|
83135
|
+
get: function get() {
|
|
83136
|
+
return this._mesh.material;
|
|
83137
|
+
},
|
|
83138
|
+
set: function set(value) {
|
|
83139
|
+
this._mesh.material = value;
|
|
83140
|
+
}
|
|
83141
|
+
}]);
|
|
83142
|
+
|
|
83143
|
+
return FullScreenQuad;
|
|
83144
|
+
}();var ShaderPass = /*#__PURE__*/function (_Pass) {
|
|
83145
|
+
_inherits(ShaderPass, _Pass);
|
|
83146
|
+
|
|
83147
|
+
var _super = _createSuper(ShaderPass);
|
|
83148
|
+
|
|
83149
|
+
function ShaderPass(shader, textureID) {
|
|
83150
|
+
var _this;
|
|
83151
|
+
|
|
83152
|
+
_classCallCheck(this, ShaderPass);
|
|
83153
|
+
|
|
83154
|
+
_this = _super.call(this);
|
|
83155
|
+
_this.textureID = textureID !== undefined ? textureID : 'tDiffuse';
|
|
83156
|
+
|
|
83157
|
+
if (shader instanceof ShaderMaterial) {
|
|
83158
|
+
_this.uniforms = shader.uniforms;
|
|
83159
|
+
_this.material = shader;
|
|
83160
|
+
} else if (shader) {
|
|
83161
|
+
_this.uniforms = UniformsUtils.clone(shader.uniforms);
|
|
83162
|
+
_this.material = new ShaderMaterial({
|
|
83163
|
+
defines: Object.assign({}, shader.defines),
|
|
83164
|
+
uniforms: _this.uniforms,
|
|
83165
|
+
vertexShader: shader.vertexShader,
|
|
83166
|
+
fragmentShader: shader.fragmentShader
|
|
83167
|
+
});
|
|
83168
|
+
}
|
|
83169
|
+
|
|
83170
|
+
_this.fsQuad = new FullScreenQuad(_this.material);
|
|
83171
|
+
return _this;
|
|
83172
|
+
}
|
|
83144
83173
|
|
|
83145
|
-
|
|
83146
|
-
|
|
83147
|
-
|
|
83174
|
+
_createClass(ShaderPass, [{
|
|
83175
|
+
key: "render",
|
|
83176
|
+
value: function render(renderer, writeBuffer, readBuffer
|
|
83177
|
+
/*, deltaTime, maskActive */
|
|
83178
|
+
) {
|
|
83179
|
+
if (this.uniforms[this.textureID]) {
|
|
83180
|
+
this.uniforms[this.textureID].value = readBuffer.texture;
|
|
83148
83181
|
}
|
|
83149
83182
|
|
|
83150
|
-
|
|
83183
|
+
this.fsQuad.material = this.material;
|
|
83184
|
+
|
|
83185
|
+
if (this.renderToScreen) {
|
|
83186
|
+
renderer.setRenderTarget(null);
|
|
83187
|
+
this.fsQuad.render(renderer);
|
|
83188
|
+
} else {
|
|
83189
|
+
renderer.setRenderTarget(writeBuffer); // TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600
|
|
83190
|
+
|
|
83191
|
+
if (this.clear) renderer.clear(renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil);
|
|
83192
|
+
this.fsQuad.render(renderer);
|
|
83193
|
+
}
|
|
83151
83194
|
}
|
|
83152
83195
|
}]);
|
|
83153
83196
|
|
|
83154
|
-
return
|
|
83155
|
-
}(
|
|
83156
|
-
|
|
83157
|
-
|
|
83197
|
+
return ShaderPass;
|
|
83198
|
+
}(Pass);/**
|
|
83199
|
+
* Full-screen textured quad shader
|
|
83200
|
+
*/
|
|
83201
|
+
var CopyShader = {
|
|
83202
|
+
uniforms: {
|
|
83203
|
+
'tDiffuse': {
|
|
83204
|
+
value: null
|
|
83205
|
+
},
|
|
83206
|
+
'opacity': {
|
|
83207
|
+
value: 1.0
|
|
83208
|
+
}
|
|
83209
|
+
},
|
|
83210
|
+
vertexShader:
|
|
83211
|
+
/* glsl */
|
|
83212
|
+
"\n\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
|
|
83213
|
+
fragmentShader:
|
|
83214
|
+
/* glsl */
|
|
83215
|
+
"\n\n uniform float opacity;\n\n uniform sampler2D tDiffuse;\n\n varying vec2 vUv;\n\n void main() {\n gl_FragColor = texture2D( tDiffuse, vUv );\n gl_FragColor.a *= opacity;\n }"
|
|
83216
|
+
};var MaskPass = /*#__PURE__*/function (_Pass) {
|
|
83217
|
+
_inherits(MaskPass, _Pass);
|
|
83158
83218
|
|
|
83159
|
-
var _super = _createSuper(
|
|
83219
|
+
var _super = _createSuper(MaskPass);
|
|
83160
83220
|
|
|
83161
|
-
function
|
|
83221
|
+
function MaskPass(scene, camera) {
|
|
83162
83222
|
var _this;
|
|
83163
83223
|
|
|
83164
|
-
|
|
83165
|
-
intensity = _ref.intensity,
|
|
83166
|
-
_name = _ref.name;
|
|
83224
|
+
_classCallCheck(this, MaskPass);
|
|
83167
83225
|
|
|
83168
|
-
|
|
83226
|
+
_this = _super.call(this);
|
|
83227
|
+
_this.scene = scene;
|
|
83228
|
+
_this.camera = camera;
|
|
83229
|
+
_this.clear = true;
|
|
83230
|
+
_this.needsSwap = false;
|
|
83231
|
+
_this.inverse = false;
|
|
83232
|
+
return _this;
|
|
83233
|
+
}
|
|
83169
83234
|
|
|
83170
|
-
|
|
83171
|
-
|
|
83172
|
-
|
|
83235
|
+
_createClass(MaskPass, [{
|
|
83236
|
+
key: "render",
|
|
83237
|
+
value: function render(renderer, writeBuffer, readBuffer
|
|
83238
|
+
/*, deltaTime, maskActive */
|
|
83239
|
+
) {
|
|
83240
|
+
var context = renderer.getContext();
|
|
83241
|
+
var state = renderer.state; // don't update color or depth
|
|
83173
83242
|
|
|
83174
|
-
|
|
83175
|
-
|
|
83176
|
-
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.05;
|
|
83177
|
-
var holderSprite = new HelperSprite(size, size, name, {
|
|
83178
|
-
name: name
|
|
83179
|
-
});
|
|
83243
|
+
state.buffers.color.setMask(false);
|
|
83244
|
+
state.buffers.depth.setMask(false); // lock buffers
|
|
83180
83245
|
|
|
83181
|
-
|
|
83182
|
-
|
|
83183
|
-
|
|
83184
|
-
|
|
83185
|
-
|
|
83186
|
-
|
|
83187
|
-
|
|
83188
|
-
|
|
83189
|
-
_this.holder = holderSprite;
|
|
83190
|
-
return true;
|
|
83246
|
+
state.buffers.color.setLocked(true);
|
|
83247
|
+
state.buffers.depth.setLocked(true); // set up stencil
|
|
83248
|
+
|
|
83249
|
+
var writeValue, clearValue;
|
|
83250
|
+
|
|
83251
|
+
if (this.inverse) {
|
|
83252
|
+
writeValue = 0;
|
|
83253
|
+
clearValue = 1;
|
|
83191
83254
|
} else {
|
|
83192
|
-
|
|
83193
|
-
|
|
83255
|
+
writeValue = 1;
|
|
83256
|
+
clearValue = 0;
|
|
83194
83257
|
}
|
|
83195
|
-
});
|
|
83196
83258
|
|
|
83197
|
-
|
|
83198
|
-
|
|
83199
|
-
|
|
83200
|
-
|
|
83201
|
-
|
|
83202
|
-
});
|
|
83259
|
+
state.buffers.stencil.setTest(true);
|
|
83260
|
+
state.buffers.stencil.setOp(context.REPLACE, context.REPLACE, context.REPLACE);
|
|
83261
|
+
state.buffers.stencil.setFunc(context.ALWAYS, writeValue, 0xffffffff);
|
|
83262
|
+
state.buffers.stencil.setClear(clearValue);
|
|
83263
|
+
state.buffers.stencil.setLocked(true); // draw into the stencil buffer
|
|
83203
83264
|
|
|
83204
|
-
|
|
83205
|
-
|
|
83206
|
-
|
|
83207
|
-
|
|
83208
|
-
|
|
83209
|
-
|
|
83210
|
-
targetSprite.addTags([TAGS.LIGHTS.HELPER, TAGS.LIGHTS.TARGET, name]);
|
|
83211
|
-
targetSprite.setHelperTarget(_assertThisInitialized(_this));
|
|
83212
|
-
targetSprite.getBody().add(_this.getBody().target);
|
|
83213
|
-
_this.targetHolder = targetSprite;
|
|
83214
|
-
}
|
|
83215
|
-
});
|
|
83265
|
+
renderer.setRenderTarget(readBuffer);
|
|
83266
|
+
if (this.clear) renderer.clear();
|
|
83267
|
+
renderer.render(this.scene, this.camera);
|
|
83268
|
+
renderer.setRenderTarget(writeBuffer);
|
|
83269
|
+
if (this.clear) renderer.clear();
|
|
83270
|
+
renderer.render(this.scene, this.camera); // unlock color and depth buffer for subsequent rendering
|
|
83216
83271
|
|
|
83217
|
-
|
|
83218
|
-
|
|
83219
|
-
_this.name = _name || generateRandomName("Light");
|
|
83220
|
-
_this.isLightOn = false;
|
|
83221
|
-
_this.body = undefined; // helper body for this light
|
|
83272
|
+
state.buffers.color.setLocked(false);
|
|
83273
|
+
state.buffers.depth.setLocked(false); // only render where stencil is set to 1
|
|
83222
83274
|
|
|
83223
|
-
|
|
83275
|
+
state.buffers.stencil.setLocked(false);
|
|
83276
|
+
state.buffers.stencil.setFunc(context.EQUAL, 1, 0xffffffff); // draw if == 1
|
|
83224
83277
|
|
|
83225
|
-
|
|
83278
|
+
state.buffers.stencil.setOp(context.KEEP, context.KEEP, context.KEEP);
|
|
83279
|
+
state.buffers.stencil.setLocked(true);
|
|
83280
|
+
}
|
|
83281
|
+
}]);
|
|
83226
83282
|
|
|
83227
|
-
|
|
83283
|
+
return MaskPass;
|
|
83284
|
+
}(Pass);var ClearMaskPass = /*#__PURE__*/function (_Pass) {
|
|
83285
|
+
_inherits(ClearMaskPass, _Pass);
|
|
83228
83286
|
|
|
83229
|
-
|
|
83287
|
+
var _super = _createSuper(ClearMaskPass);
|
|
83230
83288
|
|
|
83231
|
-
|
|
83289
|
+
function ClearMaskPass() {
|
|
83290
|
+
var _this;
|
|
83291
|
+
|
|
83292
|
+
_classCallCheck(this, ClearMaskPass);
|
|
83293
|
+
|
|
83294
|
+
_this = _super.call(this);
|
|
83295
|
+
_this.needsSwap = false;
|
|
83232
83296
|
return _this;
|
|
83233
83297
|
}
|
|
83234
83298
|
|
|
83235
|
-
_createClass(
|
|
83236
|
-
key: "
|
|
83237
|
-
value: function
|
|
83238
|
-
|
|
83239
|
-
|
|
83240
|
-
|
|
83241
|
-
|
|
83242
|
-
}, {
|
|
83243
|
-
key: "usingHelper",
|
|
83244
|
-
value: function usingHelper() {
|
|
83245
|
-
return !!this.isUsingHelper;
|
|
83246
|
-
}
|
|
83247
|
-
}, {
|
|
83248
|
-
key: "hasHolder",
|
|
83249
|
-
value: function hasHolder() {
|
|
83250
|
-
return !!this.holder;
|
|
83251
|
-
}
|
|
83252
|
-
}, {
|
|
83253
|
-
key: "hasTarget",
|
|
83254
|
-
value: function hasTarget() {
|
|
83255
|
-
return false;
|
|
83299
|
+
_createClass(ClearMaskPass, [{
|
|
83300
|
+
key: "render",
|
|
83301
|
+
value: function render(renderer
|
|
83302
|
+
/*, writeBuffer, readBuffer, deltaTime, maskActive */
|
|
83303
|
+
) {
|
|
83304
|
+
renderer.state.buffers.stencil.setLocked(false);
|
|
83305
|
+
renderer.state.buffers.stencil.setTest(false);
|
|
83256
83306
|
}
|
|
83257
|
-
}
|
|
83258
|
-
|
|
83259
|
-
|
|
83260
|
-
|
|
83261
|
-
|
|
83262
|
-
|
|
83263
|
-
|
|
83264
|
-
|
|
83307
|
+
}]);
|
|
83308
|
+
|
|
83309
|
+
return ClearMaskPass;
|
|
83310
|
+
}(Pass);var EffectComposer = /*#__PURE__*/function () {
|
|
83311
|
+
function EffectComposer(renderer, renderTarget) {
|
|
83312
|
+
var _this = this;
|
|
83313
|
+
|
|
83314
|
+
_classCallCheck(this, EffectComposer);
|
|
83315
|
+
|
|
83316
|
+
_defineProperty$1(this, "ensureLastPassIsRendered", function () {
|
|
83317
|
+
_this.passes.forEach(function (pass, index) {
|
|
83318
|
+
return pass.renderToScreen = index === _this.passes.length - 1;
|
|
83319
|
+
});
|
|
83320
|
+
});
|
|
83321
|
+
|
|
83322
|
+
this.renderer = renderer;
|
|
83323
|
+
|
|
83324
|
+
if (renderTarget === undefined) {
|
|
83325
|
+
var size = renderer.getSize(new Vector2());
|
|
83326
|
+
this._pixelRatio = renderer.getPixelRatio();
|
|
83327
|
+
this._width = size.width;
|
|
83328
|
+
this._height = size.height;
|
|
83329
|
+
renderTarget = new WebGLRenderTarget(this._width * this._pixelRatio, this._height * this._pixelRatio);
|
|
83330
|
+
renderTarget.texture.name = 'EffectComposer.rt1';
|
|
83331
|
+
} else {
|
|
83332
|
+
this._pixelRatio = 1;
|
|
83333
|
+
this._width = renderTarget.width;
|
|
83334
|
+
this._height = renderTarget.height;
|
|
83265
83335
|
}
|
|
83266
|
-
}, {
|
|
83267
|
-
key: "setPosition",
|
|
83268
|
-
value: function setPosition(where) {
|
|
83269
|
-
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
83270
|
-
_ref2$updateHolder = _ref2.updateHolder,
|
|
83271
|
-
updateHolder = _ref2$updateHolder === void 0 ? true : _ref2$updateHolder;
|
|
83272
83336
|
|
|
83273
|
-
|
|
83337
|
+
this.renderTarget1 = renderTarget;
|
|
83338
|
+
this.renderTarget2 = renderTarget.clone();
|
|
83339
|
+
this.renderTarget2.texture.name = 'EffectComposer.rt2';
|
|
83340
|
+
this.writeBuffer = this.renderTarget1;
|
|
83341
|
+
this.readBuffer = this.renderTarget2;
|
|
83342
|
+
this.renderToScreen = true;
|
|
83343
|
+
this.passes = []; // dependencies
|
|
83274
83344
|
|
|
83275
|
-
|
|
83276
|
-
|
|
83277
|
-
|
|
83345
|
+
if (CopyShader === undefined) {
|
|
83346
|
+
console.error('THREE.EffectComposer relies on CopyShader');
|
|
83347
|
+
}
|
|
83278
83348
|
|
|
83279
|
-
|
|
83280
|
-
|
|
83281
|
-
|
|
83349
|
+
if (ShaderPass === undefined) {
|
|
83350
|
+
console.error('THREE.EffectComposer relies on ShaderPass');
|
|
83351
|
+
}
|
|
83282
83352
|
|
|
83283
|
-
|
|
83284
|
-
|
|
83285
|
-
|
|
83286
|
-
|
|
83287
|
-
|
|
83288
|
-
|
|
83289
|
-
|
|
83353
|
+
this.copyPass = new ShaderPass(CopyShader);
|
|
83354
|
+
this.clock = new Clock();
|
|
83355
|
+
}
|
|
83356
|
+
|
|
83357
|
+
_createClass(EffectComposer, [{
|
|
83358
|
+
key: "swapBuffers",
|
|
83359
|
+
value: function swapBuffers() {
|
|
83360
|
+
var tmp = this.readBuffer;
|
|
83361
|
+
this.readBuffer = this.writeBuffer;
|
|
83362
|
+
this.writeBuffer = tmp;
|
|
83290
83363
|
}
|
|
83291
83364
|
}, {
|
|
83292
|
-
key: "
|
|
83293
|
-
value: function
|
|
83294
|
-
|
|
83365
|
+
key: "addPass",
|
|
83366
|
+
value: function addPass(pass) {
|
|
83367
|
+
this.passes.push(pass);
|
|
83368
|
+
pass.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);
|
|
83295
83369
|
}
|
|
83296
83370
|
}, {
|
|
83297
|
-
key: "
|
|
83298
|
-
value: function
|
|
83299
|
-
|
|
83371
|
+
key: "insertPass",
|
|
83372
|
+
value: function insertPass(pass, index) {
|
|
83373
|
+
this.passes.splice(index, 0, pass);
|
|
83374
|
+
pass.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);
|
|
83300
83375
|
}
|
|
83301
83376
|
}, {
|
|
83302
|
-
key: "
|
|
83303
|
-
value: function
|
|
83304
|
-
|
|
83305
|
-
|
|
83306
|
-
|
|
83377
|
+
key: "removePass",
|
|
83378
|
+
value: function removePass(pass) {
|
|
83379
|
+
var index = this.passes.indexOf(pass);
|
|
83380
|
+
|
|
83381
|
+
if (index !== -1) {
|
|
83382
|
+
this.passes.splice(index, 1);
|
|
83307
83383
|
}
|
|
83308
83384
|
}
|
|
83309
83385
|
}, {
|
|
83310
|
-
key: "
|
|
83311
|
-
value: function
|
|
83312
|
-
|
|
83313
|
-
|
|
83386
|
+
key: "isLastEnabledPass",
|
|
83387
|
+
value: function isLastEnabledPass(passIndex) {
|
|
83388
|
+
for (var i = passIndex + 1; i < this.passes.length; i++) {
|
|
83389
|
+
if (this.passes[i].enabled) {
|
|
83390
|
+
return false;
|
|
83391
|
+
}
|
|
83314
83392
|
}
|
|
83393
|
+
|
|
83394
|
+
return true;
|
|
83315
83395
|
}
|
|
83316
83396
|
}, {
|
|
83317
|
-
key: "
|
|
83318
|
-
value: function
|
|
83319
|
-
|
|
83397
|
+
key: "render",
|
|
83398
|
+
value: function render(deltaTime) {
|
|
83399
|
+
// deltaTime value is in seconds
|
|
83400
|
+
if (deltaTime === undefined) {
|
|
83401
|
+
deltaTime = this.clock.getDelta();
|
|
83402
|
+
}
|
|
83403
|
+
|
|
83404
|
+
var currentRenderTarget = this.renderer.getRenderTarget();
|
|
83405
|
+
var maskActive = false;
|
|
83406
|
+
|
|
83407
|
+
for (var i = 0, il = this.passes.length; i < il; i++) {
|
|
83408
|
+
var pass = this.passes[i];
|
|
83409
|
+
if (pass.enabled === false) continue;
|
|
83410
|
+
pass.renderToScreen = this.renderToScreen && this.isLastEnabledPass(i);
|
|
83411
|
+
pass.render(this.renderer, this.writeBuffer, this.readBuffer, deltaTime, maskActive);
|
|
83412
|
+
|
|
83413
|
+
if (pass.needsSwap) {
|
|
83414
|
+
if (maskActive) {
|
|
83415
|
+
var context = this.renderer.getContext();
|
|
83416
|
+
var stencil = this.renderer.state.buffers.stencil; //context.stencilFunc(context.NOTEQUAL, 1, 0xffffffff);
|
|
83417
|
+
|
|
83418
|
+
stencil.setFunc(context.NOTEQUAL, 1, 0xffffffff);
|
|
83419
|
+
this.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer, deltaTime); //context.stencilFunc(context.EQUAL, 1, 0xffffffff);
|
|
83420
|
+
|
|
83421
|
+
stencil.setFunc(context.EQUAL, 1, 0xffffffff);
|
|
83422
|
+
}
|
|
83423
|
+
|
|
83424
|
+
this.swapBuffers();
|
|
83425
|
+
}
|
|
83426
|
+
|
|
83427
|
+
if (MaskPass !== undefined) {
|
|
83428
|
+
if (pass instanceof MaskPass) {
|
|
83429
|
+
maskActive = true;
|
|
83430
|
+
} else if (pass instanceof ClearMaskPass) {
|
|
83431
|
+
maskActive = false;
|
|
83432
|
+
}
|
|
83433
|
+
}
|
|
83434
|
+
}
|
|
83435
|
+
|
|
83436
|
+
this.renderer.setRenderTarget(currentRenderTarget);
|
|
83320
83437
|
}
|
|
83321
83438
|
}, {
|
|
83322
|
-
key: "
|
|
83323
|
-
value: function
|
|
83324
|
-
|
|
83439
|
+
key: "reset",
|
|
83440
|
+
value: function reset(renderTarget) {
|
|
83441
|
+
if (renderTarget === undefined) {
|
|
83442
|
+
var size = this.renderer.getSize(new Vector2());
|
|
83443
|
+
this._pixelRatio = this.renderer.getPixelRatio();
|
|
83444
|
+
this._width = size.width;
|
|
83445
|
+
this._height = size.height;
|
|
83446
|
+
renderTarget = this.renderTarget1.clone();
|
|
83447
|
+
renderTarget.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);
|
|
83448
|
+
}
|
|
83449
|
+
|
|
83450
|
+
this.renderTarget1.dispose();
|
|
83451
|
+
this.renderTarget2.dispose();
|
|
83452
|
+
this.renderTarget1 = renderTarget;
|
|
83453
|
+
this.renderTarget2 = renderTarget.clone();
|
|
83454
|
+
this.writeBuffer = this.renderTarget1;
|
|
83455
|
+
this.readBuffer = this.renderTarget2;
|
|
83325
83456
|
}
|
|
83326
83457
|
}, {
|
|
83327
|
-
key: "
|
|
83328
|
-
value: function
|
|
83329
|
-
this.
|
|
83330
|
-
this.
|
|
83458
|
+
key: "setSize",
|
|
83459
|
+
value: function setSize(width, height) {
|
|
83460
|
+
this._width = width;
|
|
83461
|
+
this._height = height;
|
|
83462
|
+
var effectiveWidth = this._width * this._pixelRatio;
|
|
83463
|
+
var effectiveHeight = this._height * this._pixelRatio;
|
|
83464
|
+
this.renderTarget1.setSize(effectiveWidth, effectiveHeight);
|
|
83465
|
+
this.renderTarget2.setSize(effectiveWidth, effectiveHeight);
|
|
83466
|
+
|
|
83467
|
+
for (var i = 0; i < this.passes.length; i++) {
|
|
83468
|
+
this.passes[i].setSize(effectiveWidth, effectiveHeight);
|
|
83469
|
+
}
|
|
83331
83470
|
}
|
|
83332
83471
|
}, {
|
|
83333
|
-
key: "
|
|
83334
|
-
value: function
|
|
83335
|
-
|
|
83472
|
+
key: "setPixelRatio",
|
|
83473
|
+
value: function setPixelRatio(pixelRatio) {
|
|
83474
|
+
this._pixelRatio = pixelRatio;
|
|
83475
|
+
this.setSize(this._width, this._height);
|
|
83336
83476
|
}
|
|
83337
|
-
}
|
|
83338
|
-
key: "dim",
|
|
83339
|
-
value: function dim() {
|
|
83340
|
-
var _this2 = this;
|
|
83477
|
+
}]);
|
|
83341
83478
|
|
|
83342
|
-
|
|
83343
|
-
|
|
83344
|
-
|
|
83479
|
+
return EffectComposer;
|
|
83480
|
+
}();var RenderPass = /*#__PURE__*/function (_Pass) {
|
|
83481
|
+
_inherits(RenderPass, _Pass);
|
|
83345
83482
|
|
|
83346
|
-
|
|
83347
|
-
return !_this2.isDisposed() && _this2.setIntensity(value);
|
|
83348
|
-
};
|
|
83483
|
+
var _super = _createSuper(RenderPass);
|
|
83349
83484
|
|
|
83350
|
-
|
|
83351
|
-
|
|
83352
|
-
onUpdate: onUpdate
|
|
83353
|
-
});
|
|
83354
|
-
}
|
|
83355
|
-
}, {
|
|
83356
|
-
key: "on",
|
|
83357
|
-
value: function on() {
|
|
83358
|
-
var _this3 = this;
|
|
83485
|
+
function RenderPass(scene, camera, overrideMaterial, clearColor, clearAlpha) {
|
|
83486
|
+
var _this;
|
|
83359
83487
|
|
|
83360
|
-
|
|
83361
|
-
|
|
83362
|
-
if (this.hasBody()) {
|
|
83363
|
-
this.dim(this.intensity, time).then(function () {
|
|
83364
|
-
return _this3.isLightOn = true;
|
|
83365
|
-
});
|
|
83366
|
-
} else {
|
|
83367
|
-
console.log(LIGHT_NOT_FOUND);
|
|
83368
|
-
}
|
|
83369
|
-
}
|
|
83370
|
-
}, {
|
|
83371
|
-
key: "off",
|
|
83372
|
-
value: function off() {
|
|
83373
|
-
var _this4 = this;
|
|
83374
|
-
|
|
83375
|
-
var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 500;
|
|
83376
|
-
|
|
83377
|
-
if (this.hasBody()) {
|
|
83378
|
-
this.dim(0, time).then(function () {
|
|
83379
|
-
return _this4.isLightOn = false;
|
|
83380
|
-
});
|
|
83381
|
-
} else {
|
|
83382
|
-
console.log(LIGHT_NOT_FOUND);
|
|
83383
|
-
}
|
|
83384
|
-
}
|
|
83385
|
-
}, {
|
|
83386
|
-
key: "toJSON",
|
|
83387
|
-
value: function toJSON() {
|
|
83388
|
-
return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(Light.prototype), "toJSON", this).call(this)), {}, {
|
|
83389
|
-
type: this.getEntityType(),
|
|
83390
|
-
color: this.getColor(),
|
|
83391
|
-
intensity: this.getIntensity(),
|
|
83392
|
-
name: this.getName(),
|
|
83393
|
-
castShadow: this.getCastShadow()
|
|
83394
|
-
});
|
|
83395
|
-
}
|
|
83396
|
-
}]);
|
|
83397
|
-
|
|
83398
|
-
return Light;
|
|
83399
|
-
}(Entity);var DEFAULT_NEAR$2 = 0.1;
|
|
83400
|
-
var DEFAULT_FAR$2 = 100;
|
|
83401
|
-
var DEFAULT_FOV = 75;
|
|
83402
|
-
var DEFAULT_POSITION$3 = {
|
|
83403
|
-
x: 0,
|
|
83404
|
-
y: 1,
|
|
83405
|
-
z: 0
|
|
83406
|
-
};
|
|
83407
|
-
var DEFAULT_INTENSITY$4 = 0.5;
|
|
83408
|
-
var DEFAULT_MAP_SIZE$2 = 512;
|
|
83409
|
-
var DEFAULT_BIAS$2 = -0.0001;
|
|
83410
|
-
var WHITE$3 = 0xffffff;
|
|
83411
|
-
|
|
83412
|
-
var SunLight = /*#__PURE__*/function (_Light) {
|
|
83413
|
-
_inherits(SunLight, _Light);
|
|
83414
|
-
|
|
83415
|
-
var _super = _createSuper(SunLight);
|
|
83416
|
-
|
|
83417
|
-
function SunLight() {
|
|
83418
|
-
var _this;
|
|
83419
|
-
|
|
83420
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
83421
|
-
|
|
83422
|
-
_classCallCheck(this, SunLight);
|
|
83423
|
-
|
|
83424
|
-
var _options$color = options.color,
|
|
83425
|
-
color = _options$color === void 0 ? WHITE$3 : _options$color,
|
|
83426
|
-
_options$intensity = options.intensity,
|
|
83427
|
-
intensity = _options$intensity === void 0 ? DEFAULT_INTENSITY$4 : _options$intensity,
|
|
83428
|
-
_options$name = options.name,
|
|
83429
|
-
name = _options$name === void 0 ? generateRandomName("SunLight") : _options$name;
|
|
83430
|
-
_this = _super.call(this, {
|
|
83431
|
-
color: color,
|
|
83432
|
-
intensity: intensity,
|
|
83433
|
-
name: name
|
|
83434
|
-
});
|
|
83435
|
-
|
|
83436
|
-
_defineProperty$1(_assertThisInitialized(_this), "setShadowCameraNearFar", function () {
|
|
83437
|
-
var near = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_NEAR$2;
|
|
83438
|
-
var far = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_FAR$2;
|
|
83439
|
-
_this.near = near;
|
|
83440
|
-
_this.far = far;
|
|
83441
|
-
var d = _this.far / 2;
|
|
83442
|
-
_this.getBody().shadow.camera.left = -d;
|
|
83443
|
-
_this.getBody().shadow.camera.right = d;
|
|
83444
|
-
_this.getBody().shadow.camera.top = d;
|
|
83445
|
-
_this.getBody().shadow.camera.bottom = -d;
|
|
83446
|
-
_this.getBody().shadow.camera.near = near;
|
|
83447
|
-
_this.getBody().shadow.camera.far = far;
|
|
83448
|
-
});
|
|
83449
|
-
|
|
83450
|
-
_defineProperty$1(_assertThisInitialized(_this), "setBias", function () {
|
|
83451
|
-
var bias = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_BIAS$2;
|
|
83452
|
-
_this.bias = bias;
|
|
83453
|
-
_this.getBody().shadow.bias = bias;
|
|
83454
|
-
});
|
|
83455
|
-
|
|
83456
|
-
_this.options = options;
|
|
83457
|
-
_this.target = ORIGIN;
|
|
83458
|
-
|
|
83459
|
-
_this.setLight({
|
|
83460
|
-
color: color,
|
|
83461
|
-
intensity: intensity
|
|
83462
|
-
});
|
|
83463
|
-
|
|
83464
|
-
_this.setEntityType(ENTITY_TYPES.LIGHT.SUN);
|
|
83465
|
-
|
|
83466
|
-
_this.setName(name);
|
|
83467
|
-
|
|
83468
|
-
return _this;
|
|
83469
|
-
}
|
|
83470
|
-
|
|
83471
|
-
_createClass(SunLight, [{
|
|
83472
|
-
key: "setLight",
|
|
83473
|
-
value: function setLight(_ref) {
|
|
83474
|
-
var light = _ref.light,
|
|
83475
|
-
_ref$color = _ref.color,
|
|
83476
|
-
color = _ref$color === void 0 ? WHITE$3 : _ref$color,
|
|
83477
|
-
_ref$intensity = _ref.intensity,
|
|
83478
|
-
intensity = _ref$intensity === void 0 ? DEFAULT_INTENSITY$4 : _ref$intensity;
|
|
83479
|
-
|
|
83480
|
-
if (light) {
|
|
83481
|
-
this.setBody({
|
|
83482
|
-
body: light
|
|
83483
|
-
});
|
|
83484
|
-
} else {
|
|
83485
|
-
this.setBody({
|
|
83486
|
-
body: new DirectionalLight(color, intensity)
|
|
83487
|
-
});
|
|
83488
|
-
}
|
|
83489
|
-
|
|
83490
|
-
if (this.hasBody()) {
|
|
83491
|
-
this.postLightCreation();
|
|
83492
|
-
}
|
|
83493
|
-
}
|
|
83494
|
-
}, {
|
|
83495
|
-
key: "postLightCreation",
|
|
83496
|
-
value: function postLightCreation() {
|
|
83497
|
-
var _this$options$positio = this.options.position,
|
|
83498
|
-
position = _this$options$positio === void 0 ? DEFAULT_POSITION$3 : _this$options$positio;
|
|
83499
|
-
var emptyTarget = new Element$1({
|
|
83500
|
-
body: new Object3D()
|
|
83501
|
-
});
|
|
83502
|
-
this.setPosition(position);
|
|
83503
|
-
this.setTarget(emptyTarget);
|
|
83504
|
-
this.setLightShadows();
|
|
83505
|
-
this.addToScene();
|
|
83506
|
-
}
|
|
83507
|
-
}, {
|
|
83508
|
-
key: "setLightShadows",
|
|
83509
|
-
value: function setLightShadows() {
|
|
83510
|
-
var _this$options = this.options,
|
|
83511
|
-
_this$options$near = _this$options.near,
|
|
83512
|
-
near = _this$options$near === void 0 ? DEFAULT_NEAR$2 : _this$options$near,
|
|
83513
|
-
_this$options$far = _this$options.far,
|
|
83514
|
-
far = _this$options$far === void 0 ? DEFAULT_FAR$2 : _this$options$far,
|
|
83515
|
-
_this$options$mapSize = _this$options.mapSize,
|
|
83516
|
-
mapSize = _this$options$mapSize === void 0 ? DEFAULT_MAP_SIZE$2 : _this$options$mapSize,
|
|
83517
|
-
_this$options$bias = _this$options.bias,
|
|
83518
|
-
bias = _this$options$bias === void 0 ? DEFAULT_BIAS$2 : _this$options$bias,
|
|
83519
|
-
_this$options$fov = _this$options.fov,
|
|
83520
|
-
fov = _this$options$fov === void 0 ? DEFAULT_FOV : _this$options$fov;
|
|
83521
|
-
|
|
83522
|
-
if (Config$1.lights().shadows) {
|
|
83523
|
-
this.setCastShadow(true);
|
|
83524
|
-
this.setMapSize(mapSize);
|
|
83525
|
-
this.setShadowCameraNearFar(near, far);
|
|
83526
|
-
this.setBias(bias);
|
|
83527
|
-
this.setShadowCameraFov(fov);
|
|
83528
|
-
}
|
|
83529
|
-
}
|
|
83530
|
-
}, {
|
|
83531
|
-
key: "getShadowCameraNearFar",
|
|
83532
|
-
value: function getShadowCameraNearFar() {
|
|
83533
|
-
return {
|
|
83534
|
-
near: this.near,
|
|
83535
|
-
far: this.far
|
|
83536
|
-
};
|
|
83537
|
-
}
|
|
83538
|
-
}, {
|
|
83539
|
-
key: "setShadowCameraFov",
|
|
83540
|
-
value: function setShadowCameraFov() {
|
|
83541
|
-
var fov = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_FOV;
|
|
83542
|
-
this.fov = fov;
|
|
83543
|
-
this.getBody().shadow.camera.fov = fov;
|
|
83544
|
-
}
|
|
83545
|
-
}, {
|
|
83546
|
-
key: "getShadowCameraFov",
|
|
83547
|
-
value: function getShadowCameraFov() {
|
|
83548
|
-
return this.fov;
|
|
83549
|
-
}
|
|
83550
|
-
}, {
|
|
83551
|
-
key: "setMapSize",
|
|
83552
|
-
value: function setMapSize() {
|
|
83553
|
-
var mapSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MAP_SIZE$2;
|
|
83554
|
-
this.mapSize = mapSize;
|
|
83555
|
-
this.getBody().shadow.mapSize.height = mapSize;
|
|
83556
|
-
this.getBody().shadow.mapSize.width = mapSize;
|
|
83557
|
-
}
|
|
83558
|
-
}, {
|
|
83559
|
-
key: "getMapSize",
|
|
83560
|
-
value: function getMapSize() {
|
|
83561
|
-
return this.mapSize;
|
|
83562
|
-
}
|
|
83563
|
-
}, {
|
|
83564
|
-
key: "getBias",
|
|
83565
|
-
value: function getBias() {
|
|
83566
|
-
return this.bias;
|
|
83567
|
-
}
|
|
83568
|
-
}, {
|
|
83569
|
-
key: "hasTarget",
|
|
83570
|
-
value: function hasTarget() {
|
|
83571
|
-
return true;
|
|
83572
|
-
}
|
|
83573
|
-
}, {
|
|
83574
|
-
key: "setTarget",
|
|
83575
|
-
value: function setTarget(target) {
|
|
83576
|
-
this.target = target;
|
|
83577
|
-
this.getBody().target = target.getBody();
|
|
83578
|
-
Scene$1.add(this.getBody().target, null, false);
|
|
83579
|
-
}
|
|
83580
|
-
}, {
|
|
83581
|
-
key: "getTarget",
|
|
83582
|
-
value: function getTarget() {
|
|
83583
|
-
return this.target;
|
|
83584
|
-
}
|
|
83585
|
-
}, {
|
|
83586
|
-
key: "addHelpers",
|
|
83587
|
-
value: function addHelpers() {
|
|
83588
|
-
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
83589
|
-
_ref2$holderName = _ref2.holderName,
|
|
83590
|
-
holderName = _ref2$holderName === void 0 ? "sunlightholder" : _ref2$holderName,
|
|
83591
|
-
_ref2$holderSize = _ref2.holderSize,
|
|
83592
|
-
holderSize = _ref2$holderSize === void 0 ? 0.05 : _ref2$holderSize,
|
|
83593
|
-
_ref2$targetHolderNam = _ref2.targetHolderName,
|
|
83594
|
-
targetHolderName = _ref2$targetHolderNam === void 0 ? "targetholder" : _ref2$targetHolderNam,
|
|
83595
|
-
_ref2$targetHolderSiz = _ref2.targetHolderSize,
|
|
83596
|
-
targetHolderSize = _ref2$targetHolderSiz === void 0 ? 0.05 : _ref2$targetHolderSiz;
|
|
83597
|
-
|
|
83598
|
-
this.helper = new DirectionalLightHelper(this.getBody(), 5);
|
|
83599
|
-
this.shadowHelper = new CameraHelper(this.getBody().shadow.camera);
|
|
83600
|
-
Scene$1.add(this.helper, null, false);
|
|
83601
|
-
Scene$1.add(this.shadowHelper, null, false);
|
|
83602
|
-
this.addHolder(holderName, holderSize);
|
|
83603
|
-
this.addTargetHolder(targetHolderName, targetHolderSize);
|
|
83604
|
-
this.isUsingHelper = true;
|
|
83605
|
-
}
|
|
83606
|
-
}, {
|
|
83607
|
-
key: "update",
|
|
83608
|
-
value: function update(dt) {
|
|
83609
|
-
_get(_getPrototypeOf(SunLight.prototype), "update", this).call(this, dt);
|
|
83610
|
-
|
|
83611
|
-
if (this.usingHelper()) {
|
|
83612
|
-
this.helper.update();
|
|
83613
|
-
this.shadowHelper.update();
|
|
83614
|
-
}
|
|
83615
|
-
|
|
83616
|
-
if (this.hasHolder()) {
|
|
83617
|
-
this.setPosition(this.holder.getPosition(), {
|
|
83618
|
-
updateHolder: false
|
|
83619
|
-
});
|
|
83620
|
-
}
|
|
83621
|
-
}
|
|
83622
|
-
}, {
|
|
83623
|
-
key: "toJSON",
|
|
83624
|
-
value: function toJSON() {
|
|
83625
|
-
return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(SunLight.prototype), "toJSON", this).call(this)), {}, {
|
|
83626
|
-
target: this.getTarget(),
|
|
83627
|
-
bias: this.getBias(),
|
|
83628
|
-
mapSize: this.getMapSize(),
|
|
83629
|
-
shadowCamera: _objectSpread2$1(_objectSpread2$1({}, this.getShadowCameraNearFar()), {}, {
|
|
83630
|
-
fov: this.setShadowCameraFov()
|
|
83631
|
-
})
|
|
83632
|
-
});
|
|
83633
|
-
}
|
|
83634
|
-
}]);
|
|
83635
|
-
|
|
83636
|
-
return SunLight;
|
|
83637
|
-
}(Light$1);var DEFAULT_POSITION$2 = {
|
|
83638
|
-
x: 0,
|
|
83639
|
-
y: 0,
|
|
83640
|
-
z: 0
|
|
83641
|
-
};
|
|
83642
|
-
var DEFAULT_INTENSITY$3 = 0.5;
|
|
83643
|
-
var WHITE$2 = 0xffffff;
|
|
83644
|
-
|
|
83645
|
-
var AmbientLight = /*#__PURE__*/function (_Light) {
|
|
83646
|
-
_inherits(AmbientLight, _Light);
|
|
83647
|
-
|
|
83648
|
-
var _super = _createSuper(AmbientLight);
|
|
83649
|
-
|
|
83650
|
-
function AmbientLight() {
|
|
83651
|
-
var _this;
|
|
83652
|
-
|
|
83653
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
83654
|
-
|
|
83655
|
-
_classCallCheck(this, AmbientLight);
|
|
83656
|
-
|
|
83657
|
-
var _options$color = options.color,
|
|
83658
|
-
color = _options$color === void 0 ? WHITE$2 : _options$color,
|
|
83659
|
-
_options$intensity = options.intensity,
|
|
83660
|
-
intensity = _options$intensity === void 0 ? DEFAULT_INTENSITY$3 : _options$intensity,
|
|
83661
|
-
_options$name = options.name,
|
|
83662
|
-
name = _options$name === void 0 ? generateRandomName("AmbientLight") : _options$name;
|
|
83663
|
-
_this = _super.call(this, {
|
|
83664
|
-
color: color,
|
|
83665
|
-
intensity: intensity,
|
|
83666
|
-
name: name
|
|
83667
|
-
});
|
|
83668
|
-
_this.options = options;
|
|
83669
|
-
|
|
83670
|
-
_this.setLight({
|
|
83671
|
-
color: color,
|
|
83672
|
-
intensity: intensity
|
|
83673
|
-
});
|
|
83674
|
-
|
|
83675
|
-
_this.setEntityType(ENTITY_TYPES.LIGHT.AMBIENT);
|
|
83676
|
-
|
|
83677
|
-
_this.setName(name);
|
|
83678
|
-
|
|
83679
|
-
return _this;
|
|
83680
|
-
}
|
|
83681
|
-
|
|
83682
|
-
_createClass(AmbientLight, [{
|
|
83683
|
-
key: "setLight",
|
|
83684
|
-
value: function setLight(_ref) {
|
|
83685
|
-
var light = _ref.light,
|
|
83686
|
-
_ref$color = _ref.color,
|
|
83687
|
-
color = _ref$color === void 0 ? WHITE$2 : _ref$color,
|
|
83688
|
-
_ref$intensity = _ref.intensity,
|
|
83689
|
-
intensity = _ref$intensity === void 0 ? DEFAULT_INTENSITY$3 : _ref$intensity;
|
|
83690
|
-
|
|
83691
|
-
if (light) {
|
|
83692
|
-
this.setBody({
|
|
83693
|
-
body: light
|
|
83694
|
-
});
|
|
83695
|
-
} else {
|
|
83696
|
-
this.setBody({
|
|
83697
|
-
body: new AmbientLight$1(color, intensity)
|
|
83698
|
-
});
|
|
83699
|
-
}
|
|
83700
|
-
|
|
83701
|
-
if (this.hasBody()) {
|
|
83702
|
-
this.postLightCreation();
|
|
83703
|
-
}
|
|
83704
|
-
}
|
|
83705
|
-
}, {
|
|
83706
|
-
key: "postLightCreation",
|
|
83707
|
-
value: function postLightCreation() {
|
|
83708
|
-
var _this$options$positio = this.options.position,
|
|
83709
|
-
position = _this$options$positio === void 0 ? DEFAULT_POSITION$2 : _this$options$positio;
|
|
83710
|
-
this.setPosition(position);
|
|
83711
|
-
this.addToScene();
|
|
83712
|
-
}
|
|
83713
|
-
}, {
|
|
83714
|
-
key: "addHelpers",
|
|
83715
|
-
value: function addHelpers() {
|
|
83716
|
-
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
83717
|
-
_ref2$holderName = _ref2.holderName,
|
|
83718
|
-
holderName = _ref2$holderName === void 0 ? "ambientlightholder" : _ref2$holderName,
|
|
83719
|
-
_ref2$holderSize = _ref2.holderSize,
|
|
83720
|
-
holderSize = _ref2$holderSize === void 0 ? 0.05 : _ref2$holderSize;
|
|
83721
|
-
|
|
83722
|
-
this.addHolder(holderName, holderSize);
|
|
83723
|
-
this.isUsingHelper = true;
|
|
83724
|
-
}
|
|
83725
|
-
}, {
|
|
83726
|
-
key: "update",
|
|
83727
|
-
value: function update(dt) {
|
|
83728
|
-
_get(_getPrototypeOf(AmbientLight.prototype), "update", this).call(this, dt);
|
|
83729
|
-
|
|
83730
|
-
if (this.usingHelper()) {
|
|
83731
|
-
this.setPosition(this.holder.getPosition(), {
|
|
83732
|
-
updateHolder: false
|
|
83733
|
-
});
|
|
83734
|
-
}
|
|
83735
|
-
}
|
|
83736
|
-
}]);
|
|
83737
|
-
|
|
83738
|
-
return AmbientLight;
|
|
83739
|
-
}(Light$1);var DEFAULT_NEAR$1 = 0.1;
|
|
83740
|
-
var DEFAULT_FAR$1 = 100;
|
|
83741
|
-
var DEFAULT_POSITION$1 = {
|
|
83742
|
-
x: 0,
|
|
83743
|
-
y: 0,
|
|
83744
|
-
z: 0
|
|
83745
|
-
};
|
|
83746
|
-
var DEFAULT_INTENSITY$2 = 0.5;
|
|
83747
|
-
var DEFAULT_DISTANCE = 0;
|
|
83748
|
-
var DEFAULT_DECAY = 1;
|
|
83749
|
-
var DEFAULT_MAP_SIZE$1 = 2048;
|
|
83750
|
-
var DEFAULT_BIAS$1 = -0.0001;
|
|
83751
|
-
var WHITE$1 = 0xffffff;
|
|
83752
|
-
var GREEN$2 = 0x2ecc71;
|
|
83753
|
-
|
|
83754
|
-
var PointLight = /*#__PURE__*/function (_Light) {
|
|
83755
|
-
_inherits(PointLight, _Light);
|
|
83756
|
-
|
|
83757
|
-
var _super = _createSuper(PointLight);
|
|
83758
|
-
|
|
83759
|
-
function PointLight() {
|
|
83760
|
-
var _this;
|
|
83761
|
-
|
|
83762
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
83763
|
-
|
|
83764
|
-
_classCallCheck(this, PointLight);
|
|
83765
|
-
|
|
83766
|
-
var _options$color = options.color,
|
|
83767
|
-
color = _options$color === void 0 ? WHITE$1 : _options$color,
|
|
83768
|
-
_options$intensity = options.intensity,
|
|
83769
|
-
intensity = _options$intensity === void 0 ? DEFAULT_INTENSITY$2 : _options$intensity,
|
|
83770
|
-
_options$name = options.name,
|
|
83771
|
-
name = _options$name === void 0 ? generateRandomName("PointLight") : _options$name,
|
|
83772
|
-
distance = options.distance,
|
|
83773
|
-
decay = options.decay;
|
|
83774
|
-
_this = _super.call(this, {
|
|
83775
|
-
color: color,
|
|
83776
|
-
intensity: intensity,
|
|
83777
|
-
name: name
|
|
83778
|
-
});
|
|
83779
|
-
|
|
83780
|
-
_defineProperty$1(_assertThisInitialized(_this), "setShadowCameraNearFar", function () {
|
|
83781
|
-
var near = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_NEAR$1;
|
|
83782
|
-
var far = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_FAR$1;
|
|
83783
|
-
_this.near = near;
|
|
83784
|
-
_this.far = far;
|
|
83785
|
-
var d = _this.far / 2;
|
|
83786
|
-
_this.getBody().shadow.camera.left = -d;
|
|
83787
|
-
_this.getBody().shadow.camera.right = d;
|
|
83788
|
-
_this.getBody().shadow.camera.top = d;
|
|
83789
|
-
_this.getBody().shadow.camera.bottom = -d;
|
|
83790
|
-
_this.getBody().shadow.camera.near = near;
|
|
83791
|
-
_this.getBody().shadow.camera.far = far;
|
|
83792
|
-
});
|
|
83793
|
-
|
|
83794
|
-
_defineProperty$1(_assertThisInitialized(_this), "setBias", function () {
|
|
83795
|
-
var bias = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_BIAS$1;
|
|
83796
|
-
_this.bias = bias;
|
|
83797
|
-
_this.getBody().shadow.bias = bias;
|
|
83798
|
-
});
|
|
83799
|
-
|
|
83800
|
-
_this.options = options;
|
|
83801
|
-
|
|
83802
|
-
_this.setLight({
|
|
83803
|
-
color: color,
|
|
83804
|
-
intensity: intensity,
|
|
83805
|
-
distance: distance,
|
|
83806
|
-
decay: decay
|
|
83807
|
-
});
|
|
83808
|
-
|
|
83809
|
-
_this.setEntityType(ENTITY_TYPES.LIGHT.POINT);
|
|
83810
|
-
|
|
83811
|
-
_this.setName(name);
|
|
83812
|
-
|
|
83813
|
-
return _this;
|
|
83814
|
-
}
|
|
83815
|
-
|
|
83816
|
-
_createClass(PointLight, [{
|
|
83817
|
-
key: "setLight",
|
|
83818
|
-
value: function setLight(_ref) {
|
|
83819
|
-
var light = _ref.light,
|
|
83820
|
-
_ref$color = _ref.color,
|
|
83821
|
-
color = _ref$color === void 0 ? WHITE$1 : _ref$color,
|
|
83822
|
-
_ref$intensity = _ref.intensity,
|
|
83823
|
-
intensity = _ref$intensity === void 0 ? DEFAULT_INTENSITY$2 : _ref$intensity,
|
|
83824
|
-
_ref$distance = _ref.distance,
|
|
83825
|
-
distance = _ref$distance === void 0 ? DEFAULT_DISTANCE : _ref$distance,
|
|
83826
|
-
_ref$decay = _ref.decay,
|
|
83827
|
-
decay = _ref$decay === void 0 ? DEFAULT_DECAY : _ref$decay;
|
|
83828
|
-
|
|
83829
|
-
if (light) {
|
|
83830
|
-
this.setBody({
|
|
83831
|
-
body: light
|
|
83832
|
-
});
|
|
83833
|
-
} else {
|
|
83834
|
-
this.setBody({
|
|
83835
|
-
body: new PointLight$1(color, intensity)
|
|
83836
|
-
});
|
|
83837
|
-
this.setDistance(distance);
|
|
83838
|
-
this.setDecay(decay);
|
|
83839
|
-
}
|
|
83840
|
-
|
|
83841
|
-
if (this.hasBody()) {
|
|
83842
|
-
this.postLightCreation();
|
|
83843
|
-
}
|
|
83844
|
-
}
|
|
83845
|
-
}, {
|
|
83846
|
-
key: "postLightCreation",
|
|
83847
|
-
value: function postLightCreation() {
|
|
83848
|
-
var _this$options$positio = this.options.position,
|
|
83849
|
-
position = _this$options$positio === void 0 ? DEFAULT_POSITION$1 : _this$options$positio;
|
|
83850
|
-
this.setPosition(position);
|
|
83851
|
-
this.setLightShadows();
|
|
83852
|
-
this.addToScene();
|
|
83853
|
-
}
|
|
83854
|
-
}, {
|
|
83855
|
-
key: "setLightShadows",
|
|
83856
|
-
value: function setLightShadows() {
|
|
83857
|
-
var _this$options = this.options,
|
|
83858
|
-
_this$options$near = _this$options.near,
|
|
83859
|
-
near = _this$options$near === void 0 ? DEFAULT_NEAR$1 : _this$options$near,
|
|
83860
|
-
_this$options$far = _this$options.far,
|
|
83861
|
-
far = _this$options$far === void 0 ? DEFAULT_FAR$1 : _this$options$far,
|
|
83862
|
-
_this$options$mapSize = _this$options.mapSize,
|
|
83863
|
-
mapSize = _this$options$mapSize === void 0 ? DEFAULT_MAP_SIZE$1 : _this$options$mapSize,
|
|
83864
|
-
_this$options$bias = _this$options.bias,
|
|
83865
|
-
bias = _this$options$bias === void 0 ? DEFAULT_BIAS$1 : _this$options$bias;
|
|
83866
|
-
|
|
83867
|
-
if (Config$1.lights().shadows) {
|
|
83868
|
-
this.setCastShadow(true);
|
|
83869
|
-
this.setMapSize(mapSize);
|
|
83870
|
-
this.setShadowCameraNearFar(near, far);
|
|
83871
|
-
this.setBias(bias);
|
|
83872
|
-
}
|
|
83873
|
-
}
|
|
83874
|
-
}, {
|
|
83875
|
-
key: "setDistance",
|
|
83876
|
-
value: function setDistance() {
|
|
83877
|
-
var distance = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_DISTANCE;
|
|
83878
|
-
this.distance = distance;
|
|
83879
|
-
this.getBody().distance = distance;
|
|
83880
|
-
}
|
|
83881
|
-
}, {
|
|
83882
|
-
key: "getDistance",
|
|
83883
|
-
value: function getDistance() {
|
|
83884
|
-
return this.distance;
|
|
83885
|
-
}
|
|
83886
|
-
}, {
|
|
83887
|
-
key: "setDecay",
|
|
83888
|
-
value: function setDecay() {
|
|
83889
|
-
var decay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_DECAY;
|
|
83890
|
-
this.decay = decay;
|
|
83891
|
-
this.getBody().decay = decay;
|
|
83892
|
-
}
|
|
83893
|
-
}, {
|
|
83894
|
-
key: "getDecay",
|
|
83895
|
-
value: function getDecay() {
|
|
83896
|
-
return this.decay;
|
|
83897
|
-
}
|
|
83898
|
-
}, {
|
|
83899
|
-
key: "getShadowCameraNearFar",
|
|
83900
|
-
value: function getShadowCameraNearFar() {
|
|
83901
|
-
return {
|
|
83902
|
-
near: this.near,
|
|
83903
|
-
far: this.far
|
|
83904
|
-
};
|
|
83905
|
-
}
|
|
83906
|
-
}, {
|
|
83907
|
-
key: "setMapSize",
|
|
83908
|
-
value: function setMapSize() {
|
|
83909
|
-
var mapSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MAP_SIZE$1;
|
|
83910
|
-
this.mapSize = mapSize;
|
|
83911
|
-
this.getBody().shadow.mapSize.height = mapSize;
|
|
83912
|
-
this.getBody().shadow.mapSize.width = mapSize;
|
|
83913
|
-
}
|
|
83914
|
-
}, {
|
|
83915
|
-
key: "getMapSize",
|
|
83916
|
-
value: function getMapSize() {
|
|
83917
|
-
return this.mapSize;
|
|
83918
|
-
}
|
|
83919
|
-
}, {
|
|
83920
|
-
key: "getBias",
|
|
83921
|
-
value: function getBias() {
|
|
83922
|
-
return this.bias;
|
|
83923
|
-
}
|
|
83924
|
-
}, {
|
|
83925
|
-
key: "addHelpers",
|
|
83926
|
-
value: function addHelpers() {
|
|
83927
|
-
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
83928
|
-
_ref2$holderName = _ref2.holderName,
|
|
83929
|
-
holderName = _ref2$holderName === void 0 ? "pointlightholder" : _ref2$holderName,
|
|
83930
|
-
_ref2$holderSize = _ref2.holderSize,
|
|
83931
|
-
holderSize = _ref2$holderSize === void 0 ? 0.05 : _ref2$holderSize;
|
|
83932
|
-
|
|
83933
|
-
this.helper = new PointLightHelper(this.getBody(), 2, GREEN$2);
|
|
83934
|
-
this.shadowHelper = new CameraHelper(this.getBody().shadow.camera);
|
|
83935
|
-
Scene$1.add(this.helper, null, false);
|
|
83936
|
-
Scene$1.add(this.shadowHelper, null, false);
|
|
83937
|
-
this.addHolder(holderName, holderSize);
|
|
83938
|
-
this.isUsingHelper = true;
|
|
83939
|
-
}
|
|
83940
|
-
}, {
|
|
83941
|
-
key: "update",
|
|
83942
|
-
value: function update(dt) {
|
|
83943
|
-
_get(_getPrototypeOf(PointLight.prototype), "update", this).call(this, dt);
|
|
83944
|
-
|
|
83945
|
-
if (this.usingHelper()) {
|
|
83946
|
-
this.helper.update();
|
|
83947
|
-
this.shadowHelper.update();
|
|
83948
|
-
}
|
|
83949
|
-
|
|
83950
|
-
if (this.hasHolder()) {
|
|
83951
|
-
this.setPosition(this.holder.getPosition(), {
|
|
83952
|
-
updateHolder: false
|
|
83953
|
-
});
|
|
83954
|
-
}
|
|
83955
|
-
}
|
|
83956
|
-
}, {
|
|
83957
|
-
key: "toJSON",
|
|
83958
|
-
value: function toJSON() {
|
|
83959
|
-
return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(PointLight.prototype), "toJSON", this).call(this)), {}, {
|
|
83960
|
-
distance: this.getDistance(),
|
|
83961
|
-
decay: this.getDecay(),
|
|
83962
|
-
bias: this.getBias(),
|
|
83963
|
-
mapSize: this.getMapSize(),
|
|
83964
|
-
shadowCamera: this.getShadowCameraNearFar()
|
|
83965
|
-
});
|
|
83966
|
-
}
|
|
83967
|
-
}]);
|
|
83968
|
-
|
|
83969
|
-
return PointLight;
|
|
83970
|
-
}(Light$1);var LightLoader = /*#__PURE__*/function (_Loader) {
|
|
83971
|
-
_inherits(LightLoader, _Loader);
|
|
83972
|
-
|
|
83973
|
-
var _super = _createSuper(LightLoader);
|
|
83974
|
-
|
|
83975
|
-
function LightLoader() {
|
|
83976
|
-
var _this;
|
|
83977
|
-
|
|
83978
|
-
_classCallCheck(this, LightLoader);
|
|
83979
|
-
|
|
83980
|
-
_this = _super.call(this);
|
|
83981
|
-
|
|
83982
|
-
_defineProperty$1(_assertThisInitialized(_this), "createLight", function (useHelper) {
|
|
83983
|
-
return function (l) {
|
|
83984
|
-
var light;
|
|
83985
|
-
|
|
83986
|
-
switch (l.type) {
|
|
83987
|
-
case SUNLIGHT:
|
|
83988
|
-
light = _this.createSunlight(l);
|
|
83989
|
-
break;
|
|
83990
|
-
|
|
83991
|
-
case POINTLIGHT:
|
|
83992
|
-
light = _this.createPointlight(l);
|
|
83993
|
-
break;
|
|
83994
|
-
|
|
83995
|
-
case AMBIENTLIGHT:
|
|
83996
|
-
light = _this.createAmbientLight(l);
|
|
83997
|
-
break;
|
|
83998
|
-
}
|
|
83999
|
-
|
|
84000
|
-
if (light && useHelper) {
|
|
84001
|
-
light.addHelpers();
|
|
84002
|
-
}
|
|
84003
|
-
};
|
|
84004
|
-
});
|
|
84005
|
-
|
|
84006
|
-
return _this;
|
|
84007
|
-
}
|
|
84008
|
-
|
|
84009
|
-
_createClass(LightLoader, [{
|
|
84010
|
-
key: "load",
|
|
84011
|
-
value: function load(lights, _ref) {
|
|
84012
|
-
var _ref$useHelper = _ref.useHelper,
|
|
84013
|
-
useHelper = _ref$useHelper === void 0 ? false : _ref$useHelper;
|
|
84014
|
-
lights.forEach(this.createLight(useHelper));
|
|
84015
|
-
}
|
|
84016
|
-
}, {
|
|
84017
|
-
key: "createSunlight",
|
|
84018
|
-
value: function createSunlight(_ref2) {
|
|
84019
|
-
var color = _ref2.color,
|
|
84020
|
-
intensity = _ref2.intensity,
|
|
84021
|
-
position = _ref2.position,
|
|
84022
|
-
target = _ref2.target,
|
|
84023
|
-
name = _ref2.name;
|
|
84024
|
-
return new SunLight({
|
|
84025
|
-
color: color,
|
|
84026
|
-
intensity: intensity,
|
|
84027
|
-
position: position,
|
|
84028
|
-
target: target,
|
|
84029
|
-
name: name
|
|
84030
|
-
});
|
|
84031
|
-
}
|
|
84032
|
-
}, {
|
|
84033
|
-
key: "createAmbientLight",
|
|
84034
|
-
value: function createAmbientLight(_ref3) {
|
|
84035
|
-
var color = _ref3.color,
|
|
84036
|
-
intensity = _ref3.intensity,
|
|
84037
|
-
position = _ref3.position,
|
|
84038
|
-
name = _ref3.name;
|
|
84039
|
-
return new AmbientLight({
|
|
84040
|
-
color: color,
|
|
84041
|
-
intensity: intensity,
|
|
84042
|
-
position: position,
|
|
84043
|
-
name: name
|
|
84044
|
-
});
|
|
84045
|
-
}
|
|
84046
|
-
}, {
|
|
84047
|
-
key: "createPointlight",
|
|
84048
|
-
value: function createPointlight(_ref4) {
|
|
84049
|
-
var color = _ref4.color,
|
|
84050
|
-
intensity = _ref4.intensity,
|
|
84051
|
-
position = _ref4.position,
|
|
84052
|
-
distance = _ref4.distance,
|
|
84053
|
-
name = _ref4.name;
|
|
84054
|
-
return new PointLight({
|
|
84055
|
-
color: color,
|
|
84056
|
-
intensity: intensity,
|
|
84057
|
-
position: position,
|
|
84058
|
-
distance: distance,
|
|
84059
|
-
name: name
|
|
84060
|
-
});
|
|
84061
|
-
}
|
|
84062
|
-
}]);
|
|
84063
|
-
|
|
84064
|
-
return LightLoader;
|
|
84065
|
-
}(Loader);
|
|
84066
|
-
var LightLoader$1 = new LightLoader();var Pass = /*#__PURE__*/function () {
|
|
84067
|
-
function Pass() {
|
|
84068
|
-
_classCallCheck(this, Pass);
|
|
84069
|
-
|
|
84070
|
-
// if set to true, the pass is processed by the composer
|
|
84071
|
-
this.enabled = true; // if set to true, the pass indicates to swap read and write buffer after rendering
|
|
84072
|
-
|
|
84073
|
-
this.needsSwap = true; // if set to true, the pass clears its buffer before rendering
|
|
84074
|
-
|
|
84075
|
-
this.clear = false; // if set to true, the result of the pass is rendered to screen. This is set automatically by EffectComposer.
|
|
84076
|
-
|
|
84077
|
-
this.renderToScreen = false;
|
|
84078
|
-
this.isPass = true;
|
|
84079
|
-
}
|
|
84080
|
-
|
|
84081
|
-
_createClass(Pass, [{
|
|
84082
|
-
key: "setSize",
|
|
84083
|
-
value: function setSize() {}
|
|
84084
|
-
}, {
|
|
84085
|
-
key: "render",
|
|
84086
|
-
value: function render() {
|
|
84087
|
-
console.error('THREE.Pass: .render() must be implemented in derived pass.');
|
|
84088
|
-
}
|
|
84089
|
-
}]);
|
|
84090
|
-
|
|
84091
|
-
return Pass;
|
|
84092
|
-
}(); // Helper for passes that need to fill the viewport with a single quad.
|
|
84093
|
-
|
|
84094
|
-
var _camera = new OrthographicCamera(-1, 1, 1, -1, 0, 1); // https://github.com/mrdoob/three.js/pull/21358
|
|
84095
|
-
|
|
84096
|
-
|
|
84097
|
-
var _geometry = new BufferGeometry();
|
|
84098
|
-
|
|
84099
|
-
_geometry.setAttribute('position', new Float32BufferAttribute([-1, 3, 0, -1, -1, 0, 3, -1, 0], 3));
|
|
84100
|
-
|
|
84101
|
-
_geometry.setAttribute('uv', new Float32BufferAttribute([0, 2, 0, 0, 2, 0], 2));
|
|
84102
|
-
|
|
84103
|
-
var FullScreenQuad = /*#__PURE__*/function () {
|
|
84104
|
-
function FullScreenQuad(material) {
|
|
84105
|
-
_classCallCheck(this, FullScreenQuad);
|
|
84106
|
-
|
|
84107
|
-
this._mesh = new Mesh(_geometry, material);
|
|
84108
|
-
}
|
|
84109
|
-
|
|
84110
|
-
_createClass(FullScreenQuad, [{
|
|
84111
|
-
key: "dispose",
|
|
84112
|
-
value: function dispose() {
|
|
84113
|
-
this._mesh.geometry.dispose();
|
|
84114
|
-
}
|
|
84115
|
-
}, {
|
|
84116
|
-
key: "render",
|
|
84117
|
-
value: function render(renderer) {
|
|
84118
|
-
renderer.render(this._mesh, _camera);
|
|
84119
|
-
}
|
|
84120
|
-
}, {
|
|
84121
|
-
key: "material",
|
|
84122
|
-
get: function get() {
|
|
84123
|
-
return this._mesh.material;
|
|
84124
|
-
},
|
|
84125
|
-
set: function set(value) {
|
|
84126
|
-
this._mesh.material = value;
|
|
84127
|
-
}
|
|
84128
|
-
}]);
|
|
84129
|
-
|
|
84130
|
-
return FullScreenQuad;
|
|
84131
|
-
}();var ShaderPass = /*#__PURE__*/function (_Pass) {
|
|
84132
|
-
_inherits(ShaderPass, _Pass);
|
|
84133
|
-
|
|
84134
|
-
var _super = _createSuper(ShaderPass);
|
|
84135
|
-
|
|
84136
|
-
function ShaderPass(shader, textureID) {
|
|
84137
|
-
var _this;
|
|
84138
|
-
|
|
84139
|
-
_classCallCheck(this, ShaderPass);
|
|
84140
|
-
|
|
84141
|
-
_this = _super.call(this);
|
|
84142
|
-
_this.textureID = textureID !== undefined ? textureID : 'tDiffuse';
|
|
84143
|
-
|
|
84144
|
-
if (shader instanceof ShaderMaterial) {
|
|
84145
|
-
_this.uniforms = shader.uniforms;
|
|
84146
|
-
_this.material = shader;
|
|
84147
|
-
} else if (shader) {
|
|
84148
|
-
_this.uniforms = UniformsUtils.clone(shader.uniforms);
|
|
84149
|
-
_this.material = new ShaderMaterial({
|
|
84150
|
-
defines: Object.assign({}, shader.defines),
|
|
84151
|
-
uniforms: _this.uniforms,
|
|
84152
|
-
vertexShader: shader.vertexShader,
|
|
84153
|
-
fragmentShader: shader.fragmentShader
|
|
84154
|
-
});
|
|
84155
|
-
}
|
|
84156
|
-
|
|
84157
|
-
_this.fsQuad = new FullScreenQuad(_this.material);
|
|
84158
|
-
return _this;
|
|
84159
|
-
}
|
|
84160
|
-
|
|
84161
|
-
_createClass(ShaderPass, [{
|
|
84162
|
-
key: "render",
|
|
84163
|
-
value: function render(renderer, writeBuffer, readBuffer
|
|
84164
|
-
/*, deltaTime, maskActive */
|
|
84165
|
-
) {
|
|
84166
|
-
if (this.uniforms[this.textureID]) {
|
|
84167
|
-
this.uniforms[this.textureID].value = readBuffer.texture;
|
|
84168
|
-
}
|
|
84169
|
-
|
|
84170
|
-
this.fsQuad.material = this.material;
|
|
84171
|
-
|
|
84172
|
-
if (this.renderToScreen) {
|
|
84173
|
-
renderer.setRenderTarget(null);
|
|
84174
|
-
this.fsQuad.render(renderer);
|
|
84175
|
-
} else {
|
|
84176
|
-
renderer.setRenderTarget(writeBuffer); // TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600
|
|
84177
|
-
|
|
84178
|
-
if (this.clear) renderer.clear(renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil);
|
|
84179
|
-
this.fsQuad.render(renderer);
|
|
84180
|
-
}
|
|
84181
|
-
}
|
|
84182
|
-
}]);
|
|
84183
|
-
|
|
84184
|
-
return ShaderPass;
|
|
84185
|
-
}(Pass);/**
|
|
84186
|
-
* Full-screen textured quad shader
|
|
84187
|
-
*/
|
|
84188
|
-
var CopyShader = {
|
|
84189
|
-
uniforms: {
|
|
84190
|
-
'tDiffuse': {
|
|
84191
|
-
value: null
|
|
84192
|
-
},
|
|
84193
|
-
'opacity': {
|
|
84194
|
-
value: 1.0
|
|
84195
|
-
}
|
|
84196
|
-
},
|
|
84197
|
-
vertexShader:
|
|
84198
|
-
/* glsl */
|
|
84199
|
-
"\n\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
|
|
84200
|
-
fragmentShader:
|
|
84201
|
-
/* glsl */
|
|
84202
|
-
"\n\n uniform float opacity;\n\n uniform sampler2D tDiffuse;\n\n varying vec2 vUv;\n\n void main() {\n gl_FragColor = texture2D( tDiffuse, vUv );\n gl_FragColor.a *= opacity;\n }"
|
|
84203
|
-
};var MaskPass = /*#__PURE__*/function (_Pass) {
|
|
84204
|
-
_inherits(MaskPass, _Pass);
|
|
84205
|
-
|
|
84206
|
-
var _super = _createSuper(MaskPass);
|
|
84207
|
-
|
|
84208
|
-
function MaskPass(scene, camera) {
|
|
84209
|
-
var _this;
|
|
84210
|
-
|
|
84211
|
-
_classCallCheck(this, MaskPass);
|
|
84212
|
-
|
|
84213
|
-
_this = _super.call(this);
|
|
84214
|
-
_this.scene = scene;
|
|
84215
|
-
_this.camera = camera;
|
|
84216
|
-
_this.clear = true;
|
|
84217
|
-
_this.needsSwap = false;
|
|
84218
|
-
_this.inverse = false;
|
|
84219
|
-
return _this;
|
|
84220
|
-
}
|
|
84221
|
-
|
|
84222
|
-
_createClass(MaskPass, [{
|
|
84223
|
-
key: "render",
|
|
84224
|
-
value: function render(renderer, writeBuffer, readBuffer
|
|
84225
|
-
/*, deltaTime, maskActive */
|
|
84226
|
-
) {
|
|
84227
|
-
var context = renderer.getContext();
|
|
84228
|
-
var state = renderer.state; // don't update color or depth
|
|
84229
|
-
|
|
84230
|
-
state.buffers.color.setMask(false);
|
|
84231
|
-
state.buffers.depth.setMask(false); // lock buffers
|
|
84232
|
-
|
|
84233
|
-
state.buffers.color.setLocked(true);
|
|
84234
|
-
state.buffers.depth.setLocked(true); // set up stencil
|
|
84235
|
-
|
|
84236
|
-
var writeValue, clearValue;
|
|
84237
|
-
|
|
84238
|
-
if (this.inverse) {
|
|
84239
|
-
writeValue = 0;
|
|
84240
|
-
clearValue = 1;
|
|
84241
|
-
} else {
|
|
84242
|
-
writeValue = 1;
|
|
84243
|
-
clearValue = 0;
|
|
84244
|
-
}
|
|
84245
|
-
|
|
84246
|
-
state.buffers.stencil.setTest(true);
|
|
84247
|
-
state.buffers.stencil.setOp(context.REPLACE, context.REPLACE, context.REPLACE);
|
|
84248
|
-
state.buffers.stencil.setFunc(context.ALWAYS, writeValue, 0xffffffff);
|
|
84249
|
-
state.buffers.stencil.setClear(clearValue);
|
|
84250
|
-
state.buffers.stencil.setLocked(true); // draw into the stencil buffer
|
|
84251
|
-
|
|
84252
|
-
renderer.setRenderTarget(readBuffer);
|
|
84253
|
-
if (this.clear) renderer.clear();
|
|
84254
|
-
renderer.render(this.scene, this.camera);
|
|
84255
|
-
renderer.setRenderTarget(writeBuffer);
|
|
84256
|
-
if (this.clear) renderer.clear();
|
|
84257
|
-
renderer.render(this.scene, this.camera); // unlock color and depth buffer for subsequent rendering
|
|
84258
|
-
|
|
84259
|
-
state.buffers.color.setLocked(false);
|
|
84260
|
-
state.buffers.depth.setLocked(false); // only render where stencil is set to 1
|
|
84261
|
-
|
|
84262
|
-
state.buffers.stencil.setLocked(false);
|
|
84263
|
-
state.buffers.stencil.setFunc(context.EQUAL, 1, 0xffffffff); // draw if == 1
|
|
84264
|
-
|
|
84265
|
-
state.buffers.stencil.setOp(context.KEEP, context.KEEP, context.KEEP);
|
|
84266
|
-
state.buffers.stencil.setLocked(true);
|
|
84267
|
-
}
|
|
84268
|
-
}]);
|
|
84269
|
-
|
|
84270
|
-
return MaskPass;
|
|
84271
|
-
}(Pass);var ClearMaskPass = /*#__PURE__*/function (_Pass) {
|
|
84272
|
-
_inherits(ClearMaskPass, _Pass);
|
|
84273
|
-
|
|
84274
|
-
var _super = _createSuper(ClearMaskPass);
|
|
84275
|
-
|
|
84276
|
-
function ClearMaskPass() {
|
|
84277
|
-
var _this;
|
|
84278
|
-
|
|
84279
|
-
_classCallCheck(this, ClearMaskPass);
|
|
84280
|
-
|
|
84281
|
-
_this = _super.call(this);
|
|
84282
|
-
_this.needsSwap = false;
|
|
84283
|
-
return _this;
|
|
84284
|
-
}
|
|
84285
|
-
|
|
84286
|
-
_createClass(ClearMaskPass, [{
|
|
84287
|
-
key: "render",
|
|
84288
|
-
value: function render(renderer
|
|
84289
|
-
/*, writeBuffer, readBuffer, deltaTime, maskActive */
|
|
84290
|
-
) {
|
|
84291
|
-
renderer.state.buffers.stencil.setLocked(false);
|
|
84292
|
-
renderer.state.buffers.stencil.setTest(false);
|
|
84293
|
-
}
|
|
84294
|
-
}]);
|
|
84295
|
-
|
|
84296
|
-
return ClearMaskPass;
|
|
84297
|
-
}(Pass);var EffectComposer = /*#__PURE__*/function () {
|
|
84298
|
-
function EffectComposer(renderer, renderTarget) {
|
|
84299
|
-
var _this = this;
|
|
84300
|
-
|
|
84301
|
-
_classCallCheck(this, EffectComposer);
|
|
84302
|
-
|
|
84303
|
-
_defineProperty$1(this, "ensureLastPassIsRendered", function () {
|
|
84304
|
-
_this.passes.forEach(function (pass, index) {
|
|
84305
|
-
return pass.renderToScreen = index === _this.passes.length - 1;
|
|
84306
|
-
});
|
|
84307
|
-
});
|
|
84308
|
-
|
|
84309
|
-
this.renderer = renderer;
|
|
84310
|
-
|
|
84311
|
-
if (renderTarget === undefined) {
|
|
84312
|
-
var size = renderer.getSize(new Vector2());
|
|
84313
|
-
this._pixelRatio = renderer.getPixelRatio();
|
|
84314
|
-
this._width = size.width;
|
|
84315
|
-
this._height = size.height;
|
|
84316
|
-
renderTarget = new WebGLRenderTarget(this._width * this._pixelRatio, this._height * this._pixelRatio);
|
|
84317
|
-
renderTarget.texture.name = 'EffectComposer.rt1';
|
|
84318
|
-
} else {
|
|
84319
|
-
this._pixelRatio = 1;
|
|
84320
|
-
this._width = renderTarget.width;
|
|
84321
|
-
this._height = renderTarget.height;
|
|
84322
|
-
}
|
|
84323
|
-
|
|
84324
|
-
this.renderTarget1 = renderTarget;
|
|
84325
|
-
this.renderTarget2 = renderTarget.clone();
|
|
84326
|
-
this.renderTarget2.texture.name = 'EffectComposer.rt2';
|
|
84327
|
-
this.writeBuffer = this.renderTarget1;
|
|
84328
|
-
this.readBuffer = this.renderTarget2;
|
|
84329
|
-
this.renderToScreen = true;
|
|
84330
|
-
this.passes = []; // dependencies
|
|
84331
|
-
|
|
84332
|
-
if (CopyShader === undefined) {
|
|
84333
|
-
console.error('THREE.EffectComposer relies on CopyShader');
|
|
84334
|
-
}
|
|
84335
|
-
|
|
84336
|
-
if (ShaderPass === undefined) {
|
|
84337
|
-
console.error('THREE.EffectComposer relies on ShaderPass');
|
|
84338
|
-
}
|
|
84339
|
-
|
|
84340
|
-
this.copyPass = new ShaderPass(CopyShader);
|
|
84341
|
-
this.clock = new Clock();
|
|
84342
|
-
}
|
|
84343
|
-
|
|
84344
|
-
_createClass(EffectComposer, [{
|
|
84345
|
-
key: "swapBuffers",
|
|
84346
|
-
value: function swapBuffers() {
|
|
84347
|
-
var tmp = this.readBuffer;
|
|
84348
|
-
this.readBuffer = this.writeBuffer;
|
|
84349
|
-
this.writeBuffer = tmp;
|
|
84350
|
-
}
|
|
84351
|
-
}, {
|
|
84352
|
-
key: "addPass",
|
|
84353
|
-
value: function addPass(pass) {
|
|
84354
|
-
this.passes.push(pass);
|
|
84355
|
-
pass.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);
|
|
84356
|
-
}
|
|
84357
|
-
}, {
|
|
84358
|
-
key: "insertPass",
|
|
84359
|
-
value: function insertPass(pass, index) {
|
|
84360
|
-
this.passes.splice(index, 0, pass);
|
|
84361
|
-
pass.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);
|
|
84362
|
-
}
|
|
84363
|
-
}, {
|
|
84364
|
-
key: "removePass",
|
|
84365
|
-
value: function removePass(pass) {
|
|
84366
|
-
var index = this.passes.indexOf(pass);
|
|
84367
|
-
|
|
84368
|
-
if (index !== -1) {
|
|
84369
|
-
this.passes.splice(index, 1);
|
|
84370
|
-
}
|
|
84371
|
-
}
|
|
84372
|
-
}, {
|
|
84373
|
-
key: "isLastEnabledPass",
|
|
84374
|
-
value: function isLastEnabledPass(passIndex) {
|
|
84375
|
-
for (var i = passIndex + 1; i < this.passes.length; i++) {
|
|
84376
|
-
if (this.passes[i].enabled) {
|
|
84377
|
-
return false;
|
|
84378
|
-
}
|
|
84379
|
-
}
|
|
84380
|
-
|
|
84381
|
-
return true;
|
|
84382
|
-
}
|
|
84383
|
-
}, {
|
|
84384
|
-
key: "render",
|
|
84385
|
-
value: function render(deltaTime) {
|
|
84386
|
-
// deltaTime value is in seconds
|
|
84387
|
-
if (deltaTime === undefined) {
|
|
84388
|
-
deltaTime = this.clock.getDelta();
|
|
84389
|
-
}
|
|
84390
|
-
|
|
84391
|
-
var currentRenderTarget = this.renderer.getRenderTarget();
|
|
84392
|
-
var maskActive = false;
|
|
84393
|
-
|
|
84394
|
-
for (var i = 0, il = this.passes.length; i < il; i++) {
|
|
84395
|
-
var pass = this.passes[i];
|
|
84396
|
-
if (pass.enabled === false) continue;
|
|
84397
|
-
pass.renderToScreen = this.renderToScreen && this.isLastEnabledPass(i);
|
|
84398
|
-
pass.render(this.renderer, this.writeBuffer, this.readBuffer, deltaTime, maskActive);
|
|
84399
|
-
|
|
84400
|
-
if (pass.needsSwap) {
|
|
84401
|
-
if (maskActive) {
|
|
84402
|
-
var context = this.renderer.getContext();
|
|
84403
|
-
var stencil = this.renderer.state.buffers.stencil; //context.stencilFunc(context.NOTEQUAL, 1, 0xffffffff);
|
|
84404
|
-
|
|
84405
|
-
stencil.setFunc(context.NOTEQUAL, 1, 0xffffffff);
|
|
84406
|
-
this.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer, deltaTime); //context.stencilFunc(context.EQUAL, 1, 0xffffffff);
|
|
84407
|
-
|
|
84408
|
-
stencil.setFunc(context.EQUAL, 1, 0xffffffff);
|
|
84409
|
-
}
|
|
84410
|
-
|
|
84411
|
-
this.swapBuffers();
|
|
84412
|
-
}
|
|
84413
|
-
|
|
84414
|
-
if (MaskPass !== undefined) {
|
|
84415
|
-
if (pass instanceof MaskPass) {
|
|
84416
|
-
maskActive = true;
|
|
84417
|
-
} else if (pass instanceof ClearMaskPass) {
|
|
84418
|
-
maskActive = false;
|
|
84419
|
-
}
|
|
84420
|
-
}
|
|
84421
|
-
}
|
|
84422
|
-
|
|
84423
|
-
this.renderer.setRenderTarget(currentRenderTarget);
|
|
84424
|
-
}
|
|
84425
|
-
}, {
|
|
84426
|
-
key: "reset",
|
|
84427
|
-
value: function reset(renderTarget) {
|
|
84428
|
-
if (renderTarget === undefined) {
|
|
84429
|
-
var size = this.renderer.getSize(new Vector2());
|
|
84430
|
-
this._pixelRatio = this.renderer.getPixelRatio();
|
|
84431
|
-
this._width = size.width;
|
|
84432
|
-
this._height = size.height;
|
|
84433
|
-
renderTarget = this.renderTarget1.clone();
|
|
84434
|
-
renderTarget.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);
|
|
84435
|
-
}
|
|
84436
|
-
|
|
84437
|
-
this.renderTarget1.dispose();
|
|
84438
|
-
this.renderTarget2.dispose();
|
|
84439
|
-
this.renderTarget1 = renderTarget;
|
|
84440
|
-
this.renderTarget2 = renderTarget.clone();
|
|
84441
|
-
this.writeBuffer = this.renderTarget1;
|
|
84442
|
-
this.readBuffer = this.renderTarget2;
|
|
84443
|
-
}
|
|
84444
|
-
}, {
|
|
84445
|
-
key: "setSize",
|
|
84446
|
-
value: function setSize(width, height) {
|
|
84447
|
-
this._width = width;
|
|
84448
|
-
this._height = height;
|
|
84449
|
-
var effectiveWidth = this._width * this._pixelRatio;
|
|
84450
|
-
var effectiveHeight = this._height * this._pixelRatio;
|
|
84451
|
-
this.renderTarget1.setSize(effectiveWidth, effectiveHeight);
|
|
84452
|
-
this.renderTarget2.setSize(effectiveWidth, effectiveHeight);
|
|
84453
|
-
|
|
84454
|
-
for (var i = 0; i < this.passes.length; i++) {
|
|
84455
|
-
this.passes[i].setSize(effectiveWidth, effectiveHeight);
|
|
84456
|
-
}
|
|
84457
|
-
}
|
|
84458
|
-
}, {
|
|
84459
|
-
key: "setPixelRatio",
|
|
84460
|
-
value: function setPixelRatio(pixelRatio) {
|
|
84461
|
-
this._pixelRatio = pixelRatio;
|
|
84462
|
-
this.setSize(this._width, this._height);
|
|
84463
|
-
}
|
|
84464
|
-
}]);
|
|
84465
|
-
|
|
84466
|
-
return EffectComposer;
|
|
84467
|
-
}();var RenderPass = /*#__PURE__*/function (_Pass) {
|
|
84468
|
-
_inherits(RenderPass, _Pass);
|
|
84469
|
-
|
|
84470
|
-
var _super = _createSuper(RenderPass);
|
|
84471
|
-
|
|
84472
|
-
function RenderPass(scene, camera, overrideMaterial, clearColor, clearAlpha) {
|
|
84473
|
-
var _this;
|
|
84474
|
-
|
|
84475
|
-
_classCallCheck(this, RenderPass);
|
|
83488
|
+
_classCallCheck(this, RenderPass);
|
|
84476
83489
|
|
|
84477
83490
|
_this = _super.call(this);
|
|
84478
83491
|
_this.scene = scene;
|
|
@@ -90419,9 +89432,9 @@ var Controls = /*#__PURE__*/function () {
|
|
|
90419
89432
|
return Controls;
|
|
90420
89433
|
}();
|
|
90421
89434
|
var Controls$1 = new Controls();var author = {
|
|
90422
|
-
name:
|
|
90423
|
-
email:
|
|
90424
|
-
website:
|
|
89435
|
+
name: "Marco Stagni",
|
|
89436
|
+
email: "mrc.stagni@gmail.com",
|
|
89437
|
+
website: "http://mage.studio"
|
|
90425
89438
|
};
|
|
90426
89439
|
var Level = /*#__PURE__*/function (_EventDispatcher) {
|
|
90427
89440
|
_inherits(Level, _EventDispatcher);
|
|
@@ -90437,30 +89450,23 @@ var Level = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
90437
89450
|
|
|
90438
89451
|
_defineProperty$1(_assertThisInitialized(_this), "onStateChange", function (state) {});
|
|
90439
89452
|
|
|
90440
|
-
_defineProperty$1(_assertThisInitialized(_this), "parseScene", function (_ref) {
|
|
90441
|
-
|
|
90442
|
-
|
|
90443
|
-
|
|
90444
|
-
|
|
90445
|
-
|
|
90446
|
-
|
|
90447
|
-
|
|
90448
|
-
|
|
90449
|
-
|
|
90450
|
-
|
|
90451
|
-
|
|
90452
|
-
|
|
90453
|
-
|
|
90454
|
-
|
|
90455
|
-
|
|
90456
|
-
|
|
90457
|
-
if (lights.length) {
|
|
90458
|
-
LightLoader$1.load(lights, options);
|
|
90459
|
-
}
|
|
90460
|
-
|
|
90461
|
-
Scene$1.updateChildren();
|
|
90462
|
-
resolve();
|
|
90463
|
-
});
|
|
89453
|
+
_defineProperty$1(_assertThisInitialized(_this), "parseScene", function (_ref) {// return new Promise((resolve, reject) => {
|
|
89454
|
+
// if (elements.length) {
|
|
89455
|
+
// for (let i in models) {
|
|
89456
|
+
// elements.push(models[i]);
|
|
89457
|
+
// }
|
|
89458
|
+
// MeshLoader.load(elements, options);
|
|
89459
|
+
// }
|
|
89460
|
+
// if (lights.length) {
|
|
89461
|
+
// LightLoader.load(lights, options);
|
|
89462
|
+
// }
|
|
89463
|
+
// Scene.updateChildren();
|
|
89464
|
+
// resolve();
|
|
89465
|
+
// })
|
|
89466
|
+
|
|
89467
|
+
_ref.elements;
|
|
89468
|
+
_ref.models;
|
|
89469
|
+
_ref.lights;
|
|
90464
89470
|
});
|
|
90465
89471
|
|
|
90466
89472
|
_defineProperty$1(_assertThisInitialized(_this), "getJSONUrl", function () {
|
|
@@ -91209,50 +90215,607 @@ var DEFAULT_RADIAL_SEGMENTS = 8;
|
|
|
91209
90215
|
var DEFAULT_HEIGHT_SEGMENTS = 1;
|
|
91210
90216
|
var DEFAULT_OPENENDED = false;
|
|
91211
90217
|
|
|
91212
|
-
var Cone = /*#__PURE__*/function (_Element) {
|
|
91213
|
-
_inherits(Cone, _Element);
|
|
90218
|
+
var Cone = /*#__PURE__*/function (_Element) {
|
|
90219
|
+
_inherits(Cone, _Element);
|
|
90220
|
+
|
|
90221
|
+
var _super = _createSuper(Cone);
|
|
90222
|
+
|
|
90223
|
+
function Cone() {
|
|
90224
|
+
var _this;
|
|
90225
|
+
|
|
90226
|
+
var radius = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_RADIUS;
|
|
90227
|
+
var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_HEIGHT;
|
|
90228
|
+
var color = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Color.randomColor(true);
|
|
90229
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
90230
|
+
|
|
90231
|
+
_classCallCheck(this, Cone);
|
|
90232
|
+
|
|
90233
|
+
_this = _super.call(this, options);
|
|
90234
|
+
var _options$radialSegmen = options.radialSegments,
|
|
90235
|
+
radialSegments = _options$radialSegmen === void 0 ? DEFAULT_RADIAL_SEGMENTS : _options$radialSegmen,
|
|
90236
|
+
_options$heightSegmen = options.heightSegments,
|
|
90237
|
+
heightSegments = _options$heightSegmen === void 0 ? DEFAULT_HEIGHT_SEGMENTS : _options$heightSegmen,
|
|
90238
|
+
_options$openEnded = options.openEnded,
|
|
90239
|
+
openEnded = _options$openEnded === void 0 ? DEFAULT_OPENENDED : _options$openEnded;
|
|
90240
|
+
var geometry = new ConeGeometry(radius, height, radialSegments, heightSegments, openEnded);
|
|
90241
|
+
var material = new MeshBasicMaterial(_objectSpread2$1({
|
|
90242
|
+
color: color,
|
|
90243
|
+
wireframe: false
|
|
90244
|
+
}, options));
|
|
90245
|
+
|
|
90246
|
+
_this.setBody({
|
|
90247
|
+
geometry: geometry,
|
|
90248
|
+
material: material
|
|
90249
|
+
});
|
|
90250
|
+
|
|
90251
|
+
_this.setEntityType(ENTITY_TYPES.MESH);
|
|
90252
|
+
|
|
90253
|
+
return _this;
|
|
90254
|
+
}
|
|
90255
|
+
|
|
90256
|
+
return Cone;
|
|
90257
|
+
}(Element$1);var DEFAULT_SETUP_CONFIG$1 = {
|
|
90258
|
+
deferred: false
|
|
90259
|
+
};
|
|
90260
|
+
|
|
90261
|
+
var Sound$1 = /*#__PURE__*/function (_Entity) {
|
|
90262
|
+
_inherits(Sound, _Entity);
|
|
90263
|
+
|
|
90264
|
+
var _super = _createSuper(Sound);
|
|
90265
|
+
|
|
90266
|
+
function Sound() {
|
|
90267
|
+
var _this;
|
|
90268
|
+
|
|
90269
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
90270
|
+
|
|
90271
|
+
_classCallCheck(this, Sound);
|
|
90272
|
+
|
|
90273
|
+
var source = options.source,
|
|
90274
|
+
_options$loop = options.loop,
|
|
90275
|
+
loop = _options$loop === void 0 ? false : _options$loop,
|
|
90276
|
+
loopStart = options.loopStart,
|
|
90277
|
+
loopEnd = options.loopEnd,
|
|
90278
|
+
autoplay = options.autoplay,
|
|
90279
|
+
reconnectOnReset = options.reconnectOnReset,
|
|
90280
|
+
_options$setupConfig = options.setupConfig,
|
|
90281
|
+
setupConfig = _options$setupConfig === void 0 ? DEFAULT_SETUP_CONFIG$1 : _options$setupConfig,
|
|
90282
|
+
_options$name = options.name,
|
|
90283
|
+
name = _options$name === void 0 ? generateRandomName("sound") : _options$name;
|
|
90284
|
+
_this = _super.call(this, _objectSpread2$1(_objectSpread2$1({}, options), {}, {
|
|
90285
|
+
source: source,
|
|
90286
|
+
loop: loop,
|
|
90287
|
+
loopStart: loopStart,
|
|
90288
|
+
loopEnd: loopEnd,
|
|
90289
|
+
autoplay: autoplay,
|
|
90290
|
+
reconnectOnReset: reconnectOnReset,
|
|
90291
|
+
name: name
|
|
90292
|
+
}));
|
|
90293
|
+
|
|
90294
|
+
_defineProperty$1(_assertThisInitialized(_this), "reset", function () {
|
|
90295
|
+
_this.playing = false;
|
|
90296
|
+
|
|
90297
|
+
_this.disconnect();
|
|
90298
|
+
|
|
90299
|
+
_this.setupAudio();
|
|
90300
|
+
|
|
90301
|
+
_this.connect();
|
|
90302
|
+
});
|
|
90303
|
+
|
|
90304
|
+
_this.setupConfig = setupConfig;
|
|
90305
|
+
_this.source = source;
|
|
90306
|
+
_this.loop = loop;
|
|
90307
|
+
_this.loopStart = loopStart;
|
|
90308
|
+
_this.loopEnd = loopEnd;
|
|
90309
|
+
_this.autoplay = autoplay;
|
|
90310
|
+
_this.reconnectOnReset = reconnectOnReset;
|
|
90311
|
+
_this.name = name;
|
|
90312
|
+
_this.connected = false;
|
|
90313
|
+
_this.playing = false;
|
|
90314
|
+
_this.setupCompleted = false;
|
|
90315
|
+
_this.hasPlayed = false;
|
|
90316
|
+
_this.buffer = null;
|
|
90317
|
+
_this.audioNode = null;
|
|
90318
|
+
_this.volumeNode = null;
|
|
90319
|
+
_this.detuneValue = 0;
|
|
90320
|
+
|
|
90321
|
+
if (!_this.setupConfig.deferred) {
|
|
90322
|
+
_this.setupAudio();
|
|
90323
|
+
}
|
|
90324
|
+
|
|
90325
|
+
_this.setName(name);
|
|
90326
|
+
|
|
90327
|
+
_this.setBody({
|
|
90328
|
+
body: new Object3D()
|
|
90329
|
+
});
|
|
90330
|
+
|
|
90331
|
+
_this.setEntityType(ENTITY_TYPES.AUDIO.DEFAULT);
|
|
90332
|
+
|
|
90333
|
+
Scene$1.add(_this.getBody(), _assertThisInitialized(_this));
|
|
90334
|
+
Audio$1.add(_assertThisInitialized(_this));
|
|
90335
|
+
|
|
90336
|
+
if (_this.isSetupCompleted()) {
|
|
90337
|
+
_this.connect();
|
|
90338
|
+
}
|
|
90339
|
+
|
|
90340
|
+
return _this;
|
|
90341
|
+
}
|
|
90342
|
+
|
|
90343
|
+
_createClass(Sound, [{
|
|
90344
|
+
key: "addHelpers",
|
|
90345
|
+
value: function addHelpers() {
|
|
90346
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
90347
|
+
_ref$holderName = _ref.holderName,
|
|
90348
|
+
holderName = _ref$holderName === void 0 ? "soundholder" : _ref$holderName,
|
|
90349
|
+
_ref$holderSize = _ref.holderSize,
|
|
90350
|
+
holderSize = _ref$holderSize === void 0 ? 0.05 : _ref$holderSize;
|
|
90351
|
+
|
|
90352
|
+
var holderSprite = new HelperSprite(holderSize, holderSize, holderName, {
|
|
90353
|
+
name: holderName
|
|
90354
|
+
});
|
|
90355
|
+
|
|
90356
|
+
if (holderSprite) {
|
|
90357
|
+
holderSprite.setSizeAttenuation(false);
|
|
90358
|
+
holderSprite.setDepthTest(false);
|
|
90359
|
+
holderSprite.setDepthWrite(false);
|
|
90360
|
+
holderSprite.setSerializable(false);
|
|
90361
|
+
holderSprite.setPosition(this.getPosition());
|
|
90362
|
+
holderSprite.addTags([TAGS.HELPER, TAGS.SOUNDS.HELPER, TAGS.SOUNDS.HOLDER, name]);
|
|
90363
|
+
holderSprite.setHelperTarget(this);
|
|
90364
|
+
this.holder = holderSprite;
|
|
90365
|
+
return true;
|
|
90366
|
+
} else {
|
|
90367
|
+
console.warn(LIGHT_HOLDER_MODEL_NOT_FOUND);
|
|
90368
|
+
return false;
|
|
90369
|
+
}
|
|
90370
|
+
}
|
|
90371
|
+
}, {
|
|
90372
|
+
key: "isPlaying",
|
|
90373
|
+
value: function isPlaying() {
|
|
90374
|
+
return this.playing;
|
|
90375
|
+
}
|
|
90376
|
+
}, {
|
|
90377
|
+
key: "isSetupCompleted",
|
|
90378
|
+
value: function isSetupCompleted() {
|
|
90379
|
+
return this.setupCompleted;
|
|
90380
|
+
}
|
|
90381
|
+
}, {
|
|
90382
|
+
key: "isConnected",
|
|
90383
|
+
value: function isConnected() {
|
|
90384
|
+
return this.connected;
|
|
90385
|
+
}
|
|
90386
|
+
}, {
|
|
90387
|
+
key: "setupAudio",
|
|
90388
|
+
value: function setupAudio() {
|
|
90389
|
+
this.createAudioNode();
|
|
90390
|
+
this.createVolumeNode();
|
|
90391
|
+
this.setBuffer();
|
|
90392
|
+
this.setupAudioNodeLoop();
|
|
90393
|
+
this.audioNode.removeEventListener(ENTITY_EVENTS.AUDIO.ENDED, this.onSoundEnded.bind(this));
|
|
90394
|
+
this.audioNode.addEventListener(ENTITY_EVENTS.AUDIO.ENDED, this.onSoundEnded.bind(this));
|
|
90395
|
+
this.setupCompleted = true;
|
|
90396
|
+
}
|
|
90397
|
+
}, {
|
|
90398
|
+
key: "setSource",
|
|
90399
|
+
value: function setSource(source) {
|
|
90400
|
+
this.source = source;
|
|
90401
|
+
}
|
|
90402
|
+
}, {
|
|
90403
|
+
key: "getSource",
|
|
90404
|
+
value: function getSource() {
|
|
90405
|
+
return this.source;
|
|
90406
|
+
}
|
|
90407
|
+
}, {
|
|
90408
|
+
key: "createAudioNode",
|
|
90409
|
+
value: function createAudioNode() {
|
|
90410
|
+
this.audioNode = Audio$1.context.createBufferSource();
|
|
90411
|
+
}
|
|
90412
|
+
}, {
|
|
90413
|
+
key: "setupAudioNodeLoop",
|
|
90414
|
+
value: function setupAudioNodeLoop() {
|
|
90415
|
+
this.audioNode.loop = this.loop;
|
|
90416
|
+
this.audioNode.loopEnd = this.loopEnd === undefined ? this.duration : this.loopEnd;
|
|
90417
|
+
this.audioNode.loopStart = this.loopStart === undefined ? this.duration : this.loopStart;
|
|
90418
|
+
}
|
|
90419
|
+
}, {
|
|
90420
|
+
key: "createVolumeNode",
|
|
90421
|
+
value: function createVolumeNode() {
|
|
90422
|
+
this.volumeNode = Audio$1.context.createGain();
|
|
90423
|
+
this.volumeNode.gain.value = DEFAULT_AUDIO_NODE_VOLUME;
|
|
90424
|
+
}
|
|
90425
|
+
}, {
|
|
90426
|
+
key: "tryAutoplay",
|
|
90427
|
+
value: function tryAutoplay() {
|
|
90428
|
+
if (this.autoplay && !this.hasPlayed && !this.setupConfig.deferred) {
|
|
90429
|
+
this.play();
|
|
90430
|
+
}
|
|
90431
|
+
}
|
|
90432
|
+
}, {
|
|
90433
|
+
key: "connect",
|
|
90434
|
+
value: function connect() {
|
|
90435
|
+
if (this.isConnected()) {
|
|
90436
|
+
this.disconnect();
|
|
90437
|
+
}
|
|
90438
|
+
|
|
90439
|
+
this.volumeNode.connect(Audio$1.getMasterVolumeNode());
|
|
90440
|
+
this.audioNode.connect(this.volumeNode);
|
|
90441
|
+
this.connected = true;
|
|
90442
|
+
this.tryAutoplay();
|
|
90443
|
+
}
|
|
90444
|
+
}, {
|
|
90445
|
+
key: "disconnect",
|
|
90446
|
+
value: function disconnect() {
|
|
90447
|
+
if (this.isConnected()) {
|
|
90448
|
+
this.volumeNode.disconnect();
|
|
90449
|
+
this.audioNode.disconnect();
|
|
90450
|
+
this.connected = false;
|
|
90451
|
+
}
|
|
90452
|
+
}
|
|
90453
|
+
}, {
|
|
90454
|
+
key: "dispose",
|
|
90455
|
+
value: function dispose() {
|
|
90456
|
+
_get(_getPrototypeOf(Sound.prototype), "dispose", this).call(this);
|
|
90457
|
+
|
|
90458
|
+
this.stop();
|
|
90459
|
+
this.disconnect();
|
|
90460
|
+
}
|
|
90461
|
+
}, {
|
|
90462
|
+
key: "getVolume",
|
|
90463
|
+
value: function getVolume() {
|
|
90464
|
+
return this.volumeNode ? this.volumeNode.gain.value : Audio$1.getVolume();
|
|
90465
|
+
}
|
|
90466
|
+
}, {
|
|
90467
|
+
key: "setVolume",
|
|
90468
|
+
value: function setVolume() {
|
|
90469
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_AUDIO_NODE_VOLUME;
|
|
90470
|
+
this.volumeNode.gain.setValueAtTime(value, Audio$1.context.currentTime);
|
|
90471
|
+
}
|
|
90472
|
+
}, {
|
|
90473
|
+
key: "hasBuffer",
|
|
90474
|
+
value: function hasBuffer() {
|
|
90475
|
+
return !!this.buffer;
|
|
90476
|
+
}
|
|
90477
|
+
}, {
|
|
90478
|
+
key: "setBuffer",
|
|
90479
|
+
value: function setBuffer() {
|
|
90480
|
+
if (!this.getSource()) {
|
|
90481
|
+
console.error(AUDIO_SOURCE_NOT_DEFINED);
|
|
90482
|
+
return false;
|
|
90483
|
+
}
|
|
90484
|
+
|
|
90485
|
+
var buffer = Audio$1.get(this.source);
|
|
90486
|
+
|
|
90487
|
+
if (!buffer) {
|
|
90488
|
+
console.error(AUDIO_UNABLE_TO_LOAD_SOUND);
|
|
90489
|
+
return false;
|
|
90490
|
+
}
|
|
90491
|
+
|
|
90492
|
+
this.buffer = buffer;
|
|
90493
|
+
this.audioNode.buffer = buffer;
|
|
90494
|
+
return true;
|
|
90495
|
+
}
|
|
90496
|
+
}, {
|
|
90497
|
+
key: "play",
|
|
90498
|
+
value: function play() {
|
|
90499
|
+
var volume = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getVolume();
|
|
90500
|
+
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_AUDIO_NODE_RAMP_TIME;
|
|
90501
|
+
var ramp = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : AUDIO_RAMPS.LINEAR;
|
|
90502
|
+
if (this.isPlaying()) return this;
|
|
90503
|
+
if (!this.isSetupCompleted()) this.setupAudio();
|
|
90504
|
+
if (!this.isConnected()) this.connect();
|
|
90505
|
+
console.log("goin to start playing at volume", volume, this.source);
|
|
90506
|
+
this.setVolume(0);
|
|
90507
|
+
this.audioNode.start();
|
|
90508
|
+
this.hasPlayed = true;
|
|
90509
|
+
this.playing = true;
|
|
90510
|
+
var audioDelay = delay / 1000; // linearRampToValueAtTime/exponentialRampToValueAtTime requires time to be expressed in seconds
|
|
90511
|
+
|
|
90512
|
+
if (ramp === AUDIO_RAMPS.LINEAR) {
|
|
90513
|
+
this.volumeNode.gain.linearRampToValueAtTime(volume, Audio$1.context.currentTime + audioDelay);
|
|
90514
|
+
} else {
|
|
90515
|
+
this.volumeNode.gain.exponentialRampToValueAtTime(volume, Audio$1.context.currentTime + audioDelay);
|
|
90516
|
+
}
|
|
90517
|
+
|
|
90518
|
+
return this;
|
|
90519
|
+
}
|
|
90520
|
+
}, {
|
|
90521
|
+
key: "onSoundEnded",
|
|
90522
|
+
value: function onSoundEnded() {
|
|
90523
|
+
this.reset();
|
|
90524
|
+
this.dispatchEvent({
|
|
90525
|
+
type: ENTITY_EVENTS.AUDIO.ENDED
|
|
90526
|
+
});
|
|
90527
|
+
}
|
|
90528
|
+
}, {
|
|
90529
|
+
key: "stop",
|
|
90530
|
+
value: function stop() {
|
|
90531
|
+
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_AUDIO_NODE_RAMP_TIME;
|
|
90532
|
+
var ramp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : AUDIO_RAMPS.LINEAR;
|
|
90533
|
+
var audioDelay = delay / 1000; // linearRampToValueAtTime/exponentialRampToValueAtTime requires time to be expressed in seconds
|
|
90534
|
+
|
|
90535
|
+
if (ramp === AUDIO_RAMPS.LINEAR) {
|
|
90536
|
+
this.volumeNode.gain.linearRampToValueAtTime(ALMOST_ZERO, Audio$1.context.currentTime + audioDelay);
|
|
90537
|
+
} else {
|
|
90538
|
+
this.volumeNode.gain.exponentialRampToValueAtTime(ALMOST_ZERO, Audio$1.context.currentTime + audioDelay);
|
|
90539
|
+
}
|
|
90540
|
+
|
|
90541
|
+
setTimeout(this.reset, delay);
|
|
90542
|
+
return this;
|
|
90543
|
+
}
|
|
90544
|
+
}, {
|
|
90545
|
+
key: "detune",
|
|
90546
|
+
value: function detune(value) {
|
|
90547
|
+
if (this.audioNode) {
|
|
90548
|
+
this.detuneValue = value;
|
|
90549
|
+
this.audioNode.detune.value = this.detuneValue;
|
|
90550
|
+
}
|
|
90551
|
+
}
|
|
90552
|
+
}, {
|
|
90553
|
+
key: "getDetune",
|
|
90554
|
+
value: function getDetune() {
|
|
90555
|
+
return this.detuneValue;
|
|
90556
|
+
}
|
|
90557
|
+
}, {
|
|
90558
|
+
key: "addEffect",
|
|
90559
|
+
value: function addEffect(effect) {
|
|
90560
|
+
if (!this.hasEffect() && effect) {
|
|
90561
|
+
this.convolverNode = Audio$1.context.createConvolver();
|
|
90562
|
+
this.mixerNode = Audio$1.createGain();
|
|
90563
|
+
|
|
90564
|
+
if (this.hasPannerNode()) {
|
|
90565
|
+
this.pannerNode.disconnect();
|
|
90566
|
+
this.pannerNode.connect(this.mixerNode);
|
|
90567
|
+
} else {
|
|
90568
|
+
this.volumeNode.disconnect();
|
|
90569
|
+
this.volumeNode.connect(this.mixerNode);
|
|
90570
|
+
} //creating gains
|
|
90571
|
+
|
|
90572
|
+
|
|
90573
|
+
this.plainGainNode = Audio$1.context.createGain();
|
|
90574
|
+
this.convolverGainNode = Audio$1.context.createGain(); //connect mixer to new gains
|
|
90575
|
+
|
|
90576
|
+
this.mixerNode.connect(this.plainGainNode);
|
|
90577
|
+
this.mixerNode.connect(this.convolverGainNode);
|
|
90578
|
+
this.plainGainNode.connect(Audio$1.getMasterVolumeNode());
|
|
90579
|
+
this.convolverGainNode.connect(Audio$1.getMasterVolumeNode());
|
|
90580
|
+
this.convolverNode.buffer = Audio$1.get(effect);
|
|
90581
|
+
this.convolverGainNode.gain.setValueAtTime(0.7, Audio$1.context.currentTime);
|
|
90582
|
+
this.plainGainNode.gain.setValueAtTime(0.3, Audio$1.context.currentTime);
|
|
90583
|
+
}
|
|
90584
|
+
}
|
|
90585
|
+
}, {
|
|
90586
|
+
key: "setPosition",
|
|
90587
|
+
value: function setPosition(where) {
|
|
90588
|
+
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
90589
|
+
_ref2$updateHolder = _ref2.updateHolder,
|
|
90590
|
+
updateHolder = _ref2$updateHolder === void 0 ? true : _ref2$updateHolder;
|
|
90591
|
+
|
|
90592
|
+
var position = _objectSpread2$1(_objectSpread2$1({}, this.getPosition()), where);
|
|
90593
|
+
|
|
90594
|
+
var x = position.x,
|
|
90595
|
+
y = position.y,
|
|
90596
|
+
z = position.z;
|
|
90597
|
+
|
|
90598
|
+
if (this.hasBody()) {
|
|
90599
|
+
this.body.position.set(x, y, z);
|
|
90600
|
+
}
|
|
90601
|
+
|
|
90602
|
+
if (this.hasHolder() && updateHolder) {
|
|
90603
|
+
this.holder.setPosition({
|
|
90604
|
+
x: x,
|
|
90605
|
+
y: y,
|
|
90606
|
+
z: z
|
|
90607
|
+
});
|
|
90608
|
+
}
|
|
90609
|
+
}
|
|
90610
|
+
}, {
|
|
90611
|
+
key: "usingHelper",
|
|
90612
|
+
value: function usingHelper() {
|
|
90613
|
+
return !!this.isUsingHelper;
|
|
90614
|
+
}
|
|
90615
|
+
}, {
|
|
90616
|
+
key: "hasHolder",
|
|
90617
|
+
value: function hasHolder() {
|
|
90618
|
+
return !!this.holder;
|
|
90619
|
+
}
|
|
90620
|
+
}, {
|
|
90621
|
+
key: "toJSON",
|
|
90622
|
+
value: function toJSON() {
|
|
90623
|
+
return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(Sound.prototype), "toJSON", this).call(this)), {}, {
|
|
90624
|
+
source: this.source,
|
|
90625
|
+
loop: this.loop,
|
|
90626
|
+
loopStart: this.loopStart,
|
|
90627
|
+
loopEnd: this.loopEnd,
|
|
90628
|
+
autoplay: this.autoplay,
|
|
90629
|
+
volume: this.getVolume(),
|
|
90630
|
+
detune: this.getDetune(),
|
|
90631
|
+
hasPlayed: this.hasPlayed,
|
|
90632
|
+
playing: this.isPlaying(),
|
|
90633
|
+
connected: this.isConnected(),
|
|
90634
|
+
duration: this.hasBuffer() ? this.duration : 0,
|
|
90635
|
+
sampleRate: this.hasBuffer() ? this.sampleRate : 0,
|
|
90636
|
+
numberOfChannels: this.hasBuffer() ? this.numberOfChannels : 0
|
|
90637
|
+
});
|
|
90638
|
+
}
|
|
90639
|
+
}, {
|
|
90640
|
+
key: "sampleRate",
|
|
90641
|
+
get: function get() {
|
|
90642
|
+
return this.buffer.sampleRate;
|
|
90643
|
+
}
|
|
90644
|
+
}, {
|
|
90645
|
+
key: "duration",
|
|
90646
|
+
get: function get() {
|
|
90647
|
+
return this.buffer.duration * 1000;
|
|
90648
|
+
}
|
|
90649
|
+
}, {
|
|
90650
|
+
key: "numberOfChannels",
|
|
90651
|
+
get: function get() {
|
|
90652
|
+
return this.buffer.numberOfChannels;
|
|
90653
|
+
}
|
|
90654
|
+
}]);
|
|
90655
|
+
|
|
90656
|
+
return Sound;
|
|
90657
|
+
}(Entity);var _excluded$2 = ["name"];
|
|
90658
|
+
|
|
90659
|
+
var AmbientSound = /*#__PURE__*/function (_Sound) {
|
|
90660
|
+
_inherits(AmbientSound, _Sound);
|
|
90661
|
+
|
|
90662
|
+
var _super = _createSuper(AmbientSound);
|
|
90663
|
+
|
|
90664
|
+
function AmbientSound(source) {
|
|
90665
|
+
var _this;
|
|
90666
|
+
|
|
90667
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
90668
|
+
_ref$name = _ref.name,
|
|
90669
|
+
name = _ref$name === void 0 ? generateRandomName("AmbientSound") : _ref$name,
|
|
90670
|
+
options = _objectWithoutProperties(_ref, _excluded$2);
|
|
90671
|
+
|
|
90672
|
+
_classCallCheck(this, AmbientSound);
|
|
90673
|
+
|
|
90674
|
+
_this = _super.call(this, _objectSpread2$1({
|
|
90675
|
+
source: source,
|
|
90676
|
+
name: name
|
|
90677
|
+
}, options));
|
|
90678
|
+
|
|
90679
|
+
_this.setEntityType(ENTITY_TYPES.AUDIO.AMBIENT);
|
|
90680
|
+
|
|
90681
|
+
return _this;
|
|
90682
|
+
}
|
|
90683
|
+
|
|
90684
|
+
return AmbientSound;
|
|
90685
|
+
}(Sound$1);var _excluded$1 = ["name"];
|
|
90686
|
+
|
|
90687
|
+
var DirectionalSound = /*#__PURE__*/function (_Sound) {
|
|
90688
|
+
_inherits(DirectionalSound, _Sound);
|
|
91214
90689
|
|
|
91215
|
-
var _super = _createSuper(
|
|
90690
|
+
var _super = _createSuper(DirectionalSound);
|
|
91216
90691
|
|
|
91217
|
-
function
|
|
90692
|
+
function DirectionalSound(source) {
|
|
91218
90693
|
var _this;
|
|
91219
90694
|
|
|
91220
|
-
var
|
|
91221
|
-
|
|
91222
|
-
|
|
91223
|
-
|
|
90695
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
90696
|
+
_ref$name = _ref.name,
|
|
90697
|
+
name = _ref$name === void 0 ? generateRandomName("DirectionalSound") : _ref$name,
|
|
90698
|
+
options = _objectWithoutProperties(_ref, _excluded$1);
|
|
91224
90699
|
|
|
91225
|
-
_classCallCheck(this,
|
|
90700
|
+
_classCallCheck(this, DirectionalSound);
|
|
91226
90701
|
|
|
91227
|
-
_this = _super.call(this,
|
|
91228
|
-
|
|
91229
|
-
|
|
91230
|
-
_options$heightSegmen = options.heightSegments,
|
|
91231
|
-
heightSegments = _options$heightSegmen === void 0 ? DEFAULT_HEIGHT_SEGMENTS : _options$heightSegmen,
|
|
91232
|
-
_options$openEnded = options.openEnded,
|
|
91233
|
-
openEnded = _options$openEnded === void 0 ? DEFAULT_OPENENDED : _options$openEnded;
|
|
91234
|
-
var geometry = new ConeGeometry(radius, height, radialSegments, heightSegments, openEnded);
|
|
91235
|
-
var material = new MeshBasicMaterial(_objectSpread2$1({
|
|
91236
|
-
color: color,
|
|
91237
|
-
wireframe: false
|
|
90702
|
+
_this = _super.call(this, _objectSpread2$1({
|
|
90703
|
+
source: source,
|
|
90704
|
+
name: name
|
|
91238
90705
|
}, options));
|
|
91239
90706
|
|
|
91240
|
-
_this.
|
|
91241
|
-
geometry: geometry,
|
|
91242
|
-
material: material
|
|
91243
|
-
});
|
|
91244
|
-
|
|
91245
|
-
_this.setEntityType(ENTITY_TYPES.MESH);
|
|
90707
|
+
_this.setEntityType(ENTITY_TYPES.AUDIO.DIRECTIONAL);
|
|
91246
90708
|
|
|
91247
90709
|
return _this;
|
|
91248
90710
|
}
|
|
91249
90711
|
|
|
91250
|
-
|
|
91251
|
-
|
|
90712
|
+
_createClass(DirectionalSound, [{
|
|
90713
|
+
key: "setupAudio",
|
|
90714
|
+
value: function setupAudio() {
|
|
90715
|
+
_get(_getPrototypeOf(DirectionalSound.prototype), "setupAudio", this).call(this);
|
|
90716
|
+
|
|
90717
|
+
this.createPannerNode(this.options);
|
|
90718
|
+
}
|
|
90719
|
+
}, {
|
|
90720
|
+
key: "hasPannerNode",
|
|
90721
|
+
value: function hasPannerNode() {
|
|
90722
|
+
return !!this.pannerNode;
|
|
90723
|
+
}
|
|
90724
|
+
}, {
|
|
90725
|
+
key: "createPannerNode",
|
|
90726
|
+
value: function createPannerNode() {
|
|
90727
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
90728
|
+
var _options$coneInnerAng = options.coneInnerAngleDegrees,
|
|
90729
|
+
coneInnerAngleDegrees = _options$coneInnerAng === void 0 ? 360 : _options$coneInnerAng,
|
|
90730
|
+
_options$coneOuterAng = options.coneOuterAngleDegrees,
|
|
90731
|
+
coneOuterAngleDegrees = _options$coneOuterAng === void 0 ? 0 : _options$coneOuterAng,
|
|
90732
|
+
_options$coneOuterGai = options.coneOuterGain,
|
|
90733
|
+
coneOuterGain = _options$coneOuterGai === void 0 ? 0 : _options$coneOuterGai,
|
|
90734
|
+
_options$maxDistance = options.maxDistance,
|
|
90735
|
+
maxDistance = _options$maxDistance === void 0 ? 10000 : _options$maxDistance,
|
|
90736
|
+
_options$rolloffFacto = options.rolloffFactor,
|
|
90737
|
+
rolloffFactor = _options$rolloffFacto === void 0 ? 1 : _options$rolloffFacto,
|
|
90738
|
+
_options$refDistance = options.refDistance,
|
|
90739
|
+
refDistance = _options$refDistance === void 0 ? 1 : _options$refDistance;
|
|
90740
|
+
this.pannerNode = Audio$1.context.createPanner();
|
|
90741
|
+
this.pannerNode.panningModel = "HRTF";
|
|
90742
|
+
this.pannerNode.distanceModel = "inverse";
|
|
90743
|
+
this.pannerNode.refDistance = refDistance;
|
|
90744
|
+
this.pannerNode.maxDistance = maxDistance;
|
|
90745
|
+
this.pannerNode.rolloffFactor = rolloffFactor;
|
|
90746
|
+
this.pannerNode.coneInnerAngle = coneInnerAngleDegrees;
|
|
90747
|
+
this.pannerNode.coneOuterAngle = coneOuterAngleDegrees;
|
|
90748
|
+
this.pannerNode.coneOuterGain = coneOuterGain;
|
|
90749
|
+
}
|
|
90750
|
+
}, {
|
|
90751
|
+
key: "connect",
|
|
90752
|
+
value: function connect() {
|
|
90753
|
+
if (this.connected) {
|
|
90754
|
+
this.disconnect();
|
|
90755
|
+
}
|
|
90756
|
+
|
|
90757
|
+
this.volumeNode.connect(Audio$1.getMasterVolumeNode());
|
|
90758
|
+
this.pannerNode.connect(this.volumeNode);
|
|
90759
|
+
this.audioNode.connect(this.pannerNode);
|
|
90760
|
+
this.connected = true;
|
|
90761
|
+
this.tryAutoplay();
|
|
90762
|
+
}
|
|
90763
|
+
}, {
|
|
90764
|
+
key: "disconnect",
|
|
90765
|
+
value: function disconnect() {
|
|
90766
|
+
if (this.connected) {
|
|
90767
|
+
this.volumeNode.disconnect();
|
|
90768
|
+
this.pannerNode.disconnect();
|
|
90769
|
+
this.audioNode.disconnect();
|
|
90770
|
+
this.connected = false;
|
|
90771
|
+
}
|
|
90772
|
+
}
|
|
90773
|
+
}, {
|
|
90774
|
+
key: "updatePannerOrientation",
|
|
90775
|
+
value: function updatePannerOrientation() {
|
|
90776
|
+
var vec = new Vector3$1(0, 0, 1);
|
|
90777
|
+
var m = this.getBody().matrixWorld;
|
|
90778
|
+
var mx = m.elements[12],
|
|
90779
|
+
my = m.elements[13],
|
|
90780
|
+
mz = m.elements[14];
|
|
90781
|
+
m.elements[12] = m.elements[13] = m.elements[14] = 0;
|
|
90782
|
+
vec.applyMatrix4(m);
|
|
90783
|
+
vec.normalize();
|
|
90784
|
+
this.pannerNode.orientationX.setValueAtTime(vec.x, Audio$1.context.currentTime);
|
|
90785
|
+
this.pannerNode.orientationY.setValueAtTime(vec.y, Audio$1.context.currentTime);
|
|
90786
|
+
this.pannerNode.orientationZ.setValueAtTime(vec.z, Audio$1.context.currentTime);
|
|
90787
|
+
m.elements[12] = mx;
|
|
90788
|
+
m.elements[13] = my;
|
|
90789
|
+
m.elements[14] = mz;
|
|
90790
|
+
}
|
|
90791
|
+
}, {
|
|
90792
|
+
key: "updatePannerPosition",
|
|
90793
|
+
value: function updatePannerPosition() {
|
|
90794
|
+
this.getBody().updateMatrixWorld();
|
|
90795
|
+
var position = new Vector3$1();
|
|
90796
|
+
position.setFromMatrixPosition(this.getBody().matrixWorld);
|
|
90797
|
+
this.pannerNode.positionX.setValueAtTime(position.x, Audio$1.context.currentTime);
|
|
90798
|
+
this.pannerNode.positionY.setValueAtTime(position.y, Audio$1.context.currentTime);
|
|
90799
|
+
this.pannerNode.positionZ.setValueAtTime(position.z, Audio$1.context.currentTime);
|
|
90800
|
+
}
|
|
90801
|
+
}, {
|
|
90802
|
+
key: "update",
|
|
90803
|
+
value: function update(dt) {
|
|
90804
|
+
_get(_getPrototypeOf(DirectionalSound.prototype), "update", this).call(this, dt);
|
|
90805
|
+
|
|
90806
|
+
if (this.hasPannerNode()) {
|
|
90807
|
+
this.updatePannerOrientation();
|
|
90808
|
+
this.updatePannerPosition();
|
|
90809
|
+
}
|
|
90810
|
+
}
|
|
90811
|
+
}]);
|
|
90812
|
+
|
|
90813
|
+
return DirectionalSound;
|
|
90814
|
+
}(Sound$1);var DEFAULT_SETUP_CONFIG = {
|
|
91252
90815
|
deferred: false
|
|
91253
90816
|
};
|
|
91254
90817
|
|
|
91255
|
-
var Sound
|
|
90818
|
+
var Sound = /*#__PURE__*/function (_Entity) {
|
|
91256
90819
|
_inherits(Sound, _Entity);
|
|
91257
90820
|
|
|
91258
90821
|
var _super = _createSuper(Sound);
|
|
@@ -91272,7 +90835,7 @@ var Sound$1 = /*#__PURE__*/function (_Entity) {
|
|
|
91272
90835
|
autoplay = options.autoplay,
|
|
91273
90836
|
reconnectOnReset = options.reconnectOnReset,
|
|
91274
90837
|
_options$setupConfig = options.setupConfig,
|
|
91275
|
-
setupConfig = _options$setupConfig === void 0 ? DEFAULT_SETUP_CONFIG
|
|
90838
|
+
setupConfig = _options$setupConfig === void 0 ? DEFAULT_SETUP_CONFIG : _options$setupConfig,
|
|
91276
90839
|
_options$name = options.name,
|
|
91277
90840
|
name = _options$name === void 0 ? generateRandomName("sound") : _options$name;
|
|
91278
90841
|
_this = _super.call(this, _objectSpread2$1(_objectSpread2$1({}, options), {}, {
|
|
@@ -91614,703 +91177,960 @@ var Sound$1 = /*#__PURE__*/function (_Entity) {
|
|
|
91614
91177
|
}, {
|
|
91615
91178
|
key: "toJSON",
|
|
91616
91179
|
value: function toJSON() {
|
|
91617
|
-
return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(Sound.prototype), "toJSON", this).call(this)), {}, {
|
|
91618
|
-
source: this.source,
|
|
91619
|
-
loop: this.loop,
|
|
91620
|
-
loopStart: this.loopStart,
|
|
91621
|
-
loopEnd: this.loopEnd,
|
|
91622
|
-
autoplay: this.autoplay,
|
|
91623
|
-
volume: this.getVolume(),
|
|
91624
|
-
detune: this.getDetune(),
|
|
91625
|
-
hasPlayed: this.hasPlayed,
|
|
91626
|
-
playing: this.isPlaying(),
|
|
91627
|
-
connected: this.isConnected(),
|
|
91628
|
-
duration: this.hasBuffer() ? this.duration : 0,
|
|
91629
|
-
sampleRate: this.hasBuffer() ? this.sampleRate : 0,
|
|
91630
|
-
numberOfChannels: this.hasBuffer() ? this.numberOfChannels : 0
|
|
91180
|
+
return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(Sound.prototype), "toJSON", this).call(this)), {}, {
|
|
91181
|
+
source: this.source,
|
|
91182
|
+
loop: this.loop,
|
|
91183
|
+
loopStart: this.loopStart,
|
|
91184
|
+
loopEnd: this.loopEnd,
|
|
91185
|
+
autoplay: this.autoplay,
|
|
91186
|
+
volume: this.getVolume(),
|
|
91187
|
+
detune: this.getDetune(),
|
|
91188
|
+
hasPlayed: this.hasPlayed,
|
|
91189
|
+
playing: this.isPlaying(),
|
|
91190
|
+
connected: this.isConnected(),
|
|
91191
|
+
duration: this.hasBuffer() ? this.duration : 0,
|
|
91192
|
+
sampleRate: this.hasBuffer() ? this.sampleRate : 0,
|
|
91193
|
+
numberOfChannels: this.hasBuffer() ? this.numberOfChannels : 0
|
|
91194
|
+
});
|
|
91195
|
+
}
|
|
91196
|
+
}, {
|
|
91197
|
+
key: "sampleRate",
|
|
91198
|
+
get: function get() {
|
|
91199
|
+
return this.buffer.sampleRate;
|
|
91200
|
+
}
|
|
91201
|
+
}, {
|
|
91202
|
+
key: "duration",
|
|
91203
|
+
get: function get() {
|
|
91204
|
+
return this.buffer.duration * 1000;
|
|
91205
|
+
}
|
|
91206
|
+
}, {
|
|
91207
|
+
key: "numberOfChannels",
|
|
91208
|
+
get: function get() {
|
|
91209
|
+
return this.buffer.numberOfChannels;
|
|
91210
|
+
}
|
|
91211
|
+
}]);
|
|
91212
|
+
|
|
91213
|
+
return Sound;
|
|
91214
|
+
}(Entity);var BLOB_TYPE = 'application/javascript';
|
|
91215
|
+
var createBlob = function createBlob(task) {
|
|
91216
|
+
return new Blob(['(', task.toString(), ')()'], {
|
|
91217
|
+
type: BLOB_TYPE
|
|
91218
|
+
});
|
|
91219
|
+
};
|
|
91220
|
+
var createWorker = function createWorker(task, message) {
|
|
91221
|
+
if (Features$1.isFeatureSupported(FEATURES.WEBWORKER)) {
|
|
91222
|
+
var url = URL.createObjectURL(createBlob(task));
|
|
91223
|
+
var worker = new Worker(url); // Won't be needing this anymore
|
|
91224
|
+
|
|
91225
|
+
URL.revokeObjectURL(url);
|
|
91226
|
+
|
|
91227
|
+
if (message) {
|
|
91228
|
+
worker.postMessage(message);
|
|
91229
|
+
}
|
|
91230
|
+
|
|
91231
|
+
return worker;
|
|
91232
|
+
} else {
|
|
91233
|
+
console.error(WORKERS_NOT_AVAILABLE);
|
|
91234
|
+
return null;
|
|
91235
|
+
}
|
|
91236
|
+
};
|
|
91237
|
+
var createPromiseWorker = function createPromiseWorker(task, message) {
|
|
91238
|
+
return new Promise(function (resolve, reject) {
|
|
91239
|
+
var worker = createWorker(task, message);
|
|
91240
|
+
|
|
91241
|
+
if (worker) {
|
|
91242
|
+
worker.onmessage = function (data) {
|
|
91243
|
+
resolve(data);
|
|
91244
|
+
worker.terminate();
|
|
91245
|
+
};
|
|
91246
|
+
} else {
|
|
91247
|
+
reject(WORKERS_NOT_AVAILABLE);
|
|
91248
|
+
}
|
|
91249
|
+
});
|
|
91250
|
+
};var workers=/*#__PURE__*/Object.freeze({__proto__:null,createBlob:createBlob,createWorker:createWorker,createPromiseWorker:createPromiseWorker});var HIT_BOX_COLOR = 0xf368e0;
|
|
91251
|
+
var HIT_BOX_INCREASE = .03;
|
|
91252
|
+
var DEFAULT_HITBOX_OPTIONS = {
|
|
91253
|
+
shadowsEnabled: false
|
|
91254
|
+
};
|
|
91255
|
+
var getBoxHitbox = function getBoxHitbox(element) {
|
|
91256
|
+
var size = new Vector3$1();
|
|
91257
|
+
element.boundingBox.getSize(size);
|
|
91258
|
+
var scaledSize = {
|
|
91259
|
+
x: size.x + HIT_BOX_INCREASE,
|
|
91260
|
+
y: size.y + HIT_BOX_INCREASE,
|
|
91261
|
+
z: size.z + HIT_BOX_INCREASE
|
|
91262
|
+
};
|
|
91263
|
+
var box = new Box(scaledSize.x, scaledSize.y, scaledSize.z, HIT_BOX_COLOR, DEFAULT_HITBOX_OPTIONS); //box.setQuaternion(quaternion);
|
|
91264
|
+
|
|
91265
|
+
box.setWireframe(true);
|
|
91266
|
+
box.setWireframeLineWidth(2);
|
|
91267
|
+
return box;
|
|
91268
|
+
};
|
|
91269
|
+
var getSphereHitbox = function getSphereHitbox(element) {
|
|
91270
|
+
var radius = element.boundingSphere.radius;
|
|
91271
|
+
var sphere = new Sphere(radius, HIT_BOX_COLOR, DEFAULT_HITBOX_OPTIONS);
|
|
91272
|
+
sphere.setWireframe(true);
|
|
91273
|
+
sphere.setWireframeLineWidth(2);
|
|
91274
|
+
return sphere;
|
|
91275
|
+
};
|
|
91276
|
+
var mapColliderTypeToHitbox = function mapColliderTypeToHitbox() {
|
|
91277
|
+
var _COLLIDER_TYPES$BOX$C;
|
|
91278
|
+
|
|
91279
|
+
var colliderType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : COLLIDER_TYPES$1.BOX;
|
|
91280
|
+
return (_COLLIDER_TYPES$BOX$C = {}, _defineProperty$1(_COLLIDER_TYPES$BOX$C, COLLIDER_TYPES$1.BOX, getBoxHitbox), _defineProperty$1(_COLLIDER_TYPES$BOX$C, COLLIDER_TYPES$1.SPHERE, getSphereHitbox), _COLLIDER_TYPES$BOX$C)[colliderType] || getBoxHitbox;
|
|
91281
|
+
};
|
|
91282
|
+
var addHitBox = function addHitBox(element) {
|
|
91283
|
+
var colliderType = element.getPhysicsOptions('colliderType');
|
|
91284
|
+
var getHitbox = mapColliderTypeToHitbox(colliderType);
|
|
91285
|
+
element.add(getHitbox(element));
|
|
91286
|
+
};var hitbox=/*#__PURE__*/Object.freeze({__proto__:null,getBoxHitbox:getBoxHitbox,getSphereHitbox:getSphereHitbox,mapColliderTypeToHitbox:mapColliderTypeToHitbox,addHitBox:addHitBox});var LabelComponent = /*#__PURE__*/function (_Component) {
|
|
91287
|
+
_inherits(LabelComponent, _Component);
|
|
91288
|
+
|
|
91289
|
+
var _super = _createSuper(LabelComponent);
|
|
91290
|
+
|
|
91291
|
+
function LabelComponent(props) {
|
|
91292
|
+
var _this;
|
|
91293
|
+
|
|
91294
|
+
_classCallCheck(this, LabelComponent);
|
|
91295
|
+
|
|
91296
|
+
_this = _super.call(this, props);
|
|
91297
|
+
_this.element = createRef();
|
|
91298
|
+
return _this;
|
|
91299
|
+
}
|
|
91300
|
+
|
|
91301
|
+
_createClass(LabelComponent, [{
|
|
91302
|
+
key: "componentDidUpdate",
|
|
91303
|
+
value: function componentDidUpdate() {
|
|
91304
|
+
this.props.onUpdate(this.element.current);
|
|
91305
|
+
}
|
|
91306
|
+
}, {
|
|
91307
|
+
key: "componentDidMount",
|
|
91308
|
+
value: function componentDidMount() {
|
|
91309
|
+
this.props.onMount(this.element.current);
|
|
91310
|
+
}
|
|
91311
|
+
}, {
|
|
91312
|
+
key: "componentWillUnmount",
|
|
91313
|
+
value: function componentWillUnmount() {
|
|
91314
|
+
this.props.onUnmount(this.element.current);
|
|
91315
|
+
}
|
|
91316
|
+
}]);
|
|
91317
|
+
|
|
91318
|
+
return LabelComponent;
|
|
91319
|
+
}(Component$1);var Light$1 = /*#__PURE__*/function (_Entity) {
|
|
91320
|
+
_inherits(Light, _Entity);
|
|
91321
|
+
|
|
91322
|
+
var _super = _createSuper(Light);
|
|
91323
|
+
|
|
91324
|
+
function Light(_ref) {
|
|
91325
|
+
var _this;
|
|
91326
|
+
|
|
91327
|
+
var color = _ref.color,
|
|
91328
|
+
intensity = _ref.intensity,
|
|
91329
|
+
_name = _ref.name;
|
|
91330
|
+
|
|
91331
|
+
_classCallCheck(this, Light);
|
|
91332
|
+
|
|
91333
|
+
_this = _super.call(this, {
|
|
91334
|
+
name: _name
|
|
91335
|
+
});
|
|
91336
|
+
|
|
91337
|
+
_defineProperty$1(_assertThisInitialized(_this), "addHolder", function () {
|
|
91338
|
+
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "lightholder";
|
|
91339
|
+
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.05;
|
|
91340
|
+
var holderSprite = new HelperSprite(size, size, name, {
|
|
91341
|
+
name: name
|
|
91342
|
+
});
|
|
91343
|
+
|
|
91344
|
+
if (holderSprite) {
|
|
91345
|
+
holderSprite.setSizeAttenuation(false);
|
|
91346
|
+
holderSprite.setDepthTest(false);
|
|
91347
|
+
holderSprite.setDepthWrite(false);
|
|
91348
|
+
holderSprite.setSerializable(false);
|
|
91349
|
+
holderSprite.setPosition(_this.getPosition());
|
|
91350
|
+
holderSprite.addTags([TAGS.HELPER, TAGS.LIGHTS.HELPER, TAGS.LIGHTS.HOLDER, name]);
|
|
91351
|
+
holderSprite.setHelperTarget(_assertThisInitialized(_this));
|
|
91352
|
+
_this.holder = holderSprite;
|
|
91353
|
+
return true;
|
|
91354
|
+
} else {
|
|
91355
|
+
console.warn(LIGHT_HOLDER_MODEL_NOT_FOUND$1);
|
|
91356
|
+
return false;
|
|
91357
|
+
}
|
|
91358
|
+
});
|
|
91359
|
+
|
|
91360
|
+
_defineProperty$1(_assertThisInitialized(_this), "addTargetHolder", function () {
|
|
91361
|
+
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "targetholder";
|
|
91362
|
+
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.05;
|
|
91363
|
+
var targetSprite = new HelperSprite(size, size, name, {
|
|
91364
|
+
name: name
|
|
91365
|
+
});
|
|
91366
|
+
|
|
91367
|
+
if (targetSprite) {
|
|
91368
|
+
targetSprite.setSizeAttenuation(false);
|
|
91369
|
+
targetSprite.setDepthTest(false);
|
|
91370
|
+
targetSprite.setDepthWrite(false);
|
|
91371
|
+
targetSprite.setSerializable(false);
|
|
91372
|
+
targetSprite.setPosition(_this.getTarget().getPosition());
|
|
91373
|
+
targetSprite.addTags([TAGS.LIGHTS.HELPER, TAGS.LIGHTS.TARGET, name]);
|
|
91374
|
+
targetSprite.setHelperTarget(_assertThisInitialized(_this));
|
|
91375
|
+
targetSprite.getBody().add(_this.getBody().target);
|
|
91376
|
+
_this.targetHolder = targetSprite;
|
|
91377
|
+
}
|
|
91378
|
+
});
|
|
91379
|
+
|
|
91380
|
+
_this.color = color;
|
|
91381
|
+
_this.intensity = intensity;
|
|
91382
|
+
_this.name = _name || generateRandomName("Light");
|
|
91383
|
+
_this.isLightOn = false;
|
|
91384
|
+
_this.body = undefined; // helper body for this light
|
|
91385
|
+
|
|
91386
|
+
_this.isUsingHelper = undefined; // holder body representing the light
|
|
91387
|
+
|
|
91388
|
+
_this.holder = undefined; // target body for the light (only used by directional light)
|
|
91389
|
+
|
|
91390
|
+
_this.target = undefined;
|
|
91391
|
+
|
|
91392
|
+
_this.setEntityType(ENTITY_TYPES.LIGHT.DEFAULT);
|
|
91393
|
+
|
|
91394
|
+
Lights$1.add(_assertThisInitialized(_this));
|
|
91395
|
+
return _this;
|
|
91396
|
+
}
|
|
91397
|
+
|
|
91398
|
+
_createClass(Light, [{
|
|
91399
|
+
key: "addToScene",
|
|
91400
|
+
value: function addToScene() {
|
|
91401
|
+
if (this.hasBody()) {
|
|
91402
|
+
Scene$1.add(this.body, this);
|
|
91403
|
+
}
|
|
91404
|
+
}
|
|
91405
|
+
}, {
|
|
91406
|
+
key: "usingHelper",
|
|
91407
|
+
value: function usingHelper() {
|
|
91408
|
+
return !!this.isUsingHelper;
|
|
91409
|
+
}
|
|
91410
|
+
}, {
|
|
91411
|
+
key: "hasHolder",
|
|
91412
|
+
value: function hasHolder() {
|
|
91413
|
+
return !!this.holder;
|
|
91414
|
+
}
|
|
91415
|
+
}, {
|
|
91416
|
+
key: "hasTarget",
|
|
91417
|
+
value: function hasTarget() {
|
|
91418
|
+
return false;
|
|
91419
|
+
}
|
|
91420
|
+
}, {
|
|
91421
|
+
key: "getPosition",
|
|
91422
|
+
value: function getPosition() {
|
|
91423
|
+
return {
|
|
91424
|
+
x: this.body.position.x,
|
|
91425
|
+
y: this.body.position.y,
|
|
91426
|
+
z: this.body.position.z
|
|
91427
|
+
};
|
|
91428
|
+
}
|
|
91429
|
+
}, {
|
|
91430
|
+
key: "setPosition",
|
|
91431
|
+
value: function setPosition(where) {
|
|
91432
|
+
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
91433
|
+
_ref2$updateHolder = _ref2.updateHolder,
|
|
91434
|
+
updateHolder = _ref2$updateHolder === void 0 ? true : _ref2$updateHolder;
|
|
91435
|
+
|
|
91436
|
+
var position = _objectSpread2$1(_objectSpread2$1({}, this.getPosition()), where);
|
|
91437
|
+
|
|
91438
|
+
var x = position.x,
|
|
91439
|
+
y = position.y,
|
|
91440
|
+
z = position.z;
|
|
91441
|
+
|
|
91442
|
+
if (this.hasBody()) {
|
|
91443
|
+
this.body.position.set(x, y, z);
|
|
91444
|
+
}
|
|
91445
|
+
|
|
91446
|
+
if (this.hasHolder() && updateHolder) {
|
|
91447
|
+
this.holder.setPosition({
|
|
91448
|
+
x: x,
|
|
91449
|
+
y: y,
|
|
91450
|
+
z: z
|
|
91451
|
+
});
|
|
91452
|
+
}
|
|
91453
|
+
}
|
|
91454
|
+
}, {
|
|
91455
|
+
key: "isAlreadyOn",
|
|
91456
|
+
value: function isAlreadyOn() {
|
|
91457
|
+
return this.hasBody() && this.body.intensity === this.intensity;
|
|
91458
|
+
}
|
|
91459
|
+
}, {
|
|
91460
|
+
key: "isAlreadyOff",
|
|
91461
|
+
value: function isAlreadyOff() {
|
|
91462
|
+
return this.hasBody() && this.body.intensity <= 0;
|
|
91463
|
+
}
|
|
91464
|
+
}, {
|
|
91465
|
+
key: "setIntensity",
|
|
91466
|
+
value: function setIntensity(value) {
|
|
91467
|
+
if (this.hasBody()) {
|
|
91468
|
+
this.body.intensity = value;
|
|
91469
|
+
this.intensity = value;
|
|
91470
|
+
}
|
|
91471
|
+
}
|
|
91472
|
+
}, {
|
|
91473
|
+
key: "getIntensity",
|
|
91474
|
+
value: function getIntensity() {
|
|
91475
|
+
if (this.hasBody()) {
|
|
91476
|
+
return this.body.intensity;
|
|
91477
|
+
}
|
|
91478
|
+
}
|
|
91479
|
+
}, {
|
|
91480
|
+
key: "setColor",
|
|
91481
|
+
value: function setColor(color) {
|
|
91482
|
+
this.body.color = color;
|
|
91483
|
+
}
|
|
91484
|
+
}, {
|
|
91485
|
+
key: "getColor",
|
|
91486
|
+
value: function getColor() {
|
|
91487
|
+
return this.body.color;
|
|
91488
|
+
}
|
|
91489
|
+
}, {
|
|
91490
|
+
key: "setCastShadow",
|
|
91491
|
+
value: function setCastShadow(castShadow) {
|
|
91492
|
+
this.castShadow = castShadow;
|
|
91493
|
+
this.getBody().castShadow = castShadow;
|
|
91494
|
+
}
|
|
91495
|
+
}, {
|
|
91496
|
+
key: "getCastShadow",
|
|
91497
|
+
value: function getCastShadow() {
|
|
91498
|
+
return this.castShadow;
|
|
91499
|
+
}
|
|
91500
|
+
}, {
|
|
91501
|
+
key: "dim",
|
|
91502
|
+
value: function dim() {
|
|
91503
|
+
var _this2 = this;
|
|
91504
|
+
|
|
91505
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getIntensity();
|
|
91506
|
+
var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250;
|
|
91507
|
+
var intensity = this.getIntensity();
|
|
91508
|
+
|
|
91509
|
+
var onUpdate = function onUpdate(value) {
|
|
91510
|
+
return !_this2.isDisposed() && _this2.setIntensity(value);
|
|
91511
|
+
};
|
|
91512
|
+
|
|
91513
|
+
return tweenTo(intensity, value, {
|
|
91514
|
+
time: time,
|
|
91515
|
+
onUpdate: onUpdate
|
|
91516
|
+
});
|
|
91517
|
+
}
|
|
91518
|
+
}, {
|
|
91519
|
+
key: "on",
|
|
91520
|
+
value: function on() {
|
|
91521
|
+
var _this3 = this;
|
|
91522
|
+
|
|
91523
|
+
var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 500;
|
|
91524
|
+
|
|
91525
|
+
if (this.hasBody()) {
|
|
91526
|
+
this.dim(this.intensity, time).then(function () {
|
|
91527
|
+
return _this3.isLightOn = true;
|
|
91528
|
+
});
|
|
91529
|
+
} else {
|
|
91530
|
+
console.log(LIGHT_NOT_FOUND);
|
|
91531
|
+
}
|
|
91532
|
+
}
|
|
91533
|
+
}, {
|
|
91534
|
+
key: "off",
|
|
91535
|
+
value: function off() {
|
|
91536
|
+
var _this4 = this;
|
|
91537
|
+
|
|
91538
|
+
var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 500;
|
|
91539
|
+
|
|
91540
|
+
if (this.hasBody()) {
|
|
91541
|
+
this.dim(0, time).then(function () {
|
|
91542
|
+
return _this4.isLightOn = false;
|
|
91543
|
+
});
|
|
91544
|
+
} else {
|
|
91545
|
+
console.log(LIGHT_NOT_FOUND);
|
|
91546
|
+
}
|
|
91547
|
+
}
|
|
91548
|
+
}, {
|
|
91549
|
+
key: "toJSON",
|
|
91550
|
+
value: function toJSON() {
|
|
91551
|
+
return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(Light.prototype), "toJSON", this).call(this)), {}, {
|
|
91552
|
+
type: this.getEntityType(),
|
|
91553
|
+
color: this.getColor(),
|
|
91554
|
+
intensity: this.getIntensity(),
|
|
91555
|
+
name: this.getName(),
|
|
91556
|
+
castShadow: this.getCastShadow()
|
|
91631
91557
|
});
|
|
91632
91558
|
}
|
|
91633
|
-
}, {
|
|
91634
|
-
key: "sampleRate",
|
|
91635
|
-
get: function get() {
|
|
91636
|
-
return this.buffer.sampleRate;
|
|
91637
|
-
}
|
|
91638
|
-
}, {
|
|
91639
|
-
key: "duration",
|
|
91640
|
-
get: function get() {
|
|
91641
|
-
return this.buffer.duration * 1000;
|
|
91642
|
-
}
|
|
91643
|
-
}, {
|
|
91644
|
-
key: "numberOfChannels",
|
|
91645
|
-
get: function get() {
|
|
91646
|
-
return this.buffer.numberOfChannels;
|
|
91647
|
-
}
|
|
91648
91559
|
}]);
|
|
91649
91560
|
|
|
91650
|
-
return
|
|
91651
|
-
}(Entity);var
|
|
91561
|
+
return Light;
|
|
91562
|
+
}(Entity);var DEFAULT_POSITION$3 = {
|
|
91563
|
+
x: 0,
|
|
91564
|
+
y: 0,
|
|
91565
|
+
z: 0
|
|
91566
|
+
};
|
|
91567
|
+
var DEFAULT_INTENSITY$4 = 0.5;
|
|
91568
|
+
var WHITE$3 = 0xffffff;
|
|
91652
91569
|
|
|
91653
|
-
var
|
|
91654
|
-
_inherits(
|
|
91570
|
+
var AmbientLight = /*#__PURE__*/function (_Light) {
|
|
91571
|
+
_inherits(AmbientLight, _Light);
|
|
91655
91572
|
|
|
91656
|
-
var _super = _createSuper(
|
|
91573
|
+
var _super = _createSuper(AmbientLight);
|
|
91657
91574
|
|
|
91658
|
-
function
|
|
91575
|
+
function AmbientLight() {
|
|
91659
91576
|
var _this;
|
|
91660
91577
|
|
|
91661
|
-
var
|
|
91662
|
-
_ref$name = _ref.name,
|
|
91663
|
-
name = _ref$name === void 0 ? generateRandomName("AmbientSound") : _ref$name,
|
|
91664
|
-
options = _objectWithoutProperties(_ref, _excluded$2);
|
|
91578
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
91665
91579
|
|
|
91666
|
-
_classCallCheck(this,
|
|
91580
|
+
_classCallCheck(this, AmbientLight);
|
|
91667
91581
|
|
|
91668
|
-
|
|
91669
|
-
|
|
91582
|
+
var _options$color = options.color,
|
|
91583
|
+
color = _options$color === void 0 ? WHITE$3 : _options$color,
|
|
91584
|
+
_options$intensity = options.intensity,
|
|
91585
|
+
intensity = _options$intensity === void 0 ? DEFAULT_INTENSITY$4 : _options$intensity,
|
|
91586
|
+
_options$name = options.name,
|
|
91587
|
+
name = _options$name === void 0 ? generateRandomName("AmbientLight") : _options$name;
|
|
91588
|
+
_this = _super.call(this, {
|
|
91589
|
+
color: color,
|
|
91590
|
+
intensity: intensity,
|
|
91670
91591
|
name: name
|
|
91671
|
-
}
|
|
91672
|
-
|
|
91673
|
-
_this.setEntityType(ENTITY_TYPES.AUDIO.AMBIENT);
|
|
91674
|
-
|
|
91675
|
-
return _this;
|
|
91676
|
-
}
|
|
91677
|
-
|
|
91678
|
-
return AmbientSound;
|
|
91679
|
-
}(Sound$1);var _excluded$1 = ["name"];
|
|
91680
|
-
|
|
91681
|
-
var DirectionalSound = /*#__PURE__*/function (_Sound) {
|
|
91682
|
-
_inherits(DirectionalSound, _Sound);
|
|
91683
|
-
|
|
91684
|
-
var _super = _createSuper(DirectionalSound);
|
|
91685
|
-
|
|
91686
|
-
function DirectionalSound(source) {
|
|
91687
|
-
var _this;
|
|
91688
|
-
|
|
91689
|
-
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
91690
|
-
_ref$name = _ref.name,
|
|
91691
|
-
name = _ref$name === void 0 ? generateRandomName("DirectionalSound") : _ref$name,
|
|
91692
|
-
options = _objectWithoutProperties(_ref, _excluded$1);
|
|
91592
|
+
});
|
|
91593
|
+
_this.options = options;
|
|
91693
91594
|
|
|
91694
|
-
|
|
91595
|
+
_this.setLight({
|
|
91596
|
+
color: color,
|
|
91597
|
+
intensity: intensity
|
|
91598
|
+
});
|
|
91695
91599
|
|
|
91696
|
-
_this
|
|
91697
|
-
source: source,
|
|
91698
|
-
name: name
|
|
91699
|
-
}, options));
|
|
91600
|
+
_this.setEntityType(ENTITY_TYPES.LIGHT.AMBIENT);
|
|
91700
91601
|
|
|
91701
|
-
_this.
|
|
91602
|
+
_this.setName(name);
|
|
91702
91603
|
|
|
91703
91604
|
return _this;
|
|
91704
91605
|
}
|
|
91705
91606
|
|
|
91706
|
-
_createClass(
|
|
91707
|
-
key: "
|
|
91708
|
-
value: function
|
|
91709
|
-
|
|
91607
|
+
_createClass(AmbientLight, [{
|
|
91608
|
+
key: "setLight",
|
|
91609
|
+
value: function setLight(_ref) {
|
|
91610
|
+
var light = _ref.light,
|
|
91611
|
+
_ref$color = _ref.color,
|
|
91612
|
+
color = _ref$color === void 0 ? WHITE$3 : _ref$color,
|
|
91613
|
+
_ref$intensity = _ref.intensity,
|
|
91614
|
+
intensity = _ref$intensity === void 0 ? DEFAULT_INTENSITY$4 : _ref$intensity;
|
|
91710
91615
|
|
|
91711
|
-
|
|
91712
|
-
|
|
91713
|
-
|
|
91714
|
-
|
|
91715
|
-
|
|
91716
|
-
|
|
91717
|
-
|
|
91718
|
-
|
|
91719
|
-
key: "createPannerNode",
|
|
91720
|
-
value: function createPannerNode() {
|
|
91721
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
91722
|
-
var _options$coneInnerAng = options.coneInnerAngleDegrees,
|
|
91723
|
-
coneInnerAngleDegrees = _options$coneInnerAng === void 0 ? 360 : _options$coneInnerAng,
|
|
91724
|
-
_options$coneOuterAng = options.coneOuterAngleDegrees,
|
|
91725
|
-
coneOuterAngleDegrees = _options$coneOuterAng === void 0 ? 0 : _options$coneOuterAng,
|
|
91726
|
-
_options$coneOuterGai = options.coneOuterGain,
|
|
91727
|
-
coneOuterGain = _options$coneOuterGai === void 0 ? 0 : _options$coneOuterGai,
|
|
91728
|
-
_options$maxDistance = options.maxDistance,
|
|
91729
|
-
maxDistance = _options$maxDistance === void 0 ? 10000 : _options$maxDistance,
|
|
91730
|
-
_options$rolloffFacto = options.rolloffFactor,
|
|
91731
|
-
rolloffFactor = _options$rolloffFacto === void 0 ? 1 : _options$rolloffFacto,
|
|
91732
|
-
_options$refDistance = options.refDistance,
|
|
91733
|
-
refDistance = _options$refDistance === void 0 ? 1 : _options$refDistance;
|
|
91734
|
-
this.pannerNode = Audio$1.context.createPanner();
|
|
91735
|
-
this.pannerNode.panningModel = "HRTF";
|
|
91736
|
-
this.pannerNode.distanceModel = "inverse";
|
|
91737
|
-
this.pannerNode.refDistance = refDistance;
|
|
91738
|
-
this.pannerNode.maxDistance = maxDistance;
|
|
91739
|
-
this.pannerNode.rolloffFactor = rolloffFactor;
|
|
91740
|
-
this.pannerNode.coneInnerAngle = coneInnerAngleDegrees;
|
|
91741
|
-
this.pannerNode.coneOuterAngle = coneOuterAngleDegrees;
|
|
91742
|
-
this.pannerNode.coneOuterGain = coneOuterGain;
|
|
91743
|
-
}
|
|
91744
|
-
}, {
|
|
91745
|
-
key: "connect",
|
|
91746
|
-
value: function connect() {
|
|
91747
|
-
if (this.connected) {
|
|
91748
|
-
this.disconnect();
|
|
91616
|
+
if (light) {
|
|
91617
|
+
this.setBody({
|
|
91618
|
+
body: light
|
|
91619
|
+
});
|
|
91620
|
+
} else {
|
|
91621
|
+
this.setBody({
|
|
91622
|
+
body: new AmbientLight$1(color, intensity)
|
|
91623
|
+
});
|
|
91749
91624
|
}
|
|
91750
91625
|
|
|
91751
|
-
this.
|
|
91752
|
-
|
|
91753
|
-
this.audioNode.connect(this.pannerNode);
|
|
91754
|
-
this.connected = true;
|
|
91755
|
-
this.tryAutoplay();
|
|
91756
|
-
}
|
|
91757
|
-
}, {
|
|
91758
|
-
key: "disconnect",
|
|
91759
|
-
value: function disconnect() {
|
|
91760
|
-
if (this.connected) {
|
|
91761
|
-
this.volumeNode.disconnect();
|
|
91762
|
-
this.pannerNode.disconnect();
|
|
91763
|
-
this.audioNode.disconnect();
|
|
91764
|
-
this.connected = false;
|
|
91626
|
+
if (this.hasBody()) {
|
|
91627
|
+
this.postLightCreation();
|
|
91765
91628
|
}
|
|
91766
91629
|
}
|
|
91767
91630
|
}, {
|
|
91768
|
-
key: "
|
|
91769
|
-
value: function
|
|
91770
|
-
var
|
|
91771
|
-
|
|
91772
|
-
|
|
91773
|
-
|
|
91774
|
-
mz = m.elements[14];
|
|
91775
|
-
m.elements[12] = m.elements[13] = m.elements[14] = 0;
|
|
91776
|
-
vec.applyMatrix4(m);
|
|
91777
|
-
vec.normalize();
|
|
91778
|
-
this.pannerNode.orientationX.setValueAtTime(vec.x, Audio$1.context.currentTime);
|
|
91779
|
-
this.pannerNode.orientationY.setValueAtTime(vec.y, Audio$1.context.currentTime);
|
|
91780
|
-
this.pannerNode.orientationZ.setValueAtTime(vec.z, Audio$1.context.currentTime);
|
|
91781
|
-
m.elements[12] = mx;
|
|
91782
|
-
m.elements[13] = my;
|
|
91783
|
-
m.elements[14] = mz;
|
|
91631
|
+
key: "postLightCreation",
|
|
91632
|
+
value: function postLightCreation() {
|
|
91633
|
+
var _this$options$positio = this.options.position,
|
|
91634
|
+
position = _this$options$positio === void 0 ? DEFAULT_POSITION$3 : _this$options$positio;
|
|
91635
|
+
this.setPosition(position);
|
|
91636
|
+
this.addToScene();
|
|
91784
91637
|
}
|
|
91785
91638
|
}, {
|
|
91786
|
-
key: "
|
|
91787
|
-
value: function
|
|
91788
|
-
|
|
91789
|
-
|
|
91790
|
-
|
|
91791
|
-
|
|
91792
|
-
|
|
91793
|
-
|
|
91639
|
+
key: "addHelpers",
|
|
91640
|
+
value: function addHelpers() {
|
|
91641
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
91642
|
+
_ref2$holderName = _ref2.holderName,
|
|
91643
|
+
holderName = _ref2$holderName === void 0 ? "ambientlightholder" : _ref2$holderName,
|
|
91644
|
+
_ref2$holderSize = _ref2.holderSize,
|
|
91645
|
+
holderSize = _ref2$holderSize === void 0 ? 0.05 : _ref2$holderSize;
|
|
91646
|
+
|
|
91647
|
+
this.addHolder(holderName, holderSize);
|
|
91648
|
+
this.isUsingHelper = true;
|
|
91794
91649
|
}
|
|
91795
91650
|
}, {
|
|
91796
91651
|
key: "update",
|
|
91797
91652
|
value: function update(dt) {
|
|
91798
|
-
_get(_getPrototypeOf(
|
|
91653
|
+
_get(_getPrototypeOf(AmbientLight.prototype), "update", this).call(this, dt);
|
|
91799
91654
|
|
|
91800
|
-
if (this.
|
|
91801
|
-
this.
|
|
91802
|
-
|
|
91655
|
+
if (this.usingHelper()) {
|
|
91656
|
+
this.setPosition(this.holder.getPosition(), {
|
|
91657
|
+
updateHolder: false
|
|
91658
|
+
});
|
|
91803
91659
|
}
|
|
91804
91660
|
}
|
|
91805
91661
|
}]);
|
|
91806
91662
|
|
|
91807
|
-
return
|
|
91808
|
-
}(
|
|
91809
|
-
|
|
91663
|
+
return AmbientLight;
|
|
91664
|
+
}(Light$1);var DEFAULT_NEAR$2 = 0.1;
|
|
91665
|
+
var DEFAULT_FAR$2 = 100;
|
|
91666
|
+
var DEFAULT_FOV = 75;
|
|
91667
|
+
var DEFAULT_POSITION$2 = {
|
|
91668
|
+
x: 0,
|
|
91669
|
+
y: 1,
|
|
91670
|
+
z: 0
|
|
91810
91671
|
};
|
|
91672
|
+
var DEFAULT_INTENSITY$3 = 0.5;
|
|
91673
|
+
var DEFAULT_MAP_SIZE$2 = 512;
|
|
91674
|
+
var DEFAULT_BIAS$2 = -0.0001;
|
|
91675
|
+
var WHITE$2 = 0xffffff;
|
|
91811
91676
|
|
|
91812
|
-
var
|
|
91813
|
-
_inherits(
|
|
91677
|
+
var SunLight = /*#__PURE__*/function (_Light) {
|
|
91678
|
+
_inherits(SunLight, _Light);
|
|
91814
91679
|
|
|
91815
|
-
var _super = _createSuper(
|
|
91680
|
+
var _super = _createSuper(SunLight);
|
|
91816
91681
|
|
|
91817
|
-
function
|
|
91682
|
+
function SunLight() {
|
|
91818
91683
|
var _this;
|
|
91819
91684
|
|
|
91820
91685
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
91821
91686
|
|
|
91822
|
-
_classCallCheck(this,
|
|
91687
|
+
_classCallCheck(this, SunLight);
|
|
91823
91688
|
|
|
91824
|
-
var
|
|
91825
|
-
_options$
|
|
91826
|
-
|
|
91827
|
-
|
|
91828
|
-
loopEnd = options.loopEnd,
|
|
91829
|
-
autoplay = options.autoplay,
|
|
91830
|
-
reconnectOnReset = options.reconnectOnReset,
|
|
91831
|
-
_options$setupConfig = options.setupConfig,
|
|
91832
|
-
setupConfig = _options$setupConfig === void 0 ? DEFAULT_SETUP_CONFIG : _options$setupConfig,
|
|
91689
|
+
var _options$color = options.color,
|
|
91690
|
+
color = _options$color === void 0 ? WHITE$2 : _options$color,
|
|
91691
|
+
_options$intensity = options.intensity,
|
|
91692
|
+
intensity = _options$intensity === void 0 ? DEFAULT_INTENSITY$3 : _options$intensity,
|
|
91833
91693
|
_options$name = options.name,
|
|
91834
|
-
name = _options$name === void 0 ? generateRandomName("
|
|
91835
|
-
_this = _super.call(this,
|
|
91836
|
-
|
|
91837
|
-
|
|
91838
|
-
loopStart: loopStart,
|
|
91839
|
-
loopEnd: loopEnd,
|
|
91840
|
-
autoplay: autoplay,
|
|
91841
|
-
reconnectOnReset: reconnectOnReset,
|
|
91694
|
+
name = _options$name === void 0 ? generateRandomName("SunLight") : _options$name;
|
|
91695
|
+
_this = _super.call(this, {
|
|
91696
|
+
color: color,
|
|
91697
|
+
intensity: intensity,
|
|
91842
91698
|
name: name
|
|
91843
|
-
}));
|
|
91844
|
-
|
|
91845
|
-
_defineProperty$1(_assertThisInitialized(_this), "reset", function () {
|
|
91846
|
-
_this.playing = false;
|
|
91847
|
-
|
|
91848
|
-
_this.disconnect();
|
|
91849
|
-
|
|
91850
|
-
_this.setupAudio();
|
|
91851
|
-
|
|
91852
|
-
_this.connect();
|
|
91853
91699
|
});
|
|
91854
91700
|
|
|
91855
|
-
_this
|
|
91856
|
-
|
|
91857
|
-
|
|
91858
|
-
|
|
91859
|
-
|
|
91860
|
-
|
|
91861
|
-
|
|
91862
|
-
|
|
91863
|
-
|
|
91864
|
-
|
|
91865
|
-
|
|
91866
|
-
|
|
91867
|
-
|
|
91868
|
-
_this.audioNode = null;
|
|
91869
|
-
_this.volumeNode = null;
|
|
91870
|
-
_this.detuneValue = 0;
|
|
91701
|
+
_defineProperty$1(_assertThisInitialized(_this), "setShadowCameraNearFar", function () {
|
|
91702
|
+
var near = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_NEAR$2;
|
|
91703
|
+
var far = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_FAR$2;
|
|
91704
|
+
_this.near = near;
|
|
91705
|
+
_this.far = far;
|
|
91706
|
+
var d = _this.far / 2;
|
|
91707
|
+
_this.getBody().shadow.camera.left = -d;
|
|
91708
|
+
_this.getBody().shadow.camera.right = d;
|
|
91709
|
+
_this.getBody().shadow.camera.top = d;
|
|
91710
|
+
_this.getBody().shadow.camera.bottom = -d;
|
|
91711
|
+
_this.getBody().shadow.camera.near = near;
|
|
91712
|
+
_this.getBody().shadow.camera.far = far;
|
|
91713
|
+
});
|
|
91871
91714
|
|
|
91872
|
-
|
|
91873
|
-
|
|
91874
|
-
|
|
91715
|
+
_defineProperty$1(_assertThisInitialized(_this), "setBias", function () {
|
|
91716
|
+
var bias = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_BIAS$2;
|
|
91717
|
+
_this.bias = bias;
|
|
91718
|
+
_this.getBody().shadow.bias = bias;
|
|
91719
|
+
});
|
|
91875
91720
|
|
|
91876
|
-
_this.
|
|
91721
|
+
_this.options = options;
|
|
91722
|
+
_this.target = ORIGIN;
|
|
91877
91723
|
|
|
91878
|
-
_this.
|
|
91879
|
-
|
|
91724
|
+
_this.setLight({
|
|
91725
|
+
color: color,
|
|
91726
|
+
intensity: intensity
|
|
91880
91727
|
});
|
|
91881
91728
|
|
|
91882
|
-
_this.setEntityType(ENTITY_TYPES.
|
|
91883
|
-
|
|
91884
|
-
Scene$1.add(_this.getBody(), _assertThisInitialized(_this));
|
|
91885
|
-
Audio$1.add(_assertThisInitialized(_this));
|
|
91729
|
+
_this.setEntityType(ENTITY_TYPES.LIGHT.SUN);
|
|
91886
91730
|
|
|
91887
|
-
|
|
91888
|
-
_this.connect();
|
|
91889
|
-
}
|
|
91731
|
+
_this.setName(name);
|
|
91890
91732
|
|
|
91891
91733
|
return _this;
|
|
91892
91734
|
}
|
|
91893
91735
|
|
|
91894
|
-
_createClass(
|
|
91895
|
-
key: "
|
|
91896
|
-
value: function
|
|
91897
|
-
var
|
|
91898
|
-
_ref$
|
|
91899
|
-
|
|
91900
|
-
_ref$
|
|
91901
|
-
|
|
91902
|
-
|
|
91903
|
-
var holderSprite = new HelperSprite(holderSize, holderSize, holderName, {
|
|
91904
|
-
name: holderName
|
|
91905
|
-
});
|
|
91736
|
+
_createClass(SunLight, [{
|
|
91737
|
+
key: "setLight",
|
|
91738
|
+
value: function setLight(_ref) {
|
|
91739
|
+
var light = _ref.light,
|
|
91740
|
+
_ref$color = _ref.color,
|
|
91741
|
+
color = _ref$color === void 0 ? WHITE$2 : _ref$color,
|
|
91742
|
+
_ref$intensity = _ref.intensity,
|
|
91743
|
+
intensity = _ref$intensity === void 0 ? DEFAULT_INTENSITY$3 : _ref$intensity;
|
|
91906
91744
|
|
|
91907
|
-
if (
|
|
91908
|
-
|
|
91909
|
-
|
|
91910
|
-
|
|
91911
|
-
holderSprite.setSerializable(false);
|
|
91912
|
-
holderSprite.setPosition(this.getPosition());
|
|
91913
|
-
holderSprite.addTags([TAGS.HELPER, TAGS.SOUNDS.HELPER, TAGS.SOUNDS.HOLDER, name]);
|
|
91914
|
-
holderSprite.setHelperTarget(this);
|
|
91915
|
-
this.holder = holderSprite;
|
|
91916
|
-
return true;
|
|
91745
|
+
if (light) {
|
|
91746
|
+
this.setBody({
|
|
91747
|
+
body: light
|
|
91748
|
+
});
|
|
91917
91749
|
} else {
|
|
91918
|
-
|
|
91919
|
-
|
|
91750
|
+
this.setBody({
|
|
91751
|
+
body: new DirectionalLight(color, intensity)
|
|
91752
|
+
});
|
|
91753
|
+
}
|
|
91754
|
+
|
|
91755
|
+
if (this.hasBody()) {
|
|
91756
|
+
this.postLightCreation();
|
|
91920
91757
|
}
|
|
91921
91758
|
}
|
|
91922
91759
|
}, {
|
|
91923
|
-
key: "
|
|
91924
|
-
value: function
|
|
91925
|
-
|
|
91926
|
-
|
|
91927
|
-
|
|
91928
|
-
|
|
91929
|
-
|
|
91930
|
-
|
|
91931
|
-
|
|
91932
|
-
|
|
91933
|
-
|
|
91934
|
-
value: function isConnected() {
|
|
91935
|
-
return this.connected;
|
|
91936
|
-
}
|
|
91937
|
-
}, {
|
|
91938
|
-
key: "setupAudio",
|
|
91939
|
-
value: function setupAudio() {
|
|
91940
|
-
this.createAudioNode();
|
|
91941
|
-
this.createVolumeNode();
|
|
91942
|
-
this.setBuffer();
|
|
91943
|
-
this.setupAudioNodeLoop();
|
|
91944
|
-
this.audioNode.removeEventListener(ENTITY_EVENTS.AUDIO.ENDED, this.onSoundEnded.bind(this));
|
|
91945
|
-
this.audioNode.addEventListener(ENTITY_EVENTS.AUDIO.ENDED, this.onSoundEnded.bind(this));
|
|
91946
|
-
this.setupCompleted = true;
|
|
91947
|
-
}
|
|
91948
|
-
}, {
|
|
91949
|
-
key: "setSource",
|
|
91950
|
-
value: function setSource(source) {
|
|
91951
|
-
this.source = source;
|
|
91952
|
-
}
|
|
91953
|
-
}, {
|
|
91954
|
-
key: "getSource",
|
|
91955
|
-
value: function getSource() {
|
|
91956
|
-
return this.source;
|
|
91957
|
-
}
|
|
91958
|
-
}, {
|
|
91959
|
-
key: "createAudioNode",
|
|
91960
|
-
value: function createAudioNode() {
|
|
91961
|
-
this.audioNode = Audio$1.context.createBufferSource();
|
|
91962
|
-
}
|
|
91963
|
-
}, {
|
|
91964
|
-
key: "setupAudioNodeLoop",
|
|
91965
|
-
value: function setupAudioNodeLoop() {
|
|
91966
|
-
this.audioNode.loop = this.loop;
|
|
91967
|
-
this.audioNode.loopEnd = this.loopEnd === undefined ? this.duration : this.loopEnd;
|
|
91968
|
-
this.audioNode.loopStart = this.loopStart === undefined ? this.duration : this.loopStart;
|
|
91969
|
-
}
|
|
91970
|
-
}, {
|
|
91971
|
-
key: "createVolumeNode",
|
|
91972
|
-
value: function createVolumeNode() {
|
|
91973
|
-
this.volumeNode = Audio$1.context.createGain();
|
|
91974
|
-
this.volumeNode.gain.value = DEFAULT_AUDIO_NODE_VOLUME;
|
|
91760
|
+
key: "postLightCreation",
|
|
91761
|
+
value: function postLightCreation() {
|
|
91762
|
+
var _this$options$positio = this.options.position,
|
|
91763
|
+
position = _this$options$positio === void 0 ? DEFAULT_POSITION$2 : _this$options$positio;
|
|
91764
|
+
var emptyTarget = new Element$1({
|
|
91765
|
+
body: new Object3D()
|
|
91766
|
+
});
|
|
91767
|
+
this.setPosition(position);
|
|
91768
|
+
this.setTarget(emptyTarget);
|
|
91769
|
+
this.setLightShadows();
|
|
91770
|
+
this.addToScene();
|
|
91975
91771
|
}
|
|
91976
91772
|
}, {
|
|
91977
|
-
key: "
|
|
91978
|
-
value: function
|
|
91979
|
-
|
|
91980
|
-
|
|
91773
|
+
key: "setLightShadows",
|
|
91774
|
+
value: function setLightShadows() {
|
|
91775
|
+
var _this$options = this.options,
|
|
91776
|
+
_this$options$near = _this$options.near,
|
|
91777
|
+
near = _this$options$near === void 0 ? DEFAULT_NEAR$2 : _this$options$near,
|
|
91778
|
+
_this$options$far = _this$options.far,
|
|
91779
|
+
far = _this$options$far === void 0 ? DEFAULT_FAR$2 : _this$options$far,
|
|
91780
|
+
_this$options$mapSize = _this$options.mapSize,
|
|
91781
|
+
mapSize = _this$options$mapSize === void 0 ? DEFAULT_MAP_SIZE$2 : _this$options$mapSize,
|
|
91782
|
+
_this$options$bias = _this$options.bias,
|
|
91783
|
+
bias = _this$options$bias === void 0 ? DEFAULT_BIAS$2 : _this$options$bias,
|
|
91784
|
+
_this$options$fov = _this$options.fov,
|
|
91785
|
+
fov = _this$options$fov === void 0 ? DEFAULT_FOV : _this$options$fov;
|
|
91786
|
+
|
|
91787
|
+
if (Config$1.lights().shadows) {
|
|
91788
|
+
this.setCastShadow(true);
|
|
91789
|
+
this.setMapSize(mapSize);
|
|
91790
|
+
this.setShadowCameraNearFar(near, far);
|
|
91791
|
+
this.setBias(bias);
|
|
91792
|
+
this.setShadowCameraFov(fov);
|
|
91981
91793
|
}
|
|
91982
91794
|
}
|
|
91983
91795
|
}, {
|
|
91984
|
-
key: "
|
|
91985
|
-
value: function
|
|
91986
|
-
|
|
91987
|
-
this.
|
|
91988
|
-
|
|
91989
|
-
|
|
91990
|
-
this.volumeNode.connect(Audio$1.getMasterVolumeNode());
|
|
91991
|
-
this.audioNode.connect(this.volumeNode);
|
|
91992
|
-
this.connected = true;
|
|
91993
|
-
this.tryAutoplay();
|
|
91796
|
+
key: "getShadowCameraNearFar",
|
|
91797
|
+
value: function getShadowCameraNearFar() {
|
|
91798
|
+
return {
|
|
91799
|
+
near: this.near,
|
|
91800
|
+
far: this.far
|
|
91801
|
+
};
|
|
91994
91802
|
}
|
|
91995
91803
|
}, {
|
|
91996
|
-
key: "
|
|
91997
|
-
value: function
|
|
91998
|
-
|
|
91999
|
-
|
|
92000
|
-
|
|
92001
|
-
this.connected = false;
|
|
92002
|
-
}
|
|
91804
|
+
key: "setShadowCameraFov",
|
|
91805
|
+
value: function setShadowCameraFov() {
|
|
91806
|
+
var fov = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_FOV;
|
|
91807
|
+
this.fov = fov;
|
|
91808
|
+
this.getBody().shadow.camera.fov = fov;
|
|
92003
91809
|
}
|
|
92004
91810
|
}, {
|
|
92005
|
-
key: "
|
|
92006
|
-
value: function
|
|
92007
|
-
|
|
92008
|
-
|
|
92009
|
-
this.stop();
|
|
92010
|
-
this.disconnect();
|
|
91811
|
+
key: "getShadowCameraFov",
|
|
91812
|
+
value: function getShadowCameraFov() {
|
|
91813
|
+
return this.fov;
|
|
92011
91814
|
}
|
|
92012
91815
|
}, {
|
|
92013
|
-
key: "
|
|
92014
|
-
value: function
|
|
92015
|
-
|
|
91816
|
+
key: "setMapSize",
|
|
91817
|
+
value: function setMapSize() {
|
|
91818
|
+
var mapSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MAP_SIZE$2;
|
|
91819
|
+
this.mapSize = mapSize;
|
|
91820
|
+
this.getBody().shadow.mapSize.height = mapSize;
|
|
91821
|
+
this.getBody().shadow.mapSize.width = mapSize;
|
|
92016
91822
|
}
|
|
92017
91823
|
}, {
|
|
92018
|
-
key: "
|
|
92019
|
-
value: function
|
|
92020
|
-
|
|
92021
|
-
this.volumeNode.gain.setValueAtTime(value, Audio$1.context.currentTime);
|
|
91824
|
+
key: "getMapSize",
|
|
91825
|
+
value: function getMapSize() {
|
|
91826
|
+
return this.mapSize;
|
|
92022
91827
|
}
|
|
92023
91828
|
}, {
|
|
92024
|
-
key: "
|
|
92025
|
-
value: function
|
|
92026
|
-
return
|
|
91829
|
+
key: "getBias",
|
|
91830
|
+
value: function getBias() {
|
|
91831
|
+
return this.bias;
|
|
92027
91832
|
}
|
|
92028
91833
|
}, {
|
|
92029
|
-
key: "
|
|
92030
|
-
value: function
|
|
92031
|
-
if (!this.getSource()) {
|
|
92032
|
-
console.error(AUDIO_SOURCE_NOT_DEFINED);
|
|
92033
|
-
return false;
|
|
92034
|
-
}
|
|
92035
|
-
|
|
92036
|
-
var buffer = Audio$1.get(this.source);
|
|
92037
|
-
|
|
92038
|
-
if (!buffer) {
|
|
92039
|
-
console.error(AUDIO_UNABLE_TO_LOAD_SOUND);
|
|
92040
|
-
return false;
|
|
92041
|
-
}
|
|
92042
|
-
|
|
92043
|
-
this.buffer = buffer;
|
|
92044
|
-
this.audioNode.buffer = buffer;
|
|
91834
|
+
key: "hasTarget",
|
|
91835
|
+
value: function hasTarget() {
|
|
92045
91836
|
return true;
|
|
92046
91837
|
}
|
|
92047
91838
|
}, {
|
|
92048
|
-
key: "
|
|
92049
|
-
value: function
|
|
92050
|
-
|
|
92051
|
-
|
|
92052
|
-
|
|
92053
|
-
if (this.isPlaying()) return this;
|
|
92054
|
-
if (!this.isSetupCompleted()) this.setupAudio();
|
|
92055
|
-
if (!this.isConnected()) this.connect();
|
|
92056
|
-
console.log("goin to start playing at volume", volume, this.source);
|
|
92057
|
-
this.setVolume(0);
|
|
92058
|
-
this.audioNode.start();
|
|
92059
|
-
this.hasPlayed = true;
|
|
92060
|
-
this.playing = true;
|
|
92061
|
-
var audioDelay = delay / 1000; // linearRampToValueAtTime/exponentialRampToValueAtTime requires time to be expressed in seconds
|
|
92062
|
-
|
|
92063
|
-
if (ramp === AUDIO_RAMPS.LINEAR) {
|
|
92064
|
-
this.volumeNode.gain.linearRampToValueAtTime(volume, Audio$1.context.currentTime + audioDelay);
|
|
92065
|
-
} else {
|
|
92066
|
-
this.volumeNode.gain.exponentialRampToValueAtTime(volume, Audio$1.context.currentTime + audioDelay);
|
|
92067
|
-
}
|
|
92068
|
-
|
|
92069
|
-
return this;
|
|
91839
|
+
key: "setTarget",
|
|
91840
|
+
value: function setTarget(target) {
|
|
91841
|
+
this.target = target;
|
|
91842
|
+
this.getBody().target = target.getBody();
|
|
91843
|
+
Scene$1.add(this.getBody().target, null, false);
|
|
92070
91844
|
}
|
|
92071
91845
|
}, {
|
|
92072
|
-
key: "
|
|
92073
|
-
value: function
|
|
92074
|
-
this.
|
|
92075
|
-
this.dispatchEvent({
|
|
92076
|
-
type: ENTITY_EVENTS.AUDIO.ENDED
|
|
92077
|
-
});
|
|
91846
|
+
key: "getTarget",
|
|
91847
|
+
value: function getTarget() {
|
|
91848
|
+
return this.target;
|
|
92078
91849
|
}
|
|
92079
91850
|
}, {
|
|
92080
|
-
key: "
|
|
92081
|
-
value: function
|
|
92082
|
-
var
|
|
92083
|
-
|
|
92084
|
-
|
|
92085
|
-
|
|
92086
|
-
|
|
92087
|
-
|
|
92088
|
-
|
|
92089
|
-
|
|
92090
|
-
|
|
91851
|
+
key: "addHelpers",
|
|
91852
|
+
value: function addHelpers() {
|
|
91853
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
91854
|
+
_ref2$holderName = _ref2.holderName,
|
|
91855
|
+
holderName = _ref2$holderName === void 0 ? "sunlightholder" : _ref2$holderName,
|
|
91856
|
+
_ref2$holderSize = _ref2.holderSize,
|
|
91857
|
+
holderSize = _ref2$holderSize === void 0 ? 0.05 : _ref2$holderSize,
|
|
91858
|
+
_ref2$targetHolderNam = _ref2.targetHolderName,
|
|
91859
|
+
targetHolderName = _ref2$targetHolderNam === void 0 ? "targetholder" : _ref2$targetHolderNam,
|
|
91860
|
+
_ref2$targetHolderSiz = _ref2.targetHolderSize,
|
|
91861
|
+
targetHolderSize = _ref2$targetHolderSiz === void 0 ? 0.05 : _ref2$targetHolderSiz;
|
|
92091
91862
|
|
|
92092
|
-
|
|
92093
|
-
|
|
91863
|
+
this.helper = new DirectionalLightHelper(this.getBody(), 5);
|
|
91864
|
+
this.shadowHelper = new CameraHelper(this.getBody().shadow.camera);
|
|
91865
|
+
Scene$1.add(this.helper, null, false);
|
|
91866
|
+
Scene$1.add(this.shadowHelper, null, false);
|
|
91867
|
+
this.addHolder(holderName, holderSize);
|
|
91868
|
+
this.addTargetHolder(targetHolderName, targetHolderSize);
|
|
91869
|
+
this.isUsingHelper = true;
|
|
92094
91870
|
}
|
|
92095
91871
|
}, {
|
|
92096
|
-
key: "
|
|
92097
|
-
value: function
|
|
92098
|
-
|
|
92099
|
-
|
|
92100
|
-
|
|
91872
|
+
key: "update",
|
|
91873
|
+
value: function update(dt) {
|
|
91874
|
+
_get(_getPrototypeOf(SunLight.prototype), "update", this).call(this, dt);
|
|
91875
|
+
|
|
91876
|
+
if (this.usingHelper()) {
|
|
91877
|
+
this.helper.update();
|
|
91878
|
+
this.shadowHelper.update();
|
|
91879
|
+
}
|
|
91880
|
+
|
|
91881
|
+
if (this.hasHolder()) {
|
|
91882
|
+
this.setPosition(this.holder.getPosition(), {
|
|
91883
|
+
updateHolder: false
|
|
91884
|
+
});
|
|
92101
91885
|
}
|
|
92102
91886
|
}
|
|
92103
91887
|
}, {
|
|
92104
|
-
key: "
|
|
92105
|
-
value: function
|
|
92106
|
-
return this.
|
|
91888
|
+
key: "toJSON",
|
|
91889
|
+
value: function toJSON() {
|
|
91890
|
+
return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(SunLight.prototype), "toJSON", this).call(this)), {}, {
|
|
91891
|
+
target: this.getTarget(),
|
|
91892
|
+
bias: this.getBias(),
|
|
91893
|
+
mapSize: this.getMapSize(),
|
|
91894
|
+
shadowCamera: _objectSpread2$1(_objectSpread2$1({}, this.getShadowCameraNearFar()), {}, {
|
|
91895
|
+
fov: this.setShadowCameraFov()
|
|
91896
|
+
})
|
|
91897
|
+
});
|
|
92107
91898
|
}
|
|
92108
|
-
}
|
|
92109
|
-
key: "addEffect",
|
|
92110
|
-
value: function addEffect(effect) {
|
|
92111
|
-
if (!this.hasEffect() && effect) {
|
|
92112
|
-
this.convolverNode = Audio$1.context.createConvolver();
|
|
92113
|
-
this.mixerNode = Audio$1.createGain();
|
|
91899
|
+
}]);
|
|
92114
91900
|
|
|
92115
|
-
|
|
92116
|
-
|
|
92117
|
-
|
|
92118
|
-
|
|
92119
|
-
|
|
92120
|
-
|
|
92121
|
-
|
|
91901
|
+
return SunLight;
|
|
91902
|
+
}(Light$1);var DEFAULT_NEAR$1 = 0.1;
|
|
91903
|
+
var DEFAULT_FAR$1 = 100;
|
|
91904
|
+
var DEFAULT_POSITION$1 = {
|
|
91905
|
+
x: 0,
|
|
91906
|
+
y: 0,
|
|
91907
|
+
z: 0
|
|
91908
|
+
};
|
|
91909
|
+
var DEFAULT_INTENSITY$2 = 0.5;
|
|
91910
|
+
var DEFAULT_DISTANCE = 0;
|
|
91911
|
+
var DEFAULT_DECAY = 1;
|
|
91912
|
+
var DEFAULT_MAP_SIZE$1 = 2048;
|
|
91913
|
+
var DEFAULT_BIAS$1 = -0.0001;
|
|
91914
|
+
var WHITE$1 = 0xffffff;
|
|
91915
|
+
var GREEN$2 = 0x2ecc71;
|
|
92122
91916
|
|
|
91917
|
+
var PointLight = /*#__PURE__*/function (_Light) {
|
|
91918
|
+
_inherits(PointLight, _Light);
|
|
92123
91919
|
|
|
92124
|
-
|
|
92125
|
-
this.convolverGainNode = Audio$1.context.createGain(); //connect mixer to new gains
|
|
91920
|
+
var _super = _createSuper(PointLight);
|
|
92126
91921
|
|
|
92127
|
-
|
|
92128
|
-
|
|
92129
|
-
this.plainGainNode.connect(Audio$1.getMasterVolumeNode());
|
|
92130
|
-
this.convolverGainNode.connect(Audio$1.getMasterVolumeNode());
|
|
92131
|
-
this.convolverNode.buffer = Audio$1.get(effect);
|
|
92132
|
-
this.convolverGainNode.gain.setValueAtTime(0.7, Audio$1.context.currentTime);
|
|
92133
|
-
this.plainGainNode.gain.setValueAtTime(0.3, Audio$1.context.currentTime);
|
|
92134
|
-
}
|
|
92135
|
-
}
|
|
92136
|
-
}, {
|
|
92137
|
-
key: "setPosition",
|
|
92138
|
-
value: function setPosition(where) {
|
|
92139
|
-
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
92140
|
-
_ref2$updateHolder = _ref2.updateHolder,
|
|
92141
|
-
updateHolder = _ref2$updateHolder === void 0 ? true : _ref2$updateHolder;
|
|
91922
|
+
function PointLight() {
|
|
91923
|
+
var _this;
|
|
92142
91924
|
|
|
92143
|
-
|
|
91925
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
92144
91926
|
|
|
92145
|
-
|
|
92146
|
-
|
|
92147
|
-
|
|
91927
|
+
_classCallCheck(this, PointLight);
|
|
91928
|
+
|
|
91929
|
+
var _options$color = options.color,
|
|
91930
|
+
color = _options$color === void 0 ? WHITE$1 : _options$color,
|
|
91931
|
+
_options$intensity = options.intensity,
|
|
91932
|
+
intensity = _options$intensity === void 0 ? DEFAULT_INTENSITY$2 : _options$intensity,
|
|
91933
|
+
_options$name = options.name,
|
|
91934
|
+
name = _options$name === void 0 ? generateRandomName("PointLight") : _options$name,
|
|
91935
|
+
distance = options.distance,
|
|
91936
|
+
decay = options.decay;
|
|
91937
|
+
_this = _super.call(this, {
|
|
91938
|
+
color: color,
|
|
91939
|
+
intensity: intensity,
|
|
91940
|
+
name: name
|
|
91941
|
+
});
|
|
91942
|
+
|
|
91943
|
+
_defineProperty$1(_assertThisInitialized(_this), "setShadowCameraNearFar", function () {
|
|
91944
|
+
var near = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_NEAR$1;
|
|
91945
|
+
var far = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_FAR$1;
|
|
91946
|
+
_this.near = near;
|
|
91947
|
+
_this.far = far;
|
|
91948
|
+
var d = _this.far / 2;
|
|
91949
|
+
_this.getBody().shadow.camera.left = -d;
|
|
91950
|
+
_this.getBody().shadow.camera.right = d;
|
|
91951
|
+
_this.getBody().shadow.camera.top = d;
|
|
91952
|
+
_this.getBody().shadow.camera.bottom = -d;
|
|
91953
|
+
_this.getBody().shadow.camera.near = near;
|
|
91954
|
+
_this.getBody().shadow.camera.far = far;
|
|
91955
|
+
});
|
|
91956
|
+
|
|
91957
|
+
_defineProperty$1(_assertThisInitialized(_this), "setBias", function () {
|
|
91958
|
+
var bias = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_BIAS$1;
|
|
91959
|
+
_this.bias = bias;
|
|
91960
|
+
_this.getBody().shadow.bias = bias;
|
|
91961
|
+
});
|
|
91962
|
+
|
|
91963
|
+
_this.options = options;
|
|
91964
|
+
|
|
91965
|
+
_this.setLight({
|
|
91966
|
+
color: color,
|
|
91967
|
+
intensity: intensity,
|
|
91968
|
+
distance: distance,
|
|
91969
|
+
decay: decay
|
|
91970
|
+
});
|
|
91971
|
+
|
|
91972
|
+
_this.setEntityType(ENTITY_TYPES.LIGHT.POINT);
|
|
91973
|
+
|
|
91974
|
+
_this.setName(name);
|
|
91975
|
+
|
|
91976
|
+
return _this;
|
|
91977
|
+
}
|
|
91978
|
+
|
|
91979
|
+
_createClass(PointLight, [{
|
|
91980
|
+
key: "setLight",
|
|
91981
|
+
value: function setLight(_ref) {
|
|
91982
|
+
var light = _ref.light,
|
|
91983
|
+
_ref$color = _ref.color,
|
|
91984
|
+
color = _ref$color === void 0 ? WHITE$1 : _ref$color,
|
|
91985
|
+
_ref$intensity = _ref.intensity,
|
|
91986
|
+
intensity = _ref$intensity === void 0 ? DEFAULT_INTENSITY$2 : _ref$intensity,
|
|
91987
|
+
_ref$distance = _ref.distance,
|
|
91988
|
+
distance = _ref$distance === void 0 ? DEFAULT_DISTANCE : _ref$distance,
|
|
91989
|
+
_ref$decay = _ref.decay,
|
|
91990
|
+
decay = _ref$decay === void 0 ? DEFAULT_DECAY : _ref$decay;
|
|
91991
|
+
|
|
91992
|
+
if (light) {
|
|
91993
|
+
this.setBody({
|
|
91994
|
+
body: light
|
|
91995
|
+
});
|
|
91996
|
+
} else {
|
|
91997
|
+
this.setBody({
|
|
91998
|
+
body: new PointLight$1(color, intensity)
|
|
91999
|
+
});
|
|
92000
|
+
this.setDistance(distance);
|
|
92001
|
+
this.setDecay(decay);
|
|
92002
|
+
}
|
|
92148
92003
|
|
|
92149
92004
|
if (this.hasBody()) {
|
|
92150
|
-
this.
|
|
92005
|
+
this.postLightCreation();
|
|
92151
92006
|
}
|
|
92007
|
+
}
|
|
92008
|
+
}, {
|
|
92009
|
+
key: "postLightCreation",
|
|
92010
|
+
value: function postLightCreation() {
|
|
92011
|
+
var _this$options$positio = this.options.position,
|
|
92012
|
+
position = _this$options$positio === void 0 ? DEFAULT_POSITION$1 : _this$options$positio;
|
|
92013
|
+
this.setPosition(position);
|
|
92014
|
+
this.setLightShadows();
|
|
92015
|
+
this.addToScene();
|
|
92016
|
+
}
|
|
92017
|
+
}, {
|
|
92018
|
+
key: "setLightShadows",
|
|
92019
|
+
value: function setLightShadows() {
|
|
92020
|
+
var _this$options = this.options,
|
|
92021
|
+
_this$options$near = _this$options.near,
|
|
92022
|
+
near = _this$options$near === void 0 ? DEFAULT_NEAR$1 : _this$options$near,
|
|
92023
|
+
_this$options$far = _this$options.far,
|
|
92024
|
+
far = _this$options$far === void 0 ? DEFAULT_FAR$1 : _this$options$far,
|
|
92025
|
+
_this$options$mapSize = _this$options.mapSize,
|
|
92026
|
+
mapSize = _this$options$mapSize === void 0 ? DEFAULT_MAP_SIZE$1 : _this$options$mapSize,
|
|
92027
|
+
_this$options$bias = _this$options.bias,
|
|
92028
|
+
bias = _this$options$bias === void 0 ? DEFAULT_BIAS$1 : _this$options$bias;
|
|
92152
92029
|
|
|
92153
|
-
if (
|
|
92154
|
-
this.
|
|
92155
|
-
|
|
92156
|
-
|
|
92157
|
-
|
|
92158
|
-
});
|
|
92030
|
+
if (Config$1.lights().shadows) {
|
|
92031
|
+
this.setCastShadow(true);
|
|
92032
|
+
this.setMapSize(mapSize);
|
|
92033
|
+
this.setShadowCameraNearFar(near, far);
|
|
92034
|
+
this.setBias(bias);
|
|
92159
92035
|
}
|
|
92160
92036
|
}
|
|
92161
92037
|
}, {
|
|
92162
|
-
key: "
|
|
92163
|
-
value: function
|
|
92164
|
-
|
|
92038
|
+
key: "setDistance",
|
|
92039
|
+
value: function setDistance() {
|
|
92040
|
+
var distance = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_DISTANCE;
|
|
92041
|
+
this.distance = distance;
|
|
92042
|
+
this.getBody().distance = distance;
|
|
92165
92043
|
}
|
|
92166
92044
|
}, {
|
|
92167
|
-
key: "
|
|
92168
|
-
value: function
|
|
92169
|
-
return
|
|
92045
|
+
key: "getDistance",
|
|
92046
|
+
value: function getDistance() {
|
|
92047
|
+
return this.distance;
|
|
92170
92048
|
}
|
|
92171
92049
|
}, {
|
|
92172
|
-
key: "
|
|
92173
|
-
value: function
|
|
92174
|
-
|
|
92175
|
-
|
|
92176
|
-
|
|
92177
|
-
loopStart: this.loopStart,
|
|
92178
|
-
loopEnd: this.loopEnd,
|
|
92179
|
-
autoplay: this.autoplay,
|
|
92180
|
-
volume: this.getVolume(),
|
|
92181
|
-
detune: this.getDetune(),
|
|
92182
|
-
hasPlayed: this.hasPlayed,
|
|
92183
|
-
playing: this.isPlaying(),
|
|
92184
|
-
connected: this.isConnected(),
|
|
92185
|
-
duration: this.hasBuffer() ? this.duration : 0,
|
|
92186
|
-
sampleRate: this.hasBuffer() ? this.sampleRate : 0,
|
|
92187
|
-
numberOfChannels: this.hasBuffer() ? this.numberOfChannels : 0
|
|
92188
|
-
});
|
|
92050
|
+
key: "setDecay",
|
|
92051
|
+
value: function setDecay() {
|
|
92052
|
+
var decay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_DECAY;
|
|
92053
|
+
this.decay = decay;
|
|
92054
|
+
this.getBody().decay = decay;
|
|
92189
92055
|
}
|
|
92190
92056
|
}, {
|
|
92191
|
-
key: "
|
|
92192
|
-
|
|
92193
|
-
return this.
|
|
92057
|
+
key: "getDecay",
|
|
92058
|
+
value: function getDecay() {
|
|
92059
|
+
return this.decay;
|
|
92194
92060
|
}
|
|
92195
92061
|
}, {
|
|
92196
|
-
key: "
|
|
92197
|
-
|
|
92198
|
-
return
|
|
92062
|
+
key: "getShadowCameraNearFar",
|
|
92063
|
+
value: function getShadowCameraNearFar() {
|
|
92064
|
+
return {
|
|
92065
|
+
near: this.near,
|
|
92066
|
+
far: this.far
|
|
92067
|
+
};
|
|
92199
92068
|
}
|
|
92200
92069
|
}, {
|
|
92201
|
-
key: "
|
|
92202
|
-
|
|
92203
|
-
|
|
92070
|
+
key: "setMapSize",
|
|
92071
|
+
value: function setMapSize() {
|
|
92072
|
+
var mapSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MAP_SIZE$1;
|
|
92073
|
+
this.mapSize = mapSize;
|
|
92074
|
+
this.getBody().shadow.mapSize.height = mapSize;
|
|
92075
|
+
this.getBody().shadow.mapSize.width = mapSize;
|
|
92204
92076
|
}
|
|
92205
|
-
}
|
|
92206
|
-
|
|
92207
|
-
|
|
92208
|
-
|
|
92209
|
-
var createBlob = function createBlob(task) {
|
|
92210
|
-
return new Blob(['(', task.toString(), ')()'], {
|
|
92211
|
-
type: BLOB_TYPE
|
|
92212
|
-
});
|
|
92213
|
-
};
|
|
92214
|
-
var createWorker = function createWorker(task, message) {
|
|
92215
|
-
if (Features$1.isFeatureSupported(FEATURES.WEBWORKER)) {
|
|
92216
|
-
var url = URL.createObjectURL(createBlob(task));
|
|
92217
|
-
var worker = new Worker(url); // Won't be needing this anymore
|
|
92218
|
-
|
|
92219
|
-
URL.revokeObjectURL(url);
|
|
92220
|
-
|
|
92221
|
-
if (message) {
|
|
92222
|
-
worker.postMessage(message);
|
|
92077
|
+
}, {
|
|
92078
|
+
key: "getMapSize",
|
|
92079
|
+
value: function getMapSize() {
|
|
92080
|
+
return this.mapSize;
|
|
92223
92081
|
}
|
|
92224
|
-
|
|
92225
|
-
|
|
92226
|
-
|
|
92227
|
-
|
|
92228
|
-
return null;
|
|
92229
|
-
}
|
|
92230
|
-
};
|
|
92231
|
-
var createPromiseWorker = function createPromiseWorker(task, message) {
|
|
92232
|
-
return new Promise(function (resolve, reject) {
|
|
92233
|
-
var worker = createWorker(task, message);
|
|
92234
|
-
|
|
92235
|
-
if (worker) {
|
|
92236
|
-
worker.onmessage = function (data) {
|
|
92237
|
-
resolve(data);
|
|
92238
|
-
worker.terminate();
|
|
92239
|
-
};
|
|
92240
|
-
} else {
|
|
92241
|
-
reject(WORKERS_NOT_AVAILABLE);
|
|
92082
|
+
}, {
|
|
92083
|
+
key: "getBias",
|
|
92084
|
+
value: function getBias() {
|
|
92085
|
+
return this.bias;
|
|
92242
92086
|
}
|
|
92243
|
-
}
|
|
92244
|
-
|
|
92245
|
-
|
|
92246
|
-
var
|
|
92247
|
-
|
|
92248
|
-
|
|
92249
|
-
|
|
92250
|
-
|
|
92251
|
-
element.boundingBox.getSize(size);
|
|
92252
|
-
var scaledSize = {
|
|
92253
|
-
x: size.x + HIT_BOX_INCREASE,
|
|
92254
|
-
y: size.y + HIT_BOX_INCREASE,
|
|
92255
|
-
z: size.z + HIT_BOX_INCREASE
|
|
92256
|
-
};
|
|
92257
|
-
var box = new Box(scaledSize.x, scaledSize.y, scaledSize.z, HIT_BOX_COLOR, DEFAULT_HITBOX_OPTIONS); //box.setQuaternion(quaternion);
|
|
92258
|
-
|
|
92259
|
-
box.setWireframe(true);
|
|
92260
|
-
box.setWireframeLineWidth(2);
|
|
92261
|
-
return box;
|
|
92262
|
-
};
|
|
92263
|
-
var getSphereHitbox = function getSphereHitbox(element) {
|
|
92264
|
-
var radius = element.boundingSphere.radius;
|
|
92265
|
-
var sphere = new Sphere(radius, HIT_BOX_COLOR, DEFAULT_HITBOX_OPTIONS);
|
|
92266
|
-
sphere.setWireframe(true);
|
|
92267
|
-
sphere.setWireframeLineWidth(2);
|
|
92268
|
-
return sphere;
|
|
92269
|
-
};
|
|
92270
|
-
var mapColliderTypeToHitbox = function mapColliderTypeToHitbox() {
|
|
92271
|
-
var _COLLIDER_TYPES$BOX$C;
|
|
92272
|
-
|
|
92273
|
-
var colliderType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : COLLIDER_TYPES$1.BOX;
|
|
92274
|
-
return (_COLLIDER_TYPES$BOX$C = {}, _defineProperty$1(_COLLIDER_TYPES$BOX$C, COLLIDER_TYPES$1.BOX, getBoxHitbox), _defineProperty$1(_COLLIDER_TYPES$BOX$C, COLLIDER_TYPES$1.SPHERE, getSphereHitbox), _COLLIDER_TYPES$BOX$C)[colliderType] || getBoxHitbox;
|
|
92275
|
-
};
|
|
92276
|
-
var addHitBox = function addHitBox(element) {
|
|
92277
|
-
var colliderType = element.getPhysicsOptions('colliderType');
|
|
92278
|
-
var getHitbox = mapColliderTypeToHitbox(colliderType);
|
|
92279
|
-
element.add(getHitbox(element));
|
|
92280
|
-
};var hitbox=/*#__PURE__*/Object.freeze({__proto__:null,getBoxHitbox:getBoxHitbox,getSphereHitbox:getSphereHitbox,mapColliderTypeToHitbox:mapColliderTypeToHitbox,addHitBox:addHitBox});var LabelComponent = /*#__PURE__*/function (_Component) {
|
|
92281
|
-
_inherits(LabelComponent, _Component);
|
|
92282
|
-
|
|
92283
|
-
var _super = _createSuper(LabelComponent);
|
|
92284
|
-
|
|
92285
|
-
function LabelComponent(props) {
|
|
92286
|
-
var _this;
|
|
92287
|
-
|
|
92288
|
-
_classCallCheck(this, LabelComponent);
|
|
92289
|
-
|
|
92290
|
-
_this = _super.call(this, props);
|
|
92291
|
-
_this.element = createRef();
|
|
92292
|
-
return _this;
|
|
92293
|
-
}
|
|
92087
|
+
}, {
|
|
92088
|
+
key: "addHelpers",
|
|
92089
|
+
value: function addHelpers() {
|
|
92090
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
92091
|
+
_ref2$holderName = _ref2.holderName,
|
|
92092
|
+
holderName = _ref2$holderName === void 0 ? "pointlightholder" : _ref2$holderName,
|
|
92093
|
+
_ref2$holderSize = _ref2.holderSize,
|
|
92094
|
+
holderSize = _ref2$holderSize === void 0 ? 0.05 : _ref2$holderSize;
|
|
92294
92095
|
|
|
92295
|
-
|
|
92296
|
-
|
|
92297
|
-
|
|
92298
|
-
|
|
92096
|
+
this.helper = new PointLightHelper(this.getBody(), 2, GREEN$2);
|
|
92097
|
+
this.shadowHelper = new CameraHelper(this.getBody().shadow.camera);
|
|
92098
|
+
Scene$1.add(this.helper, null, false);
|
|
92099
|
+
Scene$1.add(this.shadowHelper, null, false);
|
|
92100
|
+
this.addHolder(holderName, holderSize);
|
|
92101
|
+
this.isUsingHelper = true;
|
|
92299
92102
|
}
|
|
92300
92103
|
}, {
|
|
92301
|
-
key: "
|
|
92302
|
-
value: function
|
|
92303
|
-
this.
|
|
92104
|
+
key: "update",
|
|
92105
|
+
value: function update(dt) {
|
|
92106
|
+
_get(_getPrototypeOf(PointLight.prototype), "update", this).call(this, dt);
|
|
92107
|
+
|
|
92108
|
+
if (this.usingHelper()) {
|
|
92109
|
+
this.helper.update();
|
|
92110
|
+
this.shadowHelper.update();
|
|
92111
|
+
}
|
|
92112
|
+
|
|
92113
|
+
if (this.hasHolder()) {
|
|
92114
|
+
this.setPosition(this.holder.getPosition(), {
|
|
92115
|
+
updateHolder: false
|
|
92116
|
+
});
|
|
92117
|
+
}
|
|
92304
92118
|
}
|
|
92305
92119
|
}, {
|
|
92306
|
-
key: "
|
|
92307
|
-
value: function
|
|
92308
|
-
this.
|
|
92120
|
+
key: "toJSON",
|
|
92121
|
+
value: function toJSON() {
|
|
92122
|
+
return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(PointLight.prototype), "toJSON", this).call(this)), {}, {
|
|
92123
|
+
distance: this.getDistance(),
|
|
92124
|
+
decay: this.getDecay(),
|
|
92125
|
+
bias: this.getBias(),
|
|
92126
|
+
mapSize: this.getMapSize(),
|
|
92127
|
+
shadowCamera: this.getShadowCameraNearFar()
|
|
92128
|
+
});
|
|
92309
92129
|
}
|
|
92310
92130
|
}]);
|
|
92311
92131
|
|
|
92312
|
-
return
|
|
92313
|
-
}(
|
|
92132
|
+
return PointLight;
|
|
92133
|
+
}(Light$1);var DEFAULT_NEAR = 0.1;
|
|
92314
92134
|
var DEFAULT_FAR = 100;
|
|
92315
92135
|
var DEFAULT_POSITION = {
|
|
92316
92136
|
x: 0,
|
|
@@ -94556,4 +94376,4 @@ var Shaders$1 = new Shaders();var Shader = function Shader(name, attributes, uni
|
|
|
94556
94376
|
} else {
|
|
94557
94377
|
this.instance = this.shader.instance;
|
|
94558
94378
|
}
|
|
94559
|
-
};var constants = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, lib_constants), light_contants), material_constants);export{AUDIO_RAMPS,AmbientLight,AmbientSound,Atmosphere,Audio$1 as Audio,Axes,BUILTIN,BaseScript,Box,Camera,Color,Cone,Config$1 as Config,Controls$1 as Controls,Cube,CurveLine,Cylinder,DirectionalSound,ENTITY_EVENTS,ENTITY_TYPES,Element$1 as Element,Entity,EventDispatcher,FEATURES,Features$1 as Features,GameRunner$1 as GameRunner,Grid,HelperSprite,HemisphereLight,INPUT_EVENTS,Images$1 as Images,Input$1 as Input,Label,LabelComponent,Level,
|
|
94379
|
+
};var constants = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, lib_constants), light_contants), material_constants);export{AUDIO_RAMPS,AmbientLight,AmbientSound,Atmosphere,Audio$1 as Audio,Axes,BUILTIN,BaseScript,Box,Camera,Color,Cone,Config$1 as Config,Controls$1 as Controls,Cube,CurveLine,Cylinder,DirectionalSound,ENTITY_EVENTS,ENTITY_TYPES,Element$1 as Element,Entity,EventDispatcher,FEATURES,Features$1 as Features,GameRunner$1 as GameRunner,Grid,HelperSprite,HemisphereLight,INPUT_EVENTS,Images$1 as Images,Input$1 as Input,Label,LabelComponent,Level,Lights$1 as Lights,Line,Mirror,Models$1 as Models,Ocean,PALETTES,PARTICLES,constants$1 as PHYSICS_CONSTANTS,PHYSICS_EVENTS,ParticleEmitter,ParticleEmitterGroup,Particles$1 as Particles,index$1 as Partykals,Physics$1 as Physics,Plane,PointLight,PostProcessing$1 as PostProcessing,Proton,ProtonParticleEmitter,Provider,Router$1 as Router,Scene$1 as Scene,Scripts$1 as Scripts,Shader,Sky,Skybox,Sound,Sphere,SpotLight,Sprite,Stats$1 as Stats,SunLight,three_module as THREE,Universe$1 as Universe,Vector3$1 as Vector3,Water,author,connect,constants,createElement,easing,functions,hitbox as hitboxUtils,index_esm as inferno,math,utils as physicsUtils,index$2 as rxjs,index as store,strings,uuid$1 as uuid,workers,index$3 as xstate};
|