@xeokit/xeokit-sdk 2.6.78 → 2.6.80
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 +12 -12
- package/dist/xeokit-sdk.es.js +12 -12
- package/dist/xeokit-sdk.es5.js +9 -9
- package/dist/xeokit-sdk.min.cjs.js +5 -5
- package/dist/xeokit-sdk.min.es.js +5 -5
- package/dist/xeokit-sdk.min.es5.js +5 -5
- package/package.json +1 -1
- package/src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js +4 -4
- package/src/viewer/scene/canvas/Canvas.js +1 -1
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorTextureRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesFlatColorRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorTextureRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatColorRenderer.js +1 -1
- package/src/viewer/scene/nodes/Node.js +1 -1
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* xeokit-sdk v2.6.
|
|
3
|
-
* Commit:
|
|
4
|
-
* Built: 2025-06-
|
|
2
|
+
* xeokit-sdk v2.6.79
|
|
3
|
+
* Commit: 7563f746eb87a29747e2d5591e9646245046a667
|
|
4
|
+
* Built: 2025-06-22T09:24:22.191Z
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
@@ -19198,7 +19198,7 @@ class Node$1 extends Component {
|
|
|
19198
19198
|
}
|
|
19199
19199
|
if (this._children.length) {
|
|
19200
19200
|
// Clone the _children before iterating, so our children don't mess us up when calling removeChild().
|
|
19201
|
-
const tempChildList = this._children.splice();
|
|
19201
|
+
const tempChildList = this._children.splice(0);
|
|
19202
19202
|
let child;
|
|
19203
19203
|
for (let i = 0, len = tempChildList.length; i < len; i++) {
|
|
19204
19204
|
child = tempChildList[i];
|
|
@@ -35499,7 +35499,7 @@ class TrianglesFlatColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
35499
35499
|
}
|
|
35500
35500
|
} else if (light.type === "point") {
|
|
35501
35501
|
if (light.space === "view") {
|
|
35502
|
-
src.push("viewLightDir = -normalize(lightPos" + i + " -
|
|
35502
|
+
src.push("viewLightDir = -normalize(lightPos" + i + " - vViewPosition.xyz);");
|
|
35503
35503
|
} else {
|
|
35504
35504
|
src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos" + i + ", 0.0)).xyz);");
|
|
35505
35505
|
}
|
|
@@ -37722,7 +37722,7 @@ class TrianglesColorTextureRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
37722
37722
|
}
|
|
37723
37723
|
} else if (light.type === "point") {
|
|
37724
37724
|
if (light.space === "view") {
|
|
37725
|
-
src.push("viewLightDir = -normalize(lightPos" + i + " -
|
|
37725
|
+
src.push("viewLightDir = -normalize(lightPos" + i + " - vViewPosition.xyz);");
|
|
37726
37726
|
} else {
|
|
37727
37727
|
src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos" + i + ", 0.0)).xyz);");
|
|
37728
37728
|
}
|
|
@@ -40919,7 +40919,7 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
40919
40919
|
}
|
|
40920
40920
|
} else if (light.type === "point") {
|
|
40921
40921
|
if (light.space === "view") {
|
|
40922
|
-
src.push("viewLightDir = -normalize(lightPos" + i + " -
|
|
40922
|
+
src.push("viewLightDir = -normalize(lightPos" + i + " - vViewPosition.xyz);");
|
|
40923
40923
|
} else {
|
|
40924
40924
|
src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos" + i + ", 0.0)).xyz);");
|
|
40925
40925
|
}
|
|
@@ -43212,7 +43212,7 @@ class TrianglesColorTextureRenderer extends TrianglesInstancingRenderer {
|
|
|
43212
43212
|
}
|
|
43213
43213
|
} else if (light.type === "point") {
|
|
43214
43214
|
if (light.space === "view") {
|
|
43215
|
-
src.push("viewLightDir = -normalize(lightPos" + i + " -
|
|
43215
|
+
src.push("viewLightDir = -normalize(lightPos" + i + " - vViewPosition.xyz);");
|
|
43216
43216
|
} else {
|
|
43217
43217
|
src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos" + i + ", 0.0)).xyz);");
|
|
43218
43218
|
}
|
|
@@ -109541,7 +109541,7 @@ class BCFViewpointsPlugin extends Plugin {
|
|
|
109541
109541
|
let alphaDefined = false;
|
|
109542
109542
|
|
|
109543
109543
|
if (color.length === 8) {
|
|
109544
|
-
alpha = parseInt(color.substring(0, 2), 16) /
|
|
109544
|
+
alpha = parseInt(color.substring(0, 2), 16) / 255;
|
|
109545
109545
|
if (alpha <= 1.0 && alpha >= 0.95) {
|
|
109546
109546
|
alpha = 1.0;
|
|
109547
109547
|
}
|
|
@@ -109550,9 +109550,9 @@ class BCFViewpointsPlugin extends Plugin {
|
|
|
109550
109550
|
}
|
|
109551
109551
|
|
|
109552
109552
|
const colorize = [
|
|
109553
|
-
parseInt(color.substring(0, 2), 16) /
|
|
109554
|
-
parseInt(color.substring(2, 4), 16) /
|
|
109555
|
-
parseInt(color.substring(4, 6), 16) /
|
|
109553
|
+
parseInt(color.substring(0, 2), 16) / 255,
|
|
109554
|
+
parseInt(color.substring(2, 4), 16) / 255,
|
|
109555
|
+
parseInt(color.substring(4, 6), 16) / 255
|
|
109556
109556
|
];
|
|
109557
109557
|
|
|
109558
109558
|
coloring.components.map(component =>
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* xeokit-sdk v2.6.
|
|
3
|
-
* Commit:
|
|
4
|
-
* Built: 2025-06-
|
|
2
|
+
* xeokit-sdk v2.6.79
|
|
3
|
+
* Commit: 7563f746eb87a29747e2d5591e9646245046a667
|
|
4
|
+
* Built: 2025-06-22T09:24:22.191Z
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/** @private */
|
|
@@ -19194,7 +19194,7 @@ class Node$1 extends Component {
|
|
|
19194
19194
|
}
|
|
19195
19195
|
if (this._children.length) {
|
|
19196
19196
|
// Clone the _children before iterating, so our children don't mess us up when calling removeChild().
|
|
19197
|
-
const tempChildList = this._children.splice();
|
|
19197
|
+
const tempChildList = this._children.splice(0);
|
|
19198
19198
|
let child;
|
|
19199
19199
|
for (let i = 0, len = tempChildList.length; i < len; i++) {
|
|
19200
19200
|
child = tempChildList[i];
|
|
@@ -35495,7 +35495,7 @@ class TrianglesFlatColorRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
35495
35495
|
}
|
|
35496
35496
|
} else if (light.type === "point") {
|
|
35497
35497
|
if (light.space === "view") {
|
|
35498
|
-
src.push("viewLightDir = -normalize(lightPos" + i + " -
|
|
35498
|
+
src.push("viewLightDir = -normalize(lightPos" + i + " - vViewPosition.xyz);");
|
|
35499
35499
|
} else {
|
|
35500
35500
|
src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos" + i + ", 0.0)).xyz);");
|
|
35501
35501
|
}
|
|
@@ -37718,7 +37718,7 @@ class TrianglesColorTextureRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
37718
37718
|
}
|
|
37719
37719
|
} else if (light.type === "point") {
|
|
37720
37720
|
if (light.space === "view") {
|
|
37721
|
-
src.push("viewLightDir = -normalize(lightPos" + i + " -
|
|
37721
|
+
src.push("viewLightDir = -normalize(lightPos" + i + " - vViewPosition.xyz);");
|
|
37722
37722
|
} else {
|
|
37723
37723
|
src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos" + i + ", 0.0)).xyz);");
|
|
37724
37724
|
}
|
|
@@ -40915,7 +40915,7 @@ class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {
|
|
|
40915
40915
|
}
|
|
40916
40916
|
} else if (light.type === "point") {
|
|
40917
40917
|
if (light.space === "view") {
|
|
40918
|
-
src.push("viewLightDir = -normalize(lightPos" + i + " -
|
|
40918
|
+
src.push("viewLightDir = -normalize(lightPos" + i + " - vViewPosition.xyz);");
|
|
40919
40919
|
} else {
|
|
40920
40920
|
src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos" + i + ", 0.0)).xyz);");
|
|
40921
40921
|
}
|
|
@@ -43208,7 +43208,7 @@ class TrianglesColorTextureRenderer extends TrianglesInstancingRenderer {
|
|
|
43208
43208
|
}
|
|
43209
43209
|
} else if (light.type === "point") {
|
|
43210
43210
|
if (light.space === "view") {
|
|
43211
|
-
src.push("viewLightDir = -normalize(lightPos" + i + " -
|
|
43211
|
+
src.push("viewLightDir = -normalize(lightPos" + i + " - vViewPosition.xyz);");
|
|
43212
43212
|
} else {
|
|
43213
43213
|
src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos" + i + ", 0.0)).xyz);");
|
|
43214
43214
|
}
|
|
@@ -109537,7 +109537,7 @@ class BCFViewpointsPlugin extends Plugin {
|
|
|
109537
109537
|
let alphaDefined = false;
|
|
109538
109538
|
|
|
109539
109539
|
if (color.length === 8) {
|
|
109540
|
-
alpha = parseInt(color.substring(0, 2), 16) /
|
|
109540
|
+
alpha = parseInt(color.substring(0, 2), 16) / 255;
|
|
109541
109541
|
if (alpha <= 1.0 && alpha >= 0.95) {
|
|
109542
109542
|
alpha = 1.0;
|
|
109543
109543
|
}
|
|
@@ -109546,9 +109546,9 @@ class BCFViewpointsPlugin extends Plugin {
|
|
|
109546
109546
|
}
|
|
109547
109547
|
|
|
109548
109548
|
const colorize = [
|
|
109549
|
-
parseInt(color.substring(0, 2), 16) /
|
|
109550
|
-
parseInt(color.substring(2, 4), 16) /
|
|
109551
|
-
parseInt(color.substring(4, 6), 16) /
|
|
109549
|
+
parseInt(color.substring(0, 2), 16) / 255,
|
|
109550
|
+
parseInt(color.substring(2, 4), 16) / 255,
|
|
109551
|
+
parseInt(color.substring(4, 6), 16) / 255
|
|
109552
109552
|
];
|
|
109553
109553
|
|
|
109554
109554
|
coloring.components.map(component =>
|
package/dist/xeokit-sdk.es5.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* xeokit-sdk v2.6.
|
|
3
|
-
* Commit:
|
|
4
|
-
* Built: 2025-06-
|
|
2
|
+
* xeokit-sdk v2.6.79
|
|
3
|
+
* Commit: 7563f746eb87a29747e2d5591e9646245046a667
|
|
4
|
+
* Built: 2025-06-22T09:24:22.191Z
|
|
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 _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 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 _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 _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 _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;}/**
|
|
@@ -4968,7 +4968,7 @@ return this;}/**
|
|
|
4968
4968
|
*/},{key:"type",get:function get(){return"Node";}/**
|
|
4969
4969
|
* Destroys this Node.
|
|
4970
4970
|
*/},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(Node$1.prototype),"destroy",this).call(this);if(this._parentNode){this._parentNode.removeChild(this);}if(this._isObject){this.scene._deregisterObject(this);if(this._visible){this.scene._objectVisibilityUpdated(this,false,false);}if(this._xrayed){this.scene._objectXRayedUpdated(this,false,false);}if(this._selected){this.scene._objectSelectedUpdated(this,false,false);}if(this._highlighted){this.scene._objectHighlightedUpdated(this,false,false);}this.scene._objectColorizeUpdated(this,false);this.scene._objectOpacityUpdated(this,false);if(this.offset.some(function(v){return v!==0;}))this.scene._objectOffsetUpdated(this,false);}if(this._isModel){this.scene._deregisterModel(this);}if(this._children.length){// Clone the _children before iterating, so our children don't mess us up when calling removeChild().
|
|
4971
|
-
var tempChildList=this._children.splice();var child;for(var _i64=0,len=tempChildList.length;_i64<len;_i64++){child=tempChildList[_i64];child.destroy();}}this._children=[];this._setAABBDirty();this.scene._aabbDirty=true;}}]);return Node$1;}(Component);var tempVec3a$M=math.vec3();var tempVec4$1=math.vec4();/**
|
|
4971
|
+
var tempChildList=this._children.splice(0);var child;for(var _i64=0,len=tempChildList.length;_i64<len;_i64++){child=tempChildList[_i64];child.destroy();}}this._children=[];this._setAABBDirty();this.scene._aabbDirty=true;}}]);return Node$1;}(Component);var tempVec3a$M=math.vec3();var tempVec4$1=math.vec4();/**
|
|
4972
4972
|
* Given a view matrix and a relative-to-center (RTC) coordinate origin, returns a view matrix
|
|
4973
4973
|
* to transform RTC coordinates to View-space.
|
|
4974
4974
|
*
|
|
@@ -9206,7 +9206,7 @@ src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewp
|
|
|
9206
9206
|
*/var TrianglesFlatColorRenderer$1=/*#__PURE__*/function(_TrianglesBatchingRen2){_inherits(TrianglesFlatColorRenderer$1,_TrianglesBatchingRen2);var _super27=_createSuper(TrianglesFlatColorRenderer$1);function TrianglesFlatColorRenderer$1(){_classCallCheck(this,TrianglesFlatColorRenderer$1);return _super27.apply(this,arguments);}_createClass(TrianglesFlatColorRenderer$1,[{key:"_getHash",value:function _getHash(){var scene=this._scene;return[scene._lightsState.getHash(),scene._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";");}},{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 flat-shading draw vertex shader");src.push("uniform int renderPass;");src.push("in vec3 position;");src.push("in vec4 color;");src.push("in float flags;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}this._addMatricesUniformBlockLines(src);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 vViewPosition;");src.push("out vec4 vColor;");src.push("void main(void) {");// colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT
|
|
9207
9207
|
// renderPass = COLOR_OPAQUE
|
|
9208
9208
|
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
|
|
9209
|
-
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 _i118=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i118<len;_i118++){src.push("uniform bool sectionPlaneActive"+_i118+";");src.push("uniform vec3 sectionPlanePos"+_i118+";");src.push("uniform vec3 sectionPlaneDir"+_i118+";");}src.push("uniform float sliceThickness;");src.push("uniform vec4 sliceColor;");}this._addMatricesUniformBlockLines(src);src.push("uniform vec4 lightAmbient;");for(var _i119=0,_len19=lightsState.lights.length;_i119<_len19;_i119++){var light=lightsState.lights[_i119];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+_i119+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+_i119+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+_i119+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+_i119+";");src.push("uniform vec3 lightDir"+_i119+";");}}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 _i120=0,_len20=sectionPlanesState.getNumAllocatedSectionPlanes();_i120<_len20;_i120++){src.push("if (sectionPlaneActive"+_i120+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i120+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i120+".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 _i121=0,_len21=lightsState.lights.length;_i121<_len21;_i121++){var _light4=lightsState.lights[_i121];if(_light4.type==="ambient"){continue;}if(_light4.type==="dir"){if(_light4.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i121+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i121+", 0.0)).xyz);");}}else if(_light4.type==="point"){if(_light4.space==="view"){src.push("viewLightDir = -normalize(lightPos"+_i121+" -
|
|
9209
|
+
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 _i118=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i118<len;_i118++){src.push("uniform bool sectionPlaneActive"+_i118+";");src.push("uniform vec3 sectionPlanePos"+_i118+";");src.push("uniform vec3 sectionPlaneDir"+_i118+";");}src.push("uniform float sliceThickness;");src.push("uniform vec4 sliceColor;");}this._addMatricesUniformBlockLines(src);src.push("uniform vec4 lightAmbient;");for(var _i119=0,_len19=lightsState.lights.length;_i119<_len19;_i119++){var light=lightsState.lights[_i119];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+_i119+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+_i119+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+_i119+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+_i119+";");src.push("uniform vec3 lightDir"+_i119+";");}}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 _i120=0,_len20=sectionPlanesState.getNumAllocatedSectionPlanes();_i120<_len20;_i120++){src.push("if (sectionPlaneActive"+_i120+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i120+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i120+".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 _i121=0,_len21=lightsState.lights.length;_i121<_len21;_i121++){var _light4=lightsState.lights[_i121];if(_light4.type==="ambient"){continue;}if(_light4.type==="dir"){if(_light4.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i121+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i121+", 0.0)).xyz);");}}else if(_light4.type==="point"){if(_light4.space==="view"){src.push("viewLightDir = -normalize(lightPos"+_i121+" - vViewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+_i121+", 0.0)).xyz);");}}else if(_light4.type==="spot"){if(_light4.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i121+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i121+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+_i121+".rgb * lightColor"+_i121+".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
|
|
9210
9210
|
// Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject
|
|
9211
9211
|
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);/**
|
|
9212
9212
|
* @private
|
|
@@ -9296,7 +9296,7 @@ src.push(" } else {");src.push(" vec4 worldPosition = worldMatrix * (posit
|
|
|
9296
9296
|
// renderPass = COLOR_OPAQUE
|
|
9297
9297
|
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
|
|
9298
9298
|
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("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;");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 gammaOutput=scene.gammaOutput;// If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
|
|
9299
|
-
var lightsState=scene._lightsState;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var useAlphaCutoff=this._useAlphaCutoff;var src=[];src.push("#version 300 es");src.push("// Triangles batching color texture 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;");}src.push("uniform sampler2D uColorMap;");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("}");}src.push("uniform float gammaFactor;");src.push("vec4 linearToLinear( in vec4 value ) {");src.push(" return value;");src.push("}");src.push("vec4 sRGBToLinear( in vec4 value ) {");src.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );");src.push("}");src.push("vec4 gammaToLinear( in vec4 value) {");src.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );");src.push("}");if(gammaOutput){src.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {");src.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i140=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i140<len;_i140++){src.push("uniform bool sectionPlaneActive"+_i140+";");src.push("uniform vec3 sectionPlanePos"+_i140+";");src.push("uniform vec3 sectionPlaneDir"+_i140+";");}src.push("uniform float sliceThickness;");src.push("uniform vec4 sliceColor;");}this._addMatricesUniformBlockLines(src);src.push("uniform vec4 lightAmbient;");for(var _i141=0,_len28=lightsState.lights.length;_i141<_len28;_i141++){var light=lightsState.lights[_i141];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+_i141+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+_i141+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+_i141+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+_i141+";");src.push("uniform vec3 lightDir"+_i141+";");}}if(useAlphaCutoff){src.push("uniform float materialAlphaCutoff;");}src.push("in vec4 vViewPosition;");src.push("in vec4 vColor;");src.push("in vec2 vUV;");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 _i142=0,_len29=sectionPlanesState.getNumAllocatedSectionPlanes();_i142<_len29;_i142++){src.push("if (sectionPlaneActive"+_i142+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i142+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i142+".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 _i143=0,_len30=lightsState.lights.length;_i143<_len30;_i143++){var _light6=lightsState.lights[_i143];if(_light6.type==="ambient"){continue;}if(_light6.type==="dir"){if(_light6.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i143+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i143+", 0.0)).xyz);");}}else if(_light6.type==="point"){if(_light6.space==="view"){src.push("viewLightDir = -normalize(lightPos"+_i143+" -
|
|
9299
|
+
var lightsState=scene._lightsState;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var useAlphaCutoff=this._useAlphaCutoff;var src=[];src.push("#version 300 es");src.push("// Triangles batching color texture 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;");}src.push("uniform sampler2D uColorMap;");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("}");}src.push("uniform float gammaFactor;");src.push("vec4 linearToLinear( in vec4 value ) {");src.push(" return value;");src.push("}");src.push("vec4 sRGBToLinear( in vec4 value ) {");src.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );");src.push("}");src.push("vec4 gammaToLinear( in vec4 value) {");src.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );");src.push("}");if(gammaOutput){src.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {");src.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i140=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i140<len;_i140++){src.push("uniform bool sectionPlaneActive"+_i140+";");src.push("uniform vec3 sectionPlanePos"+_i140+";");src.push("uniform vec3 sectionPlaneDir"+_i140+";");}src.push("uniform float sliceThickness;");src.push("uniform vec4 sliceColor;");}this._addMatricesUniformBlockLines(src);src.push("uniform vec4 lightAmbient;");for(var _i141=0,_len28=lightsState.lights.length;_i141<_len28;_i141++){var light=lightsState.lights[_i141];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+_i141+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+_i141+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+_i141+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+_i141+";");src.push("uniform vec3 lightDir"+_i141+";");}}if(useAlphaCutoff){src.push("uniform float materialAlphaCutoff;");}src.push("in vec4 vViewPosition;");src.push("in vec4 vColor;");src.push("in vec2 vUV;");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 _i142=0,_len29=sectionPlanesState.getNumAllocatedSectionPlanes();_i142<_len29;_i142++){src.push("if (sectionPlaneActive"+_i142+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i142+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i142+".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 _i143=0,_len30=lightsState.lights.length;_i143<_len30;_i143++){var _light6=lightsState.lights[_i143];if(_light6.type==="ambient"){continue;}if(_light6.type==="dir"){if(_light6.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i143+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i143+", 0.0)).xyz);");}}else if(_light6.type==="point"){if(_light6.space==="view"){src.push("viewLightDir = -normalize(lightPos"+_i143+" - vViewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+_i143+", 0.0)).xyz);");}}else if(_light6.type==="spot"){if(_light6.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i143+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i143+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+_i143+".rgb * lightColor"+_i143+".a);");}src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a * newColor.rgb) + (reflectedColor * newColor.rgb), newColor.a);");src.push("vec4 sampleColor = texture(uColorMap, vUV);");if(useAlphaCutoff){src.push("if (sampleColor.a < materialAlphaCutoff) {");src.push(" discard;");src.push("}");}if(gammaOutput){src.push("sampleColor = sRGBToLinear(sampleColor);");}src.push("vec4 colorTexel = color * sampleColor;");src.push("float opacity = color.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
|
|
9300
9300
|
// Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject
|
|
9301
9301
|
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(colorTexel.rgb * ambient, opacity);");}else{src.push(" outColor = vec4(colorTexel.rgb, opacity);");}if(gammaOutput){src.push("outColor = linearToGamma(outColor, gammaFactor);");}if(scene.logarithmicDepthBufferEnabled){src.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("}");return src;}}]);return TrianglesColorTextureRenderer$1;}(TrianglesBatchingRenderer);var tempVec3a$E=math.vec3();var tempVec3b$A=math.vec3();var tempVec3c$v=math.vec3();var tempVec3d$e=math.vec3();var tempMat4a$q=math.mat4();/**
|
|
9302
9302
|
* @private
|
|
@@ -9542,7 +9542,7 @@ if(this._withSAO){src.push(" float viewportWidth = uSAOParams[0];");src.pu
|
|
|
9542
9542
|
src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");this._addMatricesUniformBlockLines(src);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 vViewPosition;");src.push("out vec4 vColor;");src.push("void main(void) {");// colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT
|
|
9543
9543
|
// renderPass = COLOR_OPAQUE | COLOR_TRANSPARENT
|
|
9544
9544
|
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
|
|
9545
|
-
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 _i171=0,_len41=sectionPlanesState.getNumAllocatedSectionPlanes();_i171<_len41;_i171++){src.push("uniform bool sectionPlaneActive"+_i171+";");src.push("uniform vec3 sectionPlanePos"+_i171+";");src.push("uniform vec3 sectionPlaneDir"+_i171+";");}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 _i172=0,_len42=sectionPlanesState.getNumAllocatedSectionPlanes();_i172<_len42;_i172++){src.push("if (sectionPlaneActive"+_i172+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i172+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i172+".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+" -
|
|
9545
|
+
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 _i171=0,_len41=sectionPlanesState.getNumAllocatedSectionPlanes();_i171<_len41;_i171++){src.push("uniform bool sectionPlaneActive"+_i171+";");src.push("uniform vec3 sectionPlanePos"+_i171+";");src.push("uniform vec3 sectionPlaneDir"+_i171+";");}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 _i172=0,_len42=sectionPlanesState.getNumAllocatedSectionPlanes();_i172<_len42;_i172++){src.push("if (sectionPlaneActive"+_i172+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i172+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i172+".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+" - vViewPosition.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
|
|
9546
9546
|
// Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject
|
|
9547
9547
|
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);/**
|
|
9548
9548
|
* @private
|
|
@@ -9639,7 +9639,7 @@ src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");this._
|
|
|
9639
9639
|
// renderPass = COLOR_OPAQUE | COLOR_TRANSPARENT
|
|
9640
9640
|
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
|
|
9641
9641
|
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("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;");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 gammaOutput=scene.gammaOutput;// If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
|
|
9642
|
-
var lightsState=scene._lightsState;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var useAlphaCutoff=this._useAlphaCutoff;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;");}src.push("uniform sampler2D uColorMap;");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("}");}src.push("uniform float gammaFactor;");src.push("vec4 linearToLinear( in vec4 value ) {");src.push(" return value;");src.push("}");src.push("vec4 sRGBToLinear( in vec4 value ) {");src.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );");src.push("}");src.push("vec4 gammaToLinear( in vec4 value) {");src.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );");src.push("}");if(gammaOutput){src.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {");src.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i195=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i195<len;_i195++){src.push("uniform bool sectionPlaneActive"+_i195+";");src.push("uniform vec3 sectionPlanePos"+_i195+";");src.push("uniform vec3 sectionPlaneDir"+_i195+";");}src.push("uniform float sliceThickness;");src.push("uniform vec4 sliceColor;");}this._addMatricesUniformBlockLines(src);src.push("uniform vec4 lightAmbient;");for(var _i196=0,_len51=lightsState.lights.length;_i196<_len51;_i196++){var light=lightsState.lights[_i196];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+_i196+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+_i196+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+_i196+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+_i196+";");src.push("uniform vec3 lightDir"+_i196+";");}}if(useAlphaCutoff){src.push("uniform float materialAlphaCutoff;");}src.push("in vec4 vViewPosition;");src.push("in vec4 vColor;");src.push("in vec2 vUV;");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,_len52=sectionPlanesState.getNumAllocatedSectionPlanes();_i197<_len52;_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("}");}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 _i198=0,_len53=lightsState.lights.length;_i198<_len53;_i198++){var _light9=lightsState.lights[_i198];if(_light9.type==="ambient"){continue;}if(_light9.type==="dir"){if(_light9.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i198+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i198+", 0.0)).xyz);");}}else if(_light9.type==="point"){if(_light9.space==="view"){src.push("viewLightDir = -normalize(lightPos"+_i198+" -
|
|
9642
|
+
var lightsState=scene._lightsState;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var useAlphaCutoff=this._useAlphaCutoff;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;");}src.push("uniform sampler2D uColorMap;");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("}");}src.push("uniform float gammaFactor;");src.push("vec4 linearToLinear( in vec4 value ) {");src.push(" return value;");src.push("}");src.push("vec4 sRGBToLinear( in vec4 value ) {");src.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );");src.push("}");src.push("vec4 gammaToLinear( in vec4 value) {");src.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );");src.push("}");if(gammaOutput){src.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {");src.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i195=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i195<len;_i195++){src.push("uniform bool sectionPlaneActive"+_i195+";");src.push("uniform vec3 sectionPlanePos"+_i195+";");src.push("uniform vec3 sectionPlaneDir"+_i195+";");}src.push("uniform float sliceThickness;");src.push("uniform vec4 sliceColor;");}this._addMatricesUniformBlockLines(src);src.push("uniform vec4 lightAmbient;");for(var _i196=0,_len51=lightsState.lights.length;_i196<_len51;_i196++){var light=lightsState.lights[_i196];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+_i196+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+_i196+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+_i196+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+_i196+";");src.push("uniform vec3 lightDir"+_i196+";");}}if(useAlphaCutoff){src.push("uniform float materialAlphaCutoff;");}src.push("in vec4 vViewPosition;");src.push("in vec4 vColor;");src.push("in vec2 vUV;");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,_len52=sectionPlanesState.getNumAllocatedSectionPlanes();_i197<_len52;_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("}");}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 _i198=0,_len53=lightsState.lights.length;_i198<_len53;_i198++){var _light9=lightsState.lights[_i198];if(_light9.type==="ambient"){continue;}if(_light9.type==="dir"){if(_light9.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i198+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i198+", 0.0)).xyz);");}}else if(_light9.type==="point"){if(_light9.space==="view"){src.push("viewLightDir = -normalize(lightPos"+_i198+" - vViewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+_i198+", 0.0)).xyz);");}}else if(_light9.type==="spot"){if(_light9.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i198+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i198+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+_i198+".rgb * lightColor"+_i198+".a);");}src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a * newColor.rgb) + (reflectedColor * newColor.rgb), newColor.a);");src.push("vec4 sampleColor = texture(uColorMap, vUV);");if(useAlphaCutoff){src.push("if (sampleColor.a < materialAlphaCutoff) {");src.push(" discard;");src.push("}");}if(gammaOutput){src.push("sampleColor = sRGBToLinear(sampleColor);");}src.push("vec4 colorTexel = color * sampleColor;");src.push("float opacity = color.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
|
|
9643
9643
|
// Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject
|
|
9644
9644
|
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(colorTexel.rgb * ambient, opacity);");}else{src.push(" outColor = vec4(colorTexel.rgb, opacity);");}if(gammaOutput){src.push("outColor = linearToGamma(outColor, gammaFactor);");}if(scene.logarithmicDepthBufferEnabled){src.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("}");return src;}}]);return TrianglesColorTextureRenderer;}(TrianglesInstancingRenderer);var tempVec3a$B=math.vec3();var tempVec3b$x=math.vec3();var tempVec3c$s=math.vec3();var tempVec3d$b=math.vec3();var tempMat4a$o=math.mat4();/**
|
|
9645
9645
|
* @private
|
|
@@ -24401,7 +24401,7 @@ alpha=0.1;}else{alpha=scene.xrayMaterial.fillAlpha;}alpha=Math.round(alpha*255).
|
|
|
24401
24401
|
* then this method will apply the updates to objects within those composites.
|
|
24402
24402
|
*/},{key:"setViewpoint",value:function setViewpoint(bcfViewpoint){var _this114=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!bcfViewpoint){return;}var viewer=this.viewer;var scene=viewer.scene;var camera=scene.camera;var rayCast=options.rayCast!==false;var immediate=options.immediate!==false;var reset=options.reset!==false;var realWorldOffset=scene.realWorldOffset;var reverseClippingPlanes=options.reverseClippingPlanes===true;scene.clearSectionPlanes();if(bcfViewpoint.clipping_planes&&bcfViewpoint.clipping_planes.length>0){bcfViewpoint.clipping_planes.forEach(function(e){var pos=xyzObjectToArray(e.location,tempVec3$2);var dir=xyzObjectToArray(e.direction,tempVec3$2);if(reverseClippingPlanes){math.negateVec3(dir);}math.subVec3(pos,realWorldOffset);if(camera.yUp){pos=ZToY(pos);dir=ZToY(dir);}new SectionPlane(scene,{pos:pos,dir:dir});});}scene.clearLines();if(bcfViewpoint.lines&&bcfViewpoint.lines.length>0){var positions=[];var indices=[];var _i530=0;bcfViewpoint.lines.forEach(function(e){if(!e.start_point){return;}if(!e.end_point){return;}positions.push(e.start_point.x);positions.push(e.start_point.y);positions.push(e.start_point.z);positions.push(e.end_point.x);positions.push(e.end_point.y);positions.push(e.end_point.z);indices.push(_i530++);indices.push(_i530++);});new LineSet(scene,{positions:positions,indices:indices,clippable:false,collidable:true});}scene.clearBitmaps();if(bcfViewpoint.bitmaps&&bcfViewpoint.bitmaps.length>0){bcfViewpoint.bitmaps.forEach(function(e){var bitmap_type=e.bitmap_type||"jpg";// "jpg" | "png"
|
|
24403
24403
|
var bitmap_data=e.bitmap_data;// base64
|
|
24404
|
-
var location=xyzObjectToArray(e.location,tempVec3a$5);var normal=xyzObjectToArray(e.normal,tempVec3b$2);var up=xyzObjectToArray(e.up,tempVec3c$1);var height=e.height||1;if(!bitmap_type){return;}if(!bitmap_data){return;}if(!location){return;}if(!normal){return;}if(!up){return;}if(camera.yUp){location=ZToY(location);normal=ZToY(normal);up=ZToY(up);}new Bitmap(scene,{src:bitmap_data,type:bitmap_type,pos:location,normal:normal,up:up,clippable:false,collidable:true,height:height});});}if(reset){scene.setObjectsXRayed(scene.xrayedObjectIds,false);scene.setObjectsHighlighted(scene.highlightedObjectIds,false);scene.setObjectsSelected(scene.selectedObjectIds,false);}if(bcfViewpoint.components){if(bcfViewpoint.components.visibility){if(!bcfViewpoint.components.visibility.default_visibility){scene.setObjectsVisible(scene.objectIds,false);if(bcfViewpoint.components.visibility.exceptions){bcfViewpoint.components.visibility.exceptions.forEach(function(component){return _this114._withBCFComponent(options,component,function(entity){return entity.visible=true;});});}}else{scene.setObjectsVisible(scene.objectIds,true);if(bcfViewpoint.components.visibility.exceptions){bcfViewpoint.components.visibility.exceptions.forEach(function(component){return _this114._withBCFComponent(options,component,function(entity){return entity.visible=false;});});}}var view_setup_hints=bcfViewpoint.components.visibility.view_setup_hints;if(view_setup_hints){if(view_setup_hints.spaces_visible===false){scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"),false);}if(view_setup_hints.spaces_translucent!==undefined){scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType("IfcSpace"),true);}if(view_setup_hints.space_boundaries_visible!==undefined);if(view_setup_hints.openings_visible===false){scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcOpening"),true);}if(view_setup_hints.space_boundaries_translucent!==undefined);if(view_setup_hints.openings_translucent!==undefined){scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType("IfcOpening"),true);}}}if(bcfViewpoint.components.selection){scene.setObjectsSelected(scene.selectedObjectIds,false);bcfViewpoint.components.selection.forEach(function(component){return _this114._withBCFComponent(options,component,function(entity){return entity.selected=true;});});}if(bcfViewpoint.components.translucency){scene.setObjectsXRayed(scene.xrayedObjectIds,false);bcfViewpoint.components.translucency.forEach(function(component){return _this114._withBCFComponent(options,component,function(entity){return entity.xrayed=true;});});}if(bcfViewpoint.components.coloring){bcfViewpoint.components.coloring.forEach(function(coloring){var color=coloring.color;var alpha=0;var alphaDefined=false;if(color.length===8){alpha=parseInt(color.substring(0,2),16)/
|
|
24404
|
+
var location=xyzObjectToArray(e.location,tempVec3a$5);var normal=xyzObjectToArray(e.normal,tempVec3b$2);var up=xyzObjectToArray(e.up,tempVec3c$1);var height=e.height||1;if(!bitmap_type){return;}if(!bitmap_data){return;}if(!location){return;}if(!normal){return;}if(!up){return;}if(camera.yUp){location=ZToY(location);normal=ZToY(normal);up=ZToY(up);}new Bitmap(scene,{src:bitmap_data,type:bitmap_type,pos:location,normal:normal,up:up,clippable:false,collidable:true,height:height});});}if(reset){scene.setObjectsXRayed(scene.xrayedObjectIds,false);scene.setObjectsHighlighted(scene.highlightedObjectIds,false);scene.setObjectsSelected(scene.selectedObjectIds,false);}if(bcfViewpoint.components){if(bcfViewpoint.components.visibility){if(!bcfViewpoint.components.visibility.default_visibility){scene.setObjectsVisible(scene.objectIds,false);if(bcfViewpoint.components.visibility.exceptions){bcfViewpoint.components.visibility.exceptions.forEach(function(component){return _this114._withBCFComponent(options,component,function(entity){return entity.visible=true;});});}}else{scene.setObjectsVisible(scene.objectIds,true);if(bcfViewpoint.components.visibility.exceptions){bcfViewpoint.components.visibility.exceptions.forEach(function(component){return _this114._withBCFComponent(options,component,function(entity){return entity.visible=false;});});}}var view_setup_hints=bcfViewpoint.components.visibility.view_setup_hints;if(view_setup_hints){if(view_setup_hints.spaces_visible===false){scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"),false);}if(view_setup_hints.spaces_translucent!==undefined){scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType("IfcSpace"),true);}if(view_setup_hints.space_boundaries_visible!==undefined);if(view_setup_hints.openings_visible===false){scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcOpening"),true);}if(view_setup_hints.space_boundaries_translucent!==undefined);if(view_setup_hints.openings_translucent!==undefined){scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType("IfcOpening"),true);}}}if(bcfViewpoint.components.selection){scene.setObjectsSelected(scene.selectedObjectIds,false);bcfViewpoint.components.selection.forEach(function(component){return _this114._withBCFComponent(options,component,function(entity){return entity.selected=true;});});}if(bcfViewpoint.components.translucency){scene.setObjectsXRayed(scene.xrayedObjectIds,false);bcfViewpoint.components.translucency.forEach(function(component){return _this114._withBCFComponent(options,component,function(entity){return entity.xrayed=true;});});}if(bcfViewpoint.components.coloring){bcfViewpoint.components.coloring.forEach(function(coloring){var color=coloring.color;var alpha=0;var alphaDefined=false;if(color.length===8){alpha=parseInt(color.substring(0,2),16)/255;if(alpha<=1.0&&alpha>=0.95){alpha=1.0;}color=color.substring(2);alphaDefined=true;}var colorize=[parseInt(color.substring(0,2),16)/255,parseInt(color.substring(2,4),16)/255,parseInt(color.substring(4,6),16)/255];coloring.components.map(function(component){return _this114._withBCFComponent(options,component,function(entity){entity.colorize=colorize;if(alphaDefined){entity.opacity=alpha;}});});});}}if(bcfViewpoint.perspective_camera||bcfViewpoint.orthogonal_camera){var eye;var look;var _up4;var projection;if(bcfViewpoint.perspective_camera){eye=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_view_point,tempVec3$2);look=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_direction,tempVec3$2);_up4=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_up_vector,tempVec3$2);camera.perspective.fov=bcfViewpoint.perspective_camera.field_of_view;projection="perspective";}else{eye=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_view_point,tempVec3$2);look=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_direction,tempVec3$2);_up4=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_up_vector,tempVec3$2);camera.ortho.scale=bcfViewpoint.orthogonal_camera.view_to_world_scale;projection="ortho";}math.subVec3(eye,realWorldOffset);if(camera.yUp){eye=ZToY(eye);look=ZToY(look);_up4=ZToY(_up4);}if(rayCast){var hit=scene.pick({pickSurface:true,// <<------ This causes picking to find the intersection point on the entity
|
|
24405
24405
|
origin:eye,direction:look});look=hit?hit.worldPos:math.addVec3(eye,look,tempVec3$2);}else{look=math.addVec3(eye,look,tempVec3$2);}if(immediate){camera.eye=eye;camera.look=look;camera.up=_up4;camera.projection=projection;}else{viewer.cameraFlight.flyTo({eye:eye,look:look,up:_up4,duration:options.duration,projection:projection});}}}},{key:"_withBCFComponent",value:function _withBCFComponent(options,component,callback){var viewer=this.viewer;var scene=viewer.scene;if(component.authoring_tool_id&&component.originating_system===this.originatingSystem){var id=component.authoring_tool_id;var entity=scene.objects[id];if(entity){callback(entity);return;}if(options.updateCompositeObjects){var metaObject=viewer.metaScene.metaObjects[id];if(metaObject){scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(id),callback);return;}}}if(component.ifc_guid){var originalSystemId=component.ifc_guid;var _entity2=scene.objects[originalSystemId];if(_entity2){callback(_entity2);return;}if(options.updateCompositeObjects){var _metaObject10=viewer.metaScene.metaObjects[originalSystemId];if(_metaObject10){scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(originalSystemId),callback);return;}}Object.keys(scene.models).forEach(function(modelId){var id=math.globalizeObjectId(modelId,originalSystemId);var entity=scene.objects[id];if(entity){callback(entity);return;}if(options.updateCompositeObjects){var _metaObject11=viewer.metaScene.metaObjects[id];if(_metaObject11){scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(id),callback);}}});}}/**
|
|
24406
24406
|
* Destroys this BCFViewpointsPlugin.
|
|
24407
24407
|
*/},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(BCFViewpointsPlugin.prototype),"destroy",this).call(this);}}]);return BCFViewpointsPlugin;}(Plugin);function xyzArrayToObject(arr){return{"x":arr[0],"y":arr[1],"z":arr[2]};}function xyzObjectToArray(xyz,arry){arry=new Float64Array(3);arry[0]=xyz.x;arry[1]=xyz.y;arry[2]=xyz.z;return arry;}function YToZ(vec){return new Float64Array([vec[0],-vec[2],vec[1]]);}function ZToY(vec){return new Float64Array([vec[0],vec[2],-vec[1]]);}function colorizeToRGB(color){var rgb="";rgb+=Math.round(color[0]*255).toString(16).padStart(2,"0");rgb+=Math.round(color[1]*255).toString(16).padStart(2,"0");rgb+=Math.round(color[2]*255).toString(16).padStart(2,"0");return rgb;}var tmpVec3a=math.vec3();var tmpVec3b=math.vec3();var tmpVec3c=math.vec3();math.vec4();math.vec4();math.vec4();/**
|