@xeokit/xeokit-sdk 2.6.75 → 2.6.77-slim-rc2
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/xeokit-sdk.cjs.js +28 -21
- package/dist/xeokit-sdk.es.js +28 -21
- package/dist/xeokit-sdk.es5.js +9 -9
- package/dist/xeokit-sdk.min.cjs.js +8 -8
- package/dist/xeokit-sdk.min.es.js +8 -8
- package/dist/xeokit-sdk.min.es5.js +7 -7
- package/package.json +2 -3
- package/src/extras/Skybox/Skybox.js +139 -0
- package/src/extras/index.js +2 -1
- package/src/plugins/CxConverterIFCLoaderPlugin/CxConverterIFCLoaderPlugin.js +81 -81
- package/src/plugins/CxConverterIFCLoaderPlugin/index.js +1 -1
- package/src/plugins/FastNavPlugin/FastNavPlugin.js +0 -18
- package/src/plugins/SectionPlanesPlugin/Control.js +1 -1
- package/src/plugins/index.js +0 -1
- package/src/viewer/scene/camera/CameraFlightAnimation.js +2 -2
- package/src/viewer/scene/canvas/Canvas.js +7 -4
- package/src/viewer/scene/index.js +0 -1
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js +5 -0
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorRenderer.js +5 -0
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesFlatColorRenderer.js +5 -0
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorRenderer.js +5 -0
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatColorRenderer.js +5 -0
- package/types/plugins/FastNavPlugin/FastNavPlugin.d.ts +5 -0
- package/types/plugins/index.d.ts +0 -1
- package/types/viewer/scene/index.d.ts +0 -1
- package/src/plugins/SkyboxesPlugin/SkyboxesPlugin.js +0 -109
- package/src/plugins/SkyboxesPlugin/index.js +0 -1
- package/src/viewer/scene/skybox/Skybox.js +0 -224
- package/types/plugins/SkyboxesPlugin/SkyboxesPlugin.d.ts +0 -48
- package/types/plugins/SkyboxesPlugin/index.d.ts +0 -1
- package/types/viewer/scene/skybox/Skybox.d.ts +0 -59
- package/types/viewer/scene/skybox/index.d.ts +0 -1
- /package/src/{viewer/scene/skybox → extras/Skybox}/index.js +0 -0
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* xeokit-sdk v2.6.
|
|
3
|
-
* Commit:
|
|
4
|
-
* Built: 2025-
|
|
2
|
+
* xeokit-sdk v2.6.76
|
|
3
|
+
* Commit: dd09d800ebb3a626d7767a83af023ed05e49f2fa
|
|
4
|
+
* Built: 2025-05-10T10:08:24.044Z
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
@@ -54939,6 +54939,11 @@ class TrianglesColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
54939
54939
|
src.push(" float dy = dFdy(vFragDepth);");
|
|
54940
54940
|
src.push(" float diff = sqrt(dx*dx+dy*dy);");
|
|
54941
54941
|
src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");
|
|
54942
|
+
} else {
|
|
54943
|
+
src.push(" float dx = dFdx(gl_FragCoord.z);");
|
|
54944
|
+
src.push(" float dy = dFdy(gl_FragCoord.z);");
|
|
54945
|
+
src.push(" float diff = sqrt(dx*dx+dy*dy);");
|
|
54946
|
+
src.push(" gl_FragDepth = gl_FragCoord.z + diff;");
|
|
54942
54947
|
}
|
|
54943
54948
|
|
|
54944
54949
|
if (this._withSAO) {
|
|
@@ -55193,6 +55198,11 @@ class TrianglesFlatColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
55193
55198
|
|
|
55194
55199
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
55195
55200
|
src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
|
|
55201
|
+
} else {
|
|
55202
|
+
src.push(" float dx = dFdx(gl_FragCoord.z);");
|
|
55203
|
+
src.push(" float dy = dFdy(gl_FragCoord.z);");
|
|
55204
|
+
src.push(" float diff = sqrt(dx*dx+dy*dy);");
|
|
55205
|
+
src.push(" gl_FragDepth = gl_FragCoord.z + diff;");
|
|
55196
55206
|
}
|
|
55197
55207
|
|
|
55198
55208
|
src.push("}");
|
|
@@ -60295,6 +60305,11 @@ class TrianglesColorRenderer extends TrianglesInstancingRenderer {
|
|
|
60295
60305
|
src.push(" float dy = dFdy(vFragDepth);");
|
|
60296
60306
|
src.push(" float diff = sqrt(dx*dx+dy*dy);");
|
|
60297
60307
|
src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");
|
|
60308
|
+
} else {
|
|
60309
|
+
src.push(" float dx = dFdx(gl_FragCoord.z);");
|
|
60310
|
+
src.push(" float dy = dFdy(gl_FragCoord.z);");
|
|
60311
|
+
src.push(" float diff = sqrt(dx*dx+dy*dy);");
|
|
60312
|
+
src.push(" gl_FragDepth = gl_FragCoord.z + diff;");
|
|
60298
60313
|
}
|
|
60299
60314
|
|
|
60300
60315
|
// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
|
|
@@ -60558,6 +60573,11 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
60558
60573
|
|
|
60559
60574
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
60560
60575
|
src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
|
|
60576
|
+
} else {
|
|
60577
|
+
src.push(" float dx = dFdx(gl_FragCoord.z);");
|
|
60578
|
+
src.push(" float dy = dFdy(gl_FragCoord.z);");
|
|
60579
|
+
src.push(" float diff = sqrt(dx*dx+dy*dy);");
|
|
60580
|
+
src.push(" gl_FragDepth = gl_FragCoord.z + diff;");
|
|
60561
60581
|
}
|
|
60562
60582
|
|
|
60563
60583
|
src.push("}");
|
|
@@ -75769,6 +75789,11 @@ class DTXTrianglesColorRenderer {
|
|
|
75769
75789
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
75770
75790
|
src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
|
|
75771
75791
|
//src.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");
|
|
75792
|
+
} else {
|
|
75793
|
+
src.push(" float dx = dFdx(gl_FragCoord.z);");
|
|
75794
|
+
src.push(" float dy = dFdy(gl_FragCoord.z);");
|
|
75795
|
+
src.push(" float diff = sqrt(dx*dx+dy*dy);");
|
|
75796
|
+
src.push(" gl_FragDepth = gl_FragCoord.z + diff;");
|
|
75772
75797
|
}
|
|
75773
75798
|
|
|
75774
75799
|
if (this._withSAO) {
|
|
@@ -93010,7 +93035,6 @@ class FastNavPlugin extends Plugin {
|
|
|
93010
93035
|
fastMode = false;
|
|
93011
93036
|
};
|
|
93012
93037
|
|
|
93013
|
-
this._onCanvasBoundary = viewer.scene.canvas.on("boundary", switchToLowQuality);
|
|
93014
93038
|
this._onCameraMatrix = viewer.scene.camera.on("matrix", switchToLowQuality);
|
|
93015
93039
|
|
|
93016
93040
|
this._onSceneTick = viewer.scene.on("tick", (tickEvent) => {
|
|
@@ -93022,23 +93046,6 @@ class FastNavPlugin extends Plugin {
|
|
|
93022
93046
|
switchToHighQuality();
|
|
93023
93047
|
}
|
|
93024
93048
|
});
|
|
93025
|
-
|
|
93026
|
-
let down = false;
|
|
93027
|
-
|
|
93028
|
-
this._onSceneMouseDown = viewer.scene.input.on("mousedown", () => {
|
|
93029
|
-
down = true;
|
|
93030
|
-
});
|
|
93031
|
-
|
|
93032
|
-
this._onSceneMouseUp = viewer.scene.input.on("mouseup", () => {
|
|
93033
|
-
down = false;
|
|
93034
|
-
});
|
|
93035
|
-
|
|
93036
|
-
this._onSceneMouseMove = viewer.scene.input.on("mousemove", () => {
|
|
93037
|
-
if (!down) {
|
|
93038
|
-
return;
|
|
93039
|
-
}
|
|
93040
|
-
switchToLowQuality();
|
|
93041
|
-
});
|
|
93042
93049
|
}
|
|
93043
93050
|
|
|
93044
93051
|
/**
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* xeokit-sdk v2.6.
|
|
3
|
-
* Commit:
|
|
4
|
-
* Built: 2025-
|
|
2
|
+
* xeokit-sdk v2.6.76
|
|
3
|
+
* Commit: dd09d800ebb3a626d7767a83af023ed05e49f2fa
|
|
4
|
+
* Built: 2025-05-10T10:08:24.044Z
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/** @private */
|
|
@@ -54935,6 +54935,11 @@ class TrianglesColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
54935
54935
|
src.push(" float dy = dFdy(vFragDepth);");
|
|
54936
54936
|
src.push(" float diff = sqrt(dx*dx+dy*dy);");
|
|
54937
54937
|
src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");
|
|
54938
|
+
} else {
|
|
54939
|
+
src.push(" float dx = dFdx(gl_FragCoord.z);");
|
|
54940
|
+
src.push(" float dy = dFdy(gl_FragCoord.z);");
|
|
54941
|
+
src.push(" float diff = sqrt(dx*dx+dy*dy);");
|
|
54942
|
+
src.push(" gl_FragDepth = gl_FragCoord.z + diff;");
|
|
54938
54943
|
}
|
|
54939
54944
|
|
|
54940
54945
|
if (this._withSAO) {
|
|
@@ -55189,6 +55194,11 @@ class TrianglesFlatColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
55189
55194
|
|
|
55190
55195
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
55191
55196
|
src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
|
|
55197
|
+
} else {
|
|
55198
|
+
src.push(" float dx = dFdx(gl_FragCoord.z);");
|
|
55199
|
+
src.push(" float dy = dFdy(gl_FragCoord.z);");
|
|
55200
|
+
src.push(" float diff = sqrt(dx*dx+dy*dy);");
|
|
55201
|
+
src.push(" gl_FragDepth = gl_FragCoord.z + diff;");
|
|
55192
55202
|
}
|
|
55193
55203
|
|
|
55194
55204
|
src.push("}");
|
|
@@ -60291,6 +60301,11 @@ class TrianglesColorRenderer extends TrianglesInstancingRenderer {
|
|
|
60291
60301
|
src.push(" float dy = dFdy(vFragDepth);");
|
|
60292
60302
|
src.push(" float diff = sqrt(dx*dx+dy*dy);");
|
|
60293
60303
|
src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");
|
|
60304
|
+
} else {
|
|
60305
|
+
src.push(" float dx = dFdx(gl_FragCoord.z);");
|
|
60306
|
+
src.push(" float dy = dFdy(gl_FragCoord.z);");
|
|
60307
|
+
src.push(" float diff = sqrt(dx*dx+dy*dy);");
|
|
60308
|
+
src.push(" gl_FragDepth = gl_FragCoord.z + diff;");
|
|
60294
60309
|
}
|
|
60295
60310
|
|
|
60296
60311
|
// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
|
|
@@ -60554,6 +60569,11 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
60554
60569
|
|
|
60555
60570
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
60556
60571
|
src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
|
|
60572
|
+
} else {
|
|
60573
|
+
src.push(" float dx = dFdx(gl_FragCoord.z);");
|
|
60574
|
+
src.push(" float dy = dFdy(gl_FragCoord.z);");
|
|
60575
|
+
src.push(" float diff = sqrt(dx*dx+dy*dy);");
|
|
60576
|
+
src.push(" gl_FragDepth = gl_FragCoord.z + diff;");
|
|
60557
60577
|
}
|
|
60558
60578
|
|
|
60559
60579
|
src.push("}");
|
|
@@ -75765,6 +75785,11 @@ class DTXTrianglesColorRenderer {
|
|
|
75765
75785
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
75766
75786
|
src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
|
|
75767
75787
|
//src.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");
|
|
75788
|
+
} else {
|
|
75789
|
+
src.push(" float dx = dFdx(gl_FragCoord.z);");
|
|
75790
|
+
src.push(" float dy = dFdy(gl_FragCoord.z);");
|
|
75791
|
+
src.push(" float diff = sqrt(dx*dx+dy*dy);");
|
|
75792
|
+
src.push(" gl_FragDepth = gl_FragCoord.z + diff;");
|
|
75768
75793
|
}
|
|
75769
75794
|
|
|
75770
75795
|
if (this._withSAO) {
|
|
@@ -93006,7 +93031,6 @@ class FastNavPlugin extends Plugin {
|
|
|
93006
93031
|
fastMode = false;
|
|
93007
93032
|
};
|
|
93008
93033
|
|
|
93009
|
-
this._onCanvasBoundary = viewer.scene.canvas.on("boundary", switchToLowQuality);
|
|
93010
93034
|
this._onCameraMatrix = viewer.scene.camera.on("matrix", switchToLowQuality);
|
|
93011
93035
|
|
|
93012
93036
|
this._onSceneTick = viewer.scene.on("tick", (tickEvent) => {
|
|
@@ -93018,23 +93042,6 @@ class FastNavPlugin extends Plugin {
|
|
|
93018
93042
|
switchToHighQuality();
|
|
93019
93043
|
}
|
|
93020
93044
|
});
|
|
93021
|
-
|
|
93022
|
-
let down = false;
|
|
93023
|
-
|
|
93024
|
-
this._onSceneMouseDown = viewer.scene.input.on("mousedown", () => {
|
|
93025
|
-
down = true;
|
|
93026
|
-
});
|
|
93027
|
-
|
|
93028
|
-
this._onSceneMouseUp = viewer.scene.input.on("mouseup", () => {
|
|
93029
|
-
down = false;
|
|
93030
|
-
});
|
|
93031
|
-
|
|
93032
|
-
this._onSceneMouseMove = viewer.scene.input.on("mousemove", () => {
|
|
93033
|
-
if (!down) {
|
|
93034
|
-
return;
|
|
93035
|
-
}
|
|
93036
|
-
switchToLowQuality();
|
|
93037
|
-
});
|
|
93038
93045
|
}
|
|
93039
93046
|
|
|
93040
93047
|
/**
|
package/dist/xeokit-sdk.es5.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* xeokit-sdk v2.6.
|
|
3
|
-
* Commit:
|
|
4
|
-
* Built: 2025-
|
|
2
|
+
* xeokit-sdk v2.6.76
|
|
3
|
+
* Commit: dd09d800ebb3a626d7767a83af023ed05e49f2fa
|
|
4
|
+
* Built: 2025-05-10T10:08:24.044Z
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
var _globalThis$loaders3,_DRACO_EXTERNAL_LIBRA,_DEFAULT_SAMPLER_PARA;var _marked=/*#__PURE__*/_regeneratorRuntime().mark(makeStringIterator),_marked2=/*#__PURE__*/_regeneratorRuntime().mark(makeArrayBufferIterator),_marked3=/*#__PURE__*/_regeneratorRuntime().mark(makeMeshPrimitiveIterator);function _wrapNativeSuper(Class){var _cache=typeof Map==="function"?new Map():undefined;_wrapNativeSuper=function _wrapNativeSuper(Class){if(Class===null||!_isNativeFunction(Class))return Class;if(typeof Class!=="function"){throw new TypeError("Super expression must either be null or a function");}if(typeof _cache!=="undefined"){if(_cache.has(Class))return _cache.get(Class);_cache.set(Class,Wrapper);}function Wrapper(){return _construct(Class,arguments,_getPrototypeOf(this).constructor);}Wrapper.prototype=Object.create(Class.prototype,{constructor:{value:Wrapper,enumerable:false,writable:true,configurable:true}});return _setPrototypeOf(Wrapper,Class);};return _wrapNativeSuper(Class);}function _construct(Parent,args,Class){if(_isNativeReflectConstruct()){_construct=Reflect.construct.bind();}else{_construct=function _construct(Parent,args,Class){var a=[null];a.push.apply(a,args);var Constructor=Function.bind.apply(Parent,a);var instance=new Constructor();if(Class)_setPrototypeOf(instance,Class.prototype);return instance;};}return _construct.apply(null,arguments);}function _isNativeFunction(fn){return Function.toString.call(fn).indexOf("[native code]")!==-1;}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return exports;};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key];}try{define({},"");}catch(err){define=function define(obj,key,value){return obj[key]=value;};}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return generator._invoke=function(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult();}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult;}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg);}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done};}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg);}};}(innerFn,self,context),generator;}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)};}catch(err){return{type:"throw",arg:err};}}exports.wrap=wrap;var ContinueSentinel={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this;});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg);});});}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject);},function(err){invoke("throw",err,resolve,reject);}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result);},function(error){return invoke("throw",error,resolve,reject);});}reject(record.arg);}var previousPromise;this._invoke=function(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject);});}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();};}function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(undefined===method){if(context.delegate=null,"throw"===context.method){if(delegate.iterator["return"]&&(context.method="return",context.arg=undefined,maybeInvokeDelegate(delegate,context),"throw"===context.method))return ContinueSentinel;context.method="throw",context.arg=new TypeError("The iterator does not provide a 'throw' method");}return ContinueSentinel;}var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=undefined),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel);}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry);}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record;}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0);}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;){if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;}return next.value=undefined,next.done=!0,next;};return next.next=next;}}return{next:doneResult};}function doneResult(){return{value:undefined,done:!0};}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(Gp,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return!!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name));},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun;},exports.awrap=function(arg){return{__await:arg};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this;}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next();});},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this;}),define(Gp,"toString",function(){return"[object Generator]";}),exports.keys=function(object){var keys=[];for(var key in object){keys.push(key);}return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next;}return next.done=!0,next;};},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=undefined,this.done=!1,this.delegate=null,this.method="next",this.arg=undefined,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this){"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=undefined);}},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval;},dispatchException:function dispatchException(exception){if(this.done)throw exception;var context=this;function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=undefined),!!caught;}for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc);}else if(hasCatch){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);}else{if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc);}}}},abrupt:function abrupt(type,arg){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break;}}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record);},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return"break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel;},finish:function finish(finallyLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel;}},"catch":function _catch(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry);}return thrown;}}throw new Error("illegal catch attempt");},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=undefined),ContinueSentinel;}},exports;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]};},e:function e(_e14){throw _e14;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o);},n:function n(){var step=it.next();normalCompletion=step.done;return step;},e:function e(_e15){didErr=true;err=_e15;},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]();}finally{if(didErr)throw err;}}};}function _get(){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get.bind();}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(arguments.length<3?target:receiver);}return desc.value;};}return _get.apply(this,arguments);}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break;}return object;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _awaitAsyncGenerator(value){return new _AwaitValue(value);}function _wrapAsyncGenerator(fn){return function(){return new _AsyncGenerator(fn.apply(this,arguments));};}function _AsyncGenerator(gen){var front,back;function send(key,arg){return new Promise(function(resolve,reject){var request={key:key,arg:arg,resolve:resolve,reject:reject,next:null};if(back){back=back.next=request;}else{front=back=request;resume(key,arg);}});}function resume(key,arg){try{var result=gen[key](arg);var value=result.value;var wrappedAwait=value instanceof _AwaitValue;Promise.resolve(wrappedAwait?value.wrapped:value).then(function(arg){if(wrappedAwait){resume(key==="return"?"return":"next",arg);return;}settle(result.done?"return":"normal",arg);},function(err){resume("throw",err);});}catch(err){settle("throw",err);}}function settle(type,value){switch(type){case"return":front.resolve({value:value,done:true});break;case"throw":front.reject(value);break;default:front.resolve({value:value,done:false});break;}front=front.next;if(front){resume(front.key,front.arg);}else{back=null;}}this._invoke=send;if(typeof gen["return"]!=="function"){this["return"]=undefined;}}_AsyncGenerator.prototype[typeof Symbol==="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this;};_AsyncGenerator.prototype.next=function(arg){return this._invoke("next",arg);};_AsyncGenerator.prototype["throw"]=function(arg){return this._invoke("throw",arg);};_AsyncGenerator.prototype["return"]=function(arg){return this._invoke("return",arg);};function _AwaitValue(value){this.wrapped=value;}function _asyncIterator(iterable){var method,async,sync,retry=2;for("undefined"!=typeof Symbol&&(async=Symbol.asyncIterator,sync=Symbol.iterator);retry--;){if(async&&null!=(method=iterable[async]))return method.call(iterable);if(sync&&null!=(method=iterable[sync]))return new AsyncFromSyncIterator(method.call(iterable));async="@@asyncIterator",sync="@@iterator";}throw new TypeError("Object is not async iterable");}function AsyncFromSyncIterator(s){function AsyncFromSyncIteratorContinuation(r){if(Object(r)!==r)return Promise.reject(new TypeError(r+" is not an object."));var done=r.done;return Promise.resolve(r.value).then(function(value){return{value:value,done:done};});}return AsyncFromSyncIterator=function AsyncFromSyncIterator(s){this.s=s,this.n=s.next;},AsyncFromSyncIterator.prototype={s:null,n:null,next:function next(){return AsyncFromSyncIteratorContinuation(this.n.apply(this.s,arguments));},"return":function _return(value){var ret=this.s["return"];return void 0===ret?Promise.resolve({value:value,done:!0}):AsyncFromSyncIteratorContinuation(ret.apply(this.s,arguments));},"throw":function _throw(value){var thr=this.s["return"];return void 0===thr?Promise.reject(value):AsyncFromSyncIteratorContinuation(thr.apply(this.s,arguments));}},new AsyncFromSyncIterator(s);}/** @private */var Map$1=/*#__PURE__*/function(){function Map$1(items,baseId){_classCallCheck(this,Map$1);this.items=items||[];this._lastUniqueId=(baseId||0)+1;}/**
|
|
@@ -15177,7 +15177,7 @@ gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}if(this._uZFar){gl.uniform1f(t
|
|
|
15177
15177
|
*/var TrianglesColorRenderer$1=/*#__PURE__*/function(_TrianglesBatchingRen){_inherits(TrianglesColorRenderer$1,_TrianglesBatchingRen);var _super52=_createSuper(TrianglesColorRenderer$1);function TrianglesColorRenderer$1(){_classCallCheck(this,TrianglesColorRenderer$1);return _super52.apply(this,arguments);}_createClass(TrianglesColorRenderer$1,[{key:"_getHash",value:function _getHash(){var scene=this._scene;return[scene._lightsState.getHash(),scene._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";");}},{key:"drawLayer",value:function drawLayer(frameCtx,layer,renderPass){_get(_getPrototypeOf(TrianglesColorRenderer$1.prototype),"drawLayer",this).call(this,frameCtx,layer,renderPass,{incrementDrawState:true});}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var lightsState=scene._lightsState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var light;var src=[];src.push("#version 300 es");src.push("// Triangles batching draw vertex shader");src.push("uniform int renderPass;");src.push("in vec3 position;");src.push("in vec3 normal;");src.push("in vec4 color;");src.push("in float flags;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}this._addMatricesUniformBlockLines(src,true);if(scene.logarithmicDepthBufferEnabled){src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}src.push("uniform vec4 lightAmbient;");for(var _i194=0,len=lightsState.lights.length;_i194<len;_i194++){light=lightsState.lights[_i194];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+_i194+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+_i194+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+_i194+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+_i194+";");src.push("uniform vec3 lightDir"+_i194+";");}}src.push("vec3 octDecode(vec2 oct) {");src.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));");src.push(" if (v.z < 0.0) {");src.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);");src.push(" }");src.push(" return normalize(v);");src.push("}");if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out vec4 vColor;");src.push("void main(void) {");// colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT
|
|
15178
15178
|
// renderPass = COLOR_OPAQUE
|
|
15179
15179
|
src.push("int colorFlag = int(flags) & 0xF;");src.push("if (colorFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
|
|
15180
|
-
src.push("} else {");src.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); ");if(scene.entityOffsetsEnabled){src.push("worldPosition.xyz = worldPosition.xyz + offset;");}src.push("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); ");src.push("vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);");src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");for(var _i195=0,_len20=lightsState.lights.length;_i195<_len20;_i195++){light=lightsState.lights[_i195];if(light.type==="ambient"){continue;}if(light.type==="dir"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i195+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i195+", 0.0)).xyz);");}}else if(light.type==="point"){if(light.space==="view"){src.push("viewLightDir = -normalize(lightPos"+_i195+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+_i195+", 0.0)).xyz);");}}else if(light.type==="spot"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i195+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i195+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+_i195+".rgb * lightColor"+_i195+".a);");}src.push("vec3 rgb = (vec3(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0));");src.push("vColor = vec4((lightAmbient.rgb * lightAmbient.a * rgb) + (reflectedColor * rgb), float(color.a) / 255.0);");src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags = flags;");}src.push("gl_Position = clipPos;");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Triangles batching draw fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i196=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i196<len;_i196++){src.push("uniform bool sectionPlaneActive"+_i196+";");src.push("uniform vec3 sectionPlanePos"+_i196+";");src.push("uniform vec3 sectionPlaneDir"+_i196+";");}src.push("uniform float sliceThickness;");src.push("uniform vec4 sliceColor;");}src.push("in vec4 vColor;");src.push("out vec4 outColor;");src.push("void main(void) {");src.push(" vec4 newColor;");src.push(" newColor = vColor;");if(clipping){src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var _i197=0,_len21=sectionPlanesState.getNumAllocatedSectionPlanes();_i197<_len21;_i197++){src.push("if (sectionPlaneActive"+_i197+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i197+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i197+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > sliceThickness) { ");src.push(" discard;");src.push(" }");src.push(" if (dist > 0.0) { ");src.push(" newColor = sliceColor;");src.push(" }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push(" float dx = dFdx(vFragDepth);");src.push(" float dy = dFdy(vFragDepth);");src.push(" float diff = sqrt(dx*dx+dy*dy);");src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");}if(this._withSAO){// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
|
|
15180
|
+
src.push("} else {");src.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); ");if(scene.entityOffsetsEnabled){src.push("worldPosition.xyz = worldPosition.xyz + offset;");}src.push("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); ");src.push("vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);");src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");for(var _i195=0,_len20=lightsState.lights.length;_i195<_len20;_i195++){light=lightsState.lights[_i195];if(light.type==="ambient"){continue;}if(light.type==="dir"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i195+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i195+", 0.0)).xyz);");}}else if(light.type==="point"){if(light.space==="view"){src.push("viewLightDir = -normalize(lightPos"+_i195+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+_i195+", 0.0)).xyz);");}}else if(light.type==="spot"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i195+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i195+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+_i195+".rgb * lightColor"+_i195+".a);");}src.push("vec3 rgb = (vec3(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0));");src.push("vColor = vec4((lightAmbient.rgb * lightAmbient.a * rgb) + (reflectedColor * rgb), float(color.a) / 255.0);");src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags = flags;");}src.push("gl_Position = clipPos;");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Triangles batching draw fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i196=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i196<len;_i196++){src.push("uniform bool sectionPlaneActive"+_i196+";");src.push("uniform vec3 sectionPlanePos"+_i196+";");src.push("uniform vec3 sectionPlaneDir"+_i196+";");}src.push("uniform float sliceThickness;");src.push("uniform vec4 sliceColor;");}src.push("in vec4 vColor;");src.push("out vec4 outColor;");src.push("void main(void) {");src.push(" vec4 newColor;");src.push(" newColor = vColor;");if(clipping){src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var _i197=0,_len21=sectionPlanesState.getNumAllocatedSectionPlanes();_i197<_len21;_i197++){src.push("if (sectionPlaneActive"+_i197+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i197+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i197+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > sliceThickness) { ");src.push(" discard;");src.push(" }");src.push(" if (dist > 0.0) { ");src.push(" newColor = sliceColor;");src.push(" }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push(" float dx = dFdx(vFragDepth);");src.push(" float dy = dFdy(vFragDepth);");src.push(" float diff = sqrt(dx*dx+dy*dy);");src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");}else{src.push(" float dx = dFdx(gl_FragCoord.z);");src.push(" float dy = dFdy(gl_FragCoord.z);");src.push(" float diff = sqrt(dx*dx+dy*dy);");src.push(" gl_FragDepth = gl_FragCoord.z + diff;");}if(this._withSAO){// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
|
|
15181
15181
|
// Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject
|
|
15182
15182
|
src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(newColor.rgb * ambient, 1.0);");}else{src.push(" outColor = newColor;");}src.push("}");return src;}}]);return TrianglesColorRenderer$1;}(TrianglesBatchingRenderer);/**
|
|
15183
15183
|
* @private
|
|
@@ -15186,7 +15186,7 @@ src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewp
|
|
|
15186
15186
|
src.push("int colorFlag = int(flags) & 0xF;");src.push("if (colorFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
|
|
15187
15187
|
src.push("} else {");src.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); ");if(scene.entityOffsetsEnabled){src.push("worldPosition.xyz = worldPosition.xyz + offset;");}src.push("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vViewPosition = viewPosition;");src.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);");src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags = flags;");}src.push("gl_Position = clipPos;");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var lightsState=scene._lightsState;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Triangles batching flat-shading draw fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i198=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i198<len;_i198++){src.push("uniform bool sectionPlaneActive"+_i198+";");src.push("uniform vec3 sectionPlanePos"+_i198+";");src.push("uniform vec3 sectionPlaneDir"+_i198+";");}src.push("uniform float sliceThickness;");src.push("uniform vec4 sliceColor;");}this._addMatricesUniformBlockLines(src);src.push("uniform vec4 lightAmbient;");for(var _i199=0,_len22=lightsState.lights.length;_i199<_len22;_i199++){var light=lightsState.lights[_i199];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+_i199+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+_i199+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+_i199+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+_i199+";");src.push("uniform vec3 lightDir"+_i199+";");}}src.push("in vec4 vViewPosition;");src.push("in vec4 vColor;");src.push("out vec4 outColor;");src.push("void main(void) {");src.push(" vec4 newColor;");src.push(" newColor = vColor;");if(clipping){src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var _i200=0,_len23=sectionPlanesState.getNumAllocatedSectionPlanes();_i200<_len23;_i200++){src.push("if (sectionPlaneActive"+_i200+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i200+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i200+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > sliceThickness) { ");src.push(" discard;");src.push(" }");src.push(" if (dist > 0.0) { ");src.push(" newColor = sliceColor;");src.push(" }");src.push("}");}src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");src.push("vec3 xTangent = dFdx( vViewPosition.xyz );");src.push("vec3 yTangent = dFdy( vViewPosition.xyz );");src.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(var _i201=0,_len24=lightsState.lights.length;_i201<_len24;_i201++){var _light4=lightsState.lights[_i201];if(_light4.type==="ambient"){continue;}if(_light4.type==="dir"){if(_light4.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i201+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i201+", 0.0)).xyz);");}}else if(_light4.type==="point"){if(_light4.space==="view"){src.push("viewLightDir = -normalize(lightPos"+_i201+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+_i201+", 0.0)).xyz);");}}else if(_light4.type==="spot"){if(_light4.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i201+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i201+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+_i201+".rgb * lightColor"+_i201+".a);");}src.push("vec4 fragColor = vec4((lightAmbient.rgb * lightAmbient.a * newColor.rgb) + (reflectedColor * newColor.rgb), newColor.a);");if(this._withSAO){// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
|
|
15188
15188
|
// Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject
|
|
15189
|
-
src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(fragColor.rgb * ambient, 1.0);");}else{src.push(" outColor = fragColor;");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("}");return src;}}]);return TrianglesFlatColorRenderer$1;}(TrianglesBatchingRenderer);/**
|
|
15189
|
+
src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(fragColor.rgb * ambient, 1.0);");}else{src.push(" outColor = fragColor;");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}else{src.push(" float dx = dFdx(gl_FragCoord.z);");src.push(" float dy = dFdy(gl_FragCoord.z);");src.push(" float diff = sqrt(dx*dx+dy*dy);");src.push(" gl_FragDepth = gl_FragCoord.z + diff;");}src.push("}");return src;}}]);return TrianglesFlatColorRenderer$1;}(TrianglesBatchingRenderer);/**
|
|
15190
15190
|
* @private
|
|
15191
15191
|
*/var TrianglesSilhouetteRenderer$1=/*#__PURE__*/function(_TrianglesBatchingRen3){_inherits(TrianglesSilhouetteRenderer$1,_TrianglesBatchingRen3);var _super54=_createSuper(TrianglesSilhouetteRenderer$1);function TrianglesSilhouetteRenderer$1(){_classCallCheck(this,TrianglesSilhouetteRenderer$1);return _super54.apply(this,arguments);}_createClass(TrianglesSilhouetteRenderer$1,[{key:"drawLayer",value:function drawLayer(frameCtx,batchingLayer,renderPass){_get(_getPrototypeOf(TrianglesSilhouetteRenderer$1.prototype),"drawLayer",this).call(this,frameCtx,batchingLayer,renderPass,{colorUniform:true});}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Triangles batching silhouette vertex shader");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("in vec4 color;");this._addMatricesUniformBlockLines(src);src.push("uniform vec4 silhouetteColor;");if(scene.logarithmicDepthBufferEnabled){src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out vec4 vColor;");src.push("void main(void) {");// silhouetteFlag = NOT_RENDERED | SILHOUETTE_HIGHLIGHTED | SILHOUETTE_SELECTED | SILHOUETTE_XRAYED
|
|
15192
15192
|
// renderPass = SILHOUETTE_HIGHLIGHTED | SILHOUETTE_SELECTED | | SILHOUETTE_XRAYED
|
|
@@ -15510,7 +15510,7 @@ math.triangleNormal(a,b,c,worldNormal);}gotIntersect=true;}}}if(gotIntersect&&wo
|
|
|
15510
15510
|
src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");src.push("in vec4 modelNormalMatrixCol0;");src.push("in vec4 modelNormalMatrixCol1;");src.push("in vec4 modelNormalMatrixCol2;");this._addMatricesUniformBlockLines(src,true);if(scene.logarithmicDepthBufferEnabled){src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}src.push("uniform vec4 lightAmbient;");for(i=0,len=lightsState.lights.length;i<len;i++){light=lightsState.lights[i];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+i+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+i+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+i+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+i+";");src.push("uniform vec3 lightDir"+i+";");}}src.push("vec3 octDecode(vec2 oct) {");src.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));");src.push(" if (v.z < 0.0) {");src.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);");src.push(" }");src.push(" return normalize(v);");src.push("}");if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out vec4 vColor;");src.push("void main(void) {");// colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT
|
|
15511
15511
|
// renderPass = COLOR_OPAQUE | COLOR_TRANSPARENT
|
|
15512
15512
|
src.push("int colorFlag = int(flags) & 0xF;");src.push("if (colorFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
|
|
15513
|
-
src.push("} else {");src.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); ");src.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);");if(scene.entityOffsetsEnabled){src.push("worldPosition.xyz = worldPosition.xyz + offset;");}src.push("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); ");src.push("vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 0.0);");src.push("vec3 viewNormal = normalize(vec4(viewNormalMatrix * worldNormal).xyz);");src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");for(i=0,len=lightsState.lights.length;i<len;i++){light=lightsState.lights[i];if(light.type==="ambient"){continue;}if(light.type==="dir"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+i+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+i+", 0.0)).xyz);");}}else if(light.type==="point"){if(light.space==="view"){src.push("viewLightDir = -normalize(lightPos"+i+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+i+", 0.0)).xyz);");}}else if(light.type==="spot"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+i+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+i+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+i+".rgb * lightColor"+i+".a);");}src.push("vec3 rgb = (vec3(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0));");src.push("vColor = vec4((lightAmbient.rgb * lightAmbient.a * rgb) + (reflectedColor * rgb), float(color.a) / 255.0);");src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags = flags;");}src.push("gl_Position = clipPos;");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Instancing geometry drawing fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i249=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i249<len;_i249++){src.push("uniform bool sectionPlaneActive"+_i249+";");src.push("uniform vec3 sectionPlanePos"+_i249+";");src.push("uniform vec3 sectionPlaneDir"+_i249+";");}src.push("uniform float sliceThickness;");src.push("uniform vec4 sliceColor;");}src.push("in vec4 vColor;");src.push("out vec4 outColor;");src.push("void main(void) {");src.push(" vec4 newColor;");src.push(" newColor = vColor;");if(clipping){src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var _i250=0,_len43=sectionPlanesState.getNumAllocatedSectionPlanes();_i250<_len43;_i250++){src.push("if (sectionPlaneActive"+_i250+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i250+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i250+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > sliceThickness) { ");src.push(" discard;");src.push(" }");src.push(" if (dist > 0.0) { ");src.push(" newColor = sliceColor;");src.push(" }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push(" float dx = dFdx(vFragDepth);");src.push(" float dy = dFdy(vFragDepth);");src.push(" float diff = sqrt(dx*dx+dy*dy);");src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");}// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
|
|
15513
|
+
src.push("} else {");src.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); ");src.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);");if(scene.entityOffsetsEnabled){src.push("worldPosition.xyz = worldPosition.xyz + offset;");}src.push("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); ");src.push("vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 0.0);");src.push("vec3 viewNormal = normalize(vec4(viewNormalMatrix * worldNormal).xyz);");src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");for(i=0,len=lightsState.lights.length;i<len;i++){light=lightsState.lights[i];if(light.type==="ambient"){continue;}if(light.type==="dir"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+i+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+i+", 0.0)).xyz);");}}else if(light.type==="point"){if(light.space==="view"){src.push("viewLightDir = -normalize(lightPos"+i+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+i+", 0.0)).xyz);");}}else if(light.type==="spot"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+i+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+i+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+i+".rgb * lightColor"+i+".a);");}src.push("vec3 rgb = (vec3(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0));");src.push("vColor = vec4((lightAmbient.rgb * lightAmbient.a * rgb) + (reflectedColor * rgb), float(color.a) / 255.0);");src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags = flags;");}src.push("gl_Position = clipPos;");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Instancing geometry drawing fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i249=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i249<len;_i249++){src.push("uniform bool sectionPlaneActive"+_i249+";");src.push("uniform vec3 sectionPlanePos"+_i249+";");src.push("uniform vec3 sectionPlaneDir"+_i249+";");}src.push("uniform float sliceThickness;");src.push("uniform vec4 sliceColor;");}src.push("in vec4 vColor;");src.push("out vec4 outColor;");src.push("void main(void) {");src.push(" vec4 newColor;");src.push(" newColor = vColor;");if(clipping){src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var _i250=0,_len43=sectionPlanesState.getNumAllocatedSectionPlanes();_i250<_len43;_i250++){src.push("if (sectionPlaneActive"+_i250+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i250+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i250+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > sliceThickness) { ");src.push(" discard;");src.push(" }");src.push(" if (dist > 0.0) { ");src.push(" newColor = sliceColor;");src.push(" }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push(" float dx = dFdx(vFragDepth);");src.push(" float dy = dFdy(vFragDepth);");src.push(" float diff = sqrt(dx*dx+dy*dy);");src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");}else{src.push(" float dx = dFdx(gl_FragCoord.z);");src.push(" float dy = dFdy(gl_FragCoord.z);");src.push(" float diff = sqrt(dx*dx+dy*dy);");src.push(" gl_FragDepth = gl_FragCoord.z + diff;");}// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
|
|
15514
15514
|
// Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject
|
|
15515
15515
|
if(this._withSAO){src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(newColor.rgb * ambient, 1.0);");}else{src.push(" outColor = newColor;");}src.push("}");return src;}}]);return TrianglesColorRenderer;}(TrianglesInstancingRenderer);/**
|
|
15516
15516
|
* @private
|
|
@@ -15520,7 +15520,7 @@ src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");this._
|
|
|
15520
15520
|
src.push("int colorFlag = int(flags) & 0xF;");src.push("if (colorFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
|
|
15521
15521
|
src.push("} else {");src.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); ");src.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);");if(scene.entityOffsetsEnabled){src.push(" worldPosition.xyz = worldPosition.xyz + offset;");}src.push("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vViewPosition = viewPosition;");src.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);");src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags = flags;");}src.push("gl_Position = clipPos;");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var lightsState=scene._lightsState;var i;var len;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Instancing geometry flat-shading drawing fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i251=0,_len44=sectionPlanesState.getNumAllocatedSectionPlanes();_i251<_len44;_i251++){src.push("uniform bool sectionPlaneActive"+_i251+";");src.push("uniform vec3 sectionPlanePos"+_i251+";");src.push("uniform vec3 sectionPlaneDir"+_i251+";");}src.push("uniform float sliceThickness;");src.push("uniform vec4 sliceColor;");}this._addMatricesUniformBlockLines(src);src.push("uniform vec4 lightAmbient;");for(i=0,len=lightsState.lights.length;i<len;i++){var light=lightsState.lights[i];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+i+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+i+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+i+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+i+";");src.push("uniform vec3 lightDir"+i+";");}}src.push("in vec4 vViewPosition;");src.push("in vec4 vColor;");src.push("out vec4 outColor;");src.push("void main(void) {");src.push(" vec4 newColor;");src.push(" newColor = vColor;");if(clipping){src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var _i252=0,_len45=sectionPlanesState.getNumAllocatedSectionPlanes();_i252<_len45;_i252++){src.push("if (sectionPlaneActive"+_i252+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i252+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i252+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > sliceThickness) { ");src.push(" discard;");src.push(" }");src.push(" if (dist > 0.0) { ");src.push(" newColor = sliceColor;");src.push(" }");src.push("}");}src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");src.push("vec3 xTangent = dFdx( vViewPosition.xyz );");src.push("vec3 yTangent = dFdy( vViewPosition.xyz );");src.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(i=0,len=lightsState.lights.length;i<len;i++){var _light7=lightsState.lights[i];if(_light7.type==="ambient"){continue;}if(_light7.type==="dir"){if(_light7.space==="view"){src.push("viewLightDir = normalize(lightDir"+i+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+i+", 0.0)).xyz);");}}else if(_light7.type==="point"){if(_light7.space==="view"){src.push("viewLightDir = -normalize(lightPos"+i+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+i+", 0.0)).xyz);");}}else if(_light7.type==="spot"){if(_light7.space==="view"){src.push("viewLightDir = normalize(lightDir"+i+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+i+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+i+".rgb * lightColor"+i+".a);");}src.push("vec4 fragColor = vec4((lightAmbient.rgb * lightAmbient.a * newColor.rgb) + (reflectedColor * newColor.rgb), newColor.a);");if(this._withSAO){// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
|
|
15522
15522
|
// Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject
|
|
15523
|
-
src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(fragColor.rgb * ambient, 1.0);");}else{src.push(" outColor = fragColor;");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("}");return src;}}]);return TrianglesFlatColorRenderer;}(TrianglesInstancingRenderer);/**
|
|
15523
|
+
src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(fragColor.rgb * ambient, 1.0);");}else{src.push(" outColor = fragColor;");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}else{src.push(" float dx = dFdx(gl_FragCoord.z);");src.push(" float dy = dFdy(gl_FragCoord.z);");src.push(" float diff = sqrt(dx*dx+dy*dy);");src.push(" gl_FragDepth = gl_FragCoord.z + diff;");}src.push("}");return src;}}]);return TrianglesFlatColorRenderer;}(TrianglesInstancingRenderer);/**
|
|
15524
15524
|
* @private
|
|
15525
15525
|
*/var TrianglesSilhouetteRenderer=/*#__PURE__*/function(_TrianglesInstancingR3){_inherits(TrianglesSilhouetteRenderer,_TrianglesInstancingR3);var _super73=_createSuper(TrianglesSilhouetteRenderer);function TrianglesSilhouetteRenderer(){_classCallCheck(this,TrianglesSilhouetteRenderer);return _super73.apply(this,arguments);}_createClass(TrianglesSilhouetteRenderer,[{key:"drawLayer",value:function drawLayer(frameCtx,instancingLayer,renderPass){// TODO color uniform true ???
|
|
15526
15526
|
_get(_getPrototypeOf(TrianglesSilhouetteRenderer.prototype),"drawLayer",this).call(this,frameCtx,instancingLayer,renderPass,{colorUniform:true});}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Instancing silhouette vertex shader");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("in vec4 color;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
|
|
@@ -16579,7 +16579,7 @@ src.push(" return;");src.push("};");src.push("vec3 normal = normalize(cross(po
|
|
|
16579
16579
|
src.push("if (solid != 1u) {");src.push("if (isPerspectiveMatrix(projMatrix)) {");src.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;");// src.push("vColor = vec4(vec3(1, -1, 0)*dot(normalize(position.xyz - uCameraEyeRtcInQuantizedSpace), normal), 1);")
|
|
16580
16580
|
src.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {");src.push("position = positions[2 - (gl_VertexID % 3)];");src.push("viewNormal = -viewNormal;");src.push("}");src.push("} else {");// src.push("vColor = vec4(vec3(1, -1, 0)*viewNormal.z, 1);")
|
|
16581
16581
|
src.push("if (viewNormal.z < 0.0) {");src.push("position = positions[2 - (gl_VertexID % 3)];");src.push("viewNormal = -viewNormal;");src.push("}");src.push("}");src.push("}");src.push("vec4 worldPosition = sceneModelMatrix * ((objectDecodeAndInstanceMatrix * vec4(position, 1.0))); ");src.push("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");for(var _i361=0,_len68=lightsState.lights.length;_i361<_len68;_i361++){light=lightsState.lights[_i361];if(light.type==="ambient"){continue;}if(light.type==="dir"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i361+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i361+", 0.0)).xyz);");}}else if(light.type==="point"){if(light.space==="view"){src.push("viewLightDir = -normalize(lightPos"+_i361+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+_i361+", 0.0)).xyz);");}}else if(light.type==="spot"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i361+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i361+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+_i361+".rgb * lightColor"+_i361+".a);");}src.push("vec3 rgb = vec3(color.rgb) / 255.0;");src.push("vColor = vec4((lightAmbient.rgb * lightAmbient.a * rgb) + (reflectedColor * rgb), float(color.a) / 255.0);");src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags2 = flags2.r;");}src.push("gl_Position = clipPos;");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// TrianglesDataTextureColorRenderer fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("flat in uint vFlags2;");for(var _i362=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i362<len;_i362++){src.push("uniform bool sectionPlaneActive"+_i362+";");src.push("uniform vec3 sectionPlanePos"+_i362+";");src.push("uniform vec3 sectionPlaneDir"+_i362+";");}src.push("uniform float sliceThickness;");src.push("uniform vec4 sliceColor;");}src.push("in vec4 vColor;");src.push("out vec4 outColor;");src.push("void main(void) {");src.push(" vec4 newColor;");src.push(" newColor = vColor;");if(clipping){src.push(" bool clippable = vFlags2 > 0u;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var _i363=0,_len69=sectionPlanesState.getNumAllocatedSectionPlanes();_i363<_len69;_i363++){src.push("if (sectionPlaneActive"+_i363+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i363+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i363+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > sliceThickness) { ");src.push(" discard;");src.push(" }");src.push(" if (dist > 0.0) { ");src.push(" newColor = sliceColor;");src.push(" }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");//src.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");
|
|
16582
|
-
}if(this._withSAO){// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
|
|
16582
|
+
}else{src.push(" float dx = dFdx(gl_FragCoord.z);");src.push(" float dy = dFdy(gl_FragCoord.z);");src.push(" float diff = sqrt(dx*dx+dy*dy);");src.push(" gl_FragDepth = gl_FragCoord.z + diff;");}if(this._withSAO){// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
|
|
16583
16583
|
// Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject
|
|
16584
16584
|
src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(newColor.rgb * ambient, 1.0);");}else{src.push(" outColor = newColor;");}src.push("}");return src;}},{key:"webglContextRestored",value:function webglContextRestored(){this._program=null;}},{key:"destroy",value:function destroy(){if(this._program){this._program.destroy();}this._program=null;}}]);return DTXTrianglesColorRenderer;}();var defaultColor$1=new Float32Array([1,1,1]);var tempVec3a$l=math.vec3();var tempVec3b$h=math.vec3();var tempVec3c$d=math.vec3();math.vec3();var tempMat4a$b=math.mat4();/**
|
|
16585
16585
|
* @private
|
|
@@ -20869,7 +20869,7 @@ return pickResult&&pickResult.worldPos?pickResult.worldPos:snap&&tryPickWorldPos
|
|
|
20869
20869
|
* @param {Boolean} [cfg.delayBeforeRestore=true] Whether to temporarily have a delay before restoring normal rendering after we stop interacting with the Viewer.
|
|
20870
20870
|
* @param {Number} [cfg.delayBeforeRestoreSeconds=0.5] Delay in seconds before restoring normal rendering after we stop interacting with the Viewer.
|
|
20871
20871
|
* @param {Function} [cfg.onMoved] Optional callback function fired during moving mode, should return the callback function that will be fired when the interaction stops.
|
|
20872
|
-
*/function FastNavPlugin(viewer){var _this106;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,FastNavPlugin);_this106=_super129.call(this,"FastNav",viewer);_this106._hideColorTexture=cfg.hideColorTexture!==false;_this106._hidePBR=cfg.hidePBR!==false;_this106._hideSAO=cfg.hideSAO!==false;_this106._hideEdges=cfg.hideEdges!==false;_this106._hideTransparentObjects=!!cfg.hideTransparentObjects;_this106._scaleCanvasResolution=!!cfg.scaleCanvasResolution;_this106._defaultScaleCanvasResolutionFactor=cfg.defaultScaleCanvasResolutionFactor;_this106._scaleCanvasResolutionFactor=cfg.scaleCanvasResolutionFactor||0.6;_this106._delayBeforeRestore=cfg.delayBeforeRestore!==false;_this106._delayBeforeRestoreSeconds=cfg.delayBeforeRestoreSeconds||0.5;_this106._onMoved=cfg.onMoved;_this106._onStopped=null;var timer=_this106._delayBeforeRestoreSeconds*1000;var fastMode=false;var switchToLowQuality=function switchToLowQuality(){timer=_this106._delayBeforeRestoreSeconds*1000;if(!fastMode){viewer.scene._renderer.setColorTextureEnabled(!_this106._hideColorTexture);viewer.scene._renderer.setPBREnabled(!_this106._hidePBR);viewer.scene._renderer.setSAOEnabled(!_this106._hideSAO);viewer.scene._renderer.setTransparentEnabled(!_this106._hideTransparentObjects);viewer.scene._renderer.setEdgesEnabled(!_this106._hideEdges);_this106._originalCanvasResolutionScale=viewer.scene.canvas.resolutionScale;if(_this106._scaleCanvasResolution){viewer.scene.canvas.resolutionScale=_this106._scaleCanvasResolutionFactor;}else{viewer.scene.canvas.resolutionScale=_this106._defaultScaleCanvasResolutionFactor;}if(_this106._onMoved){_this106._onStopped=_this106._onMoved();}fastMode=true;}};var switchToHighQuality=function switchToHighQuality(){viewer.scene.canvas.resolutionScale=_this106._defaultScaleCanvasResolutionFactor||_this106._originalCanvasResolutionScale||1.0;viewer.scene._renderer.setEdgesEnabled(true);viewer.scene._renderer.setColorTextureEnabled(true);viewer.scene._renderer.setPBREnabled(true);viewer.scene._renderer.setSAOEnabled(true);viewer.scene._renderer.setTransparentEnabled(true);if(_this106._onStopped){_this106._onStopped();}fastMode=false;};_this106.
|
|
20872
|
+
*/function FastNavPlugin(viewer){var _this106;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,FastNavPlugin);_this106=_super129.call(this,"FastNav",viewer);_this106._hideColorTexture=cfg.hideColorTexture!==false;_this106._hidePBR=cfg.hidePBR!==false;_this106._hideSAO=cfg.hideSAO!==false;_this106._hideEdges=cfg.hideEdges!==false;_this106._hideTransparentObjects=!!cfg.hideTransparentObjects;_this106._scaleCanvasResolution=!!cfg.scaleCanvasResolution;_this106._defaultScaleCanvasResolutionFactor=cfg.defaultScaleCanvasResolutionFactor;_this106._scaleCanvasResolutionFactor=cfg.scaleCanvasResolutionFactor||0.6;_this106._delayBeforeRestore=cfg.delayBeforeRestore!==false;_this106._delayBeforeRestoreSeconds=cfg.delayBeforeRestoreSeconds||0.5;_this106._onMoved=cfg.onMoved;_this106._onStopped=null;var timer=_this106._delayBeforeRestoreSeconds*1000;var fastMode=false;var switchToLowQuality=function switchToLowQuality(){timer=_this106._delayBeforeRestoreSeconds*1000;if(!fastMode){viewer.scene._renderer.setColorTextureEnabled(!_this106._hideColorTexture);viewer.scene._renderer.setPBREnabled(!_this106._hidePBR);viewer.scene._renderer.setSAOEnabled(!_this106._hideSAO);viewer.scene._renderer.setTransparentEnabled(!_this106._hideTransparentObjects);viewer.scene._renderer.setEdgesEnabled(!_this106._hideEdges);_this106._originalCanvasResolutionScale=viewer.scene.canvas.resolutionScale;if(_this106._scaleCanvasResolution){viewer.scene.canvas.resolutionScale=_this106._scaleCanvasResolutionFactor;}else{viewer.scene.canvas.resolutionScale=_this106._defaultScaleCanvasResolutionFactor;}if(_this106._onMoved){_this106._onStopped=_this106._onMoved();}fastMode=true;}};var switchToHighQuality=function switchToHighQuality(){viewer.scene.canvas.resolutionScale=_this106._defaultScaleCanvasResolutionFactor||_this106._originalCanvasResolutionScale||1.0;viewer.scene._renderer.setEdgesEnabled(true);viewer.scene._renderer.setColorTextureEnabled(true);viewer.scene._renderer.setPBREnabled(true);viewer.scene._renderer.setSAOEnabled(true);viewer.scene._renderer.setTransparentEnabled(true);if(_this106._onStopped){_this106._onStopped();}fastMode=false;};_this106._onCameraMatrix=viewer.scene.camera.on("matrix",switchToLowQuality);_this106._onSceneTick=viewer.scene.on("tick",function(tickEvent){if(!fastMode){return;}timer-=tickEvent.deltaTime;if(!_this106._delayBeforeRestore||timer<=0){switchToHighQuality();}});return _this106;}/**
|
|
20873
20873
|
* Gets whether to temporarily hide color textures whenever we interact with the Viewer.
|
|
20874
20874
|
*
|
|
20875
20875
|
* Default is ````true````.
|